Artifactspublic-v0

curl

master
ply4 git calls29 ms289 KiB3 cachedprotocol v2
116 lines4.1 KiBRaw
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9 *
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.se/docs/copyright.html.
13 *
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 * SPDX-License-Identifier: curl
22 *
23 ***************************************************************************/
24#include "first.h"
26static CURLcode test_lib1922(const char *URL)
28 CURLcode result = CURLE_OK;
29 CURL *curl = NULL;
30 CURL *dup = NULL;
31 struct curl_slist *resolve = NULL;
32 char resolve_entry[256];
33 char direct_url[256];
34 char http_url[256];
35 char proxy_url[256];
36 const char *effective = NULL;
37 const char *host = libtest_arg2; /* %HOSTIP */
38 const char *httpport = libtest_arg3; /* %HTTPPORT */
39 const char *proxyport = libtest_arg4;/* %PROXYPORT */
41 (void)URL;
43 if(!host || !httpport || !proxyport) {
44 curl_mfprintf(stderr,
45 "Usage: lib1922 - <host> <httpport> <proxyport>\n");
46 return TEST_ERR_MAJOR_BAD;
47 }
49 /* Synthetic DNS so hsts.example.com resolves to the test server. */
50 curl_msnprintf(resolve_entry, sizeof(resolve_entry),
51 "hsts.example.com:%s:%s", httpport, host);
52 resolve = curl_slist_append(NULL, resolve_entry);
53 if(!resolve) {
54 return CURLE_OUT_OF_MEMORY;
55 }
57 curl_msnprintf(direct_url, sizeof(direct_url),
58 "http://hsts.example.com:%s/%d", httpport, 1922);
59 curl_msnprintf(http_url, sizeof(http_url),
60 "http://hsts.example.com/%d", 1922);
61 curl_msnprintf(proxy_url, sizeof(proxy_url),
62 "http://%s:%s", host, proxyport);
64 global_init(CURL_GLOBAL_ALL);
65 easy_init(curl);
67 easy_setopt(curl, CURLOPT_WRITEFUNCTION, tutil_throwaway_cb);
68 easy_setopt(curl, CURLOPT_RESOLVE, resolve);
69 easy_setopt(curl, CURLOPT_URL, direct_url);
70 easy_setopt(curl, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
72 /* Direct HTTP request: Server returns Strict-Transport-Security.
73 * CURL_HSTS_HTTP env var (set in the test) allows processing it over
74 * HTTP in debug builds, populating the live HSTS cache. */
75 result = curl_easy_perform(curl);
76 if(result) {
77 curl_mfprintf(stderr, "First perform failed: %d (%s)\n",
78 (int)result, curl_easy_strerror(result));
79 goto test_cleanup;
80 }
81 curl_mprintf("First request: HSTS cache populated\n");
83 dup = curl_easy_duphandle(curl);
84 if(!dup) {
85 result = CURLE_FAILED_INIT;
86 goto test_cleanup;
87 }
89 /* Point the dup at the plain HTTP URL for the same hostname, via a proxy.
90 * The copied HSTS cache upgrades the URL to HTTPS, causing a CONNECT to
91 * port 443. The test proxy rejects CONNECT with 403, so curl returns
92 * CURLE_COULDNT_CONNECT (7). The CONNECT to port 443 is itself the proof
93 * of the upgrade. */
94 easy_setopt(dup, CURLOPT_URL, http_url);
95 easy_setopt(dup, CURLOPT_PROXY, proxy_url);
97 result = curl_easy_perform(dup);
98 if(result != CURLE_COULDNT_CONNECT) {
99 curl_mfprintf(stderr, "Dup perform unexpected result: %d (%s)\n",
100 (int)result, curl_easy_strerror(result));
101 goto test_cleanup;
102 }
104 /* Confirm the dup's URL was upgraded to HTTPS by the copied HSTS cache. */
105 curl_easy_getinfo(dup, CURLINFO_EFFECTIVE_URL, &effective);
106 if(effective) {
107 curl_mprintf("Dup effective URL: %s\n", effective);
108 }
110test_cleanup:
111 curl_easy_cleanup(curl);
112 curl_easy_cleanup(dup);
113 curl_slist_free_all(resolve);
114 curl_global_cleanup();
115 return result;
Diagnostics4 git calls · 29 ms
CallStatusSizeTime029 ms
discover200152 B4 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=3
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=149
git.pkt.payload.max=78
git.ls_refs.count=2
git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=23
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=10
git.pkt.data=8
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=293470
git.pkt.payload.max=65516
git.sideband.band1.bytes=293354
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=87
git.pack.bytes=293354
git.pack.ofs_delta=0
git.pack.ref_delta=1
git.pack.chain.max=1
git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0
git.pack.full=86
Open pack map
fetch2001.7 KiB · hit23 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1701
git.response.cache=HIT
git.response.duration_ms=23
git.fetch.wants=17b9cb8e34f35d57c0e4372428cf5ed85717df20
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1701
git.pkt.payload.max=1680
git.sideband.band1.bytes=1679
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
Ref
refs/heads/master
Commit
31c911efe5652725e930f4d2e60c9060e5f6646d
cf-ray
a5e333d9ad72f485
Request
3a996726…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format