master
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 void t1940_showem(CURL *curl, int header_request, unsigned int type)
27{
28 static const char * const testdata[] = {
29 "daTE",
30 "Server",
31 "content-type",
32 "content-length",
33 "location",
34 "set-cookie",
35 "silly-thing",
36 "fold",
37 "blank",
38 "Blank2",
39 "Test",
40 NULL
41 };
43 int i;
44 struct curl_header *header;
45 for(i = 0; testdata[i]; i++) {
46 if(CURLHE_OK == curl_easy_header(curl, testdata[i], 0,
47 type, header_request, &header)) {
48 if(header->amount > 1) {
49 /* more than one, iterate over them */
50 size_t index = 0;
51 size_t amount = header->amount;
52 do {
53 curl_mprintf("- %s == %s (%zu/%zu)\n", header->name, header->value,
54 index, amount);
56 if(++index == amount)
57 break;
58 if(CURLHE_OK != curl_easy_header(curl, testdata[i], index,
59 type, header_request, &header))
60 break;
61 } while(1);
62 }
63 else {
64 /* only one of this */
65 curl_mprintf(" %s == %s\n", header->name, header->value);
66 }
67 }
68 }
69}
71static CURLHcode t1940_negative(CURL *curl, int req_index)
72{
73 struct curl_header *hd1, *hd2;
74 CURLHcode result;
76 result = curl_easy_header(NULL, "x", 0, CURLH_HEADER, -1, &hd1);
77 if(result != CURLHE_BAD_ARGUMENT)
78 return result;
80 result = curl_easy_header(curl, NULL, 0, CURLH_HEADER, -1, &hd1);
81 if(result != CURLHE_BAD_ARGUMENT)
82 return result;
84 result = curl_easy_header(curl, "x", 0, CURLH_HEADER, -1, NULL);
85 if(result != CURLHE_BAD_ARGUMENT)
86 return result;
88 result = curl_easy_header(curl, "x", 0, 0, -1, &hd1);
89 if(result != CURLHE_BAD_ARGUMENT)
90 return result;
92 result = curl_easy_header(curl, "date", 0, CURLH_HEADER, req_index, &hd1);
93 if(result != CURLHE_OK)
94 return result;
95 if(!hd1)
96 return CURLHE_NOHEADERS;
98 /* Should give the first header */
99 hd2 = curl_easy_nextheader(curl, CURLH_HEADER, -1, NULL);
100 if(!hd2)
101 return CURLHE_BADINDEX;
103 hd2 = curl_easy_nextheader(NULL, CURLH_HEADER, -1, hd1);
104 if(hd2) /* should not work */
105 return CURLHE_BADINDEX;
107 return CURLHE_OK;
108}
110static CURLcode test_lib1940(const char *URL)
111{
112 CURL *curl = NULL;
113 CURLcode result = CURLE_OK;
115 int header_request;
116 if(testnum == 1946) {
117 header_request = 0;
118 }
119 else {
120 header_request = -1;
121 }
123 global_init(CURL_GLOBAL_ALL);
124 easy_init(curl);
125 easy_setopt(curl, CURLOPT_URL, URL);
126 easy_setopt(curl, CURLOPT_VERBOSE, 1L);
127 easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
128 /* ignores any content */
129 easy_setopt(curl, CURLOPT_WRITEFUNCTION, tutil_throwaway_cb);
131 /* if there is a proxy set, use it */
132 if(libtest_arg2 && *libtest_arg2) {
133 easy_setopt(curl, CURLOPT_PROXY, libtest_arg2);
134 easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
135 }
136 result = curl_easy_perform(curl);
137 if(result)
138 goto test_cleanup;
140 t1940_showem(curl, header_request, CURLH_HEADER);
141 if(libtest_arg2 && *libtest_arg2) {
142 /* now show connect headers only */
143 t1940_showem(curl, header_request, CURLH_CONNECT);
144 }
145 t1940_showem(curl, header_request, CURLH_1XX);
146 t1940_showem(curl, header_request, CURLH_TRAILER);
148 result = (CURLcode)t1940_negative(curl, header_request);
150test_cleanup:
151 curl_easy_cleanup(curl);
152 curl_global_cleanup();
153 return result;
154}
Diagnostics4 git calls · 25 ms
CallStatusSizeTime025 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=1 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 · hit2 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=2 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=20 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=86Open pack map
fetch2001.6 KiB · hit20 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1659 git.response.cache=HIT git.response.duration_ms=20 git.fetch.wants=400d044f3af6a8ec7d07a711c97498aa47095010 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=1659 git.pkt.payload.max=1638 git.sideband.band1.bytes=1637 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
- a5e32970aaf84628
- Request
- 7d037488…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format