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 "unitcheck.h"
25#include "proxy.h"
27static CURLcode test_unit1614(const char *arg)
28{
29 UNITTEST_BEGIN_SIMPLE
31#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_PROXY)
32 int i;
33 int err = 0;
35 struct check {
36 const char *a;
37 const char *n;
38 int bits;
39 bool match;
40 };
41 struct check list4[] = {
42 { "192.160.0.1", "192.160.0.1", 33, FALSE },
43 { "192.160.0.1", "192.160.0.1", 32, TRUE },
44 { "192.160.0.1", "192.160.0.1", 0, TRUE },
45 { "192.160.0.1", "192.160.0.1", 24, TRUE },
46 { "192.160.0.1", "192.160.0.1", 26, TRUE },
47 { "192.160.0.1", "192.160.0.1", 20, TRUE },
48 { "192.160.0.1", "192.160.0.1", 18, TRUE },
49 { "192.160.0.1", "192.160.0.1", 12, TRUE },
50 { "192.160.0.1", "192.160.0.1", 8, TRUE },
51 { "192.160.0.1", "10.0.0.1", 8, FALSE },
52 { "192.160.0.1", "10.0.0.1", 32, FALSE },
53 { "192.160.0.1", "10.0.0.1", 0, FALSE },
54 { "192.160.0.1", "0.0.0.0", 0, TRUE },
55 { "0.0.0.1", "0.0.0.0", 0, TRUE },
56 { "127.0.0.1", "0.0.0.0", 0, TRUE },
57 { "0.0.0.1", "0.0.0.0", -1, FALSE },
58 { "127.0.0.1", "0.0.0.0", -1, FALSE },
59 { NULL, NULL, 0, FALSE } /* end marker */
60 };
61#ifdef USE_IPV6
62 struct check list6[] = {
63 { "::1", "::1", 0, TRUE },
64 { "::1", "::1", 128, TRUE },
65 { "::1", "0:0::1", 128, TRUE },
66 { "::1", "0:0::1", 129, FALSE },
67 { "fe80::ab47:4396:55c9:8474", "fe80::ab47:4396:55c9:8474", 64, TRUE },
68 { "fe80::ab47:4396:55c9:8474", "::", 0, TRUE },
69 { "::1", "::", 0, TRUE },
70 { "::1", "::", -1, FALSE },
71 { NULL, NULL, 0, FALSE } /* end marker */
72 };
73#endif
74 struct noproxy {
75 const char *a;
76 const char *n;
77 bool match;
78 };
79 struct noproxy list[] = {
80 { "www.example.com", "localhost .example.com .example.de", FALSE },
81 { "www.example.com", "localhost,.example.com,.example.de", TRUE },
82 { "www.example.com.", "localhost,.example.com,.example.de", TRUE },
83 { "example.com", "localhost,.example.com,.example.de", TRUE },
84 { "example.com.", "localhost,.example.com,.example.de", TRUE },
85 { "www.example.com", "localhost,.example.com.,.example.de", TRUE },
86 { "www.example.com", "localhost,www.example.com.,.example.de", TRUE },
87 { "example.com", "localhost,example.com,.example.de", TRUE },
88 { "example.com.", "localhost,example.com,.example.de", TRUE },
89 { "nexample.com", "localhost,example.com,.example.de", FALSE },
90 { "www.example.com", "localhost,example.com,.example.de", TRUE },
91 { "127.0.0.1", "127.0.0.1,localhost", TRUE },
92 { "127.0.0.1", "127.0.0.1,localhost,", TRUE },
93 { "127.0.0.1", "127.0.0.1/8,localhost,", TRUE },
94 { "127.0.0.1", "127.0.0.1/28,localhost,", TRUE },
95 { "127.0.0.1", "127.0.0.1/31,localhost,", TRUE },
96 { "127.0.0.1", "localhost,127.0.0.1", TRUE },
97 { "127.0.0.1", "localhost,127.0.0.1.127.0.0.1.127.0.0.1.127.0.0.1."
98 "127.0.0.1.127.0.0.1.127.0.0.1.127.0.0.1.127.0.0.1.127.0.0.1.127."
99 "0.0.1.127.0.0.1.127.0.0." /* 128 bytes "address" */, FALSE },
100 { "127.0.0.1", "localhost,127.0.0.1.127.0.0.1.127.0.0.1.127.0.0.1."
101 "127.0.0.1.127.0.0.1.127.0.0.1.127.0.0.1.127.0.0.1.127.0.0.1.127."
102 "0.0.1.127.0.0.1.127.0.0" /* 127 bytes "address" */, FALSE },
103 { "localhost", "localhost,127.0.0.1", TRUE },
104 { "localhost", "127.0.0.1,localhost", TRUE },
105 { "foobar", "barfoo", FALSE },
106 { "foobar", "foobar", TRUE },
107 { "192.168.0.1", "foobar", FALSE },
108 { "192.168.0.1", "192.168.0.0/16", TRUE },
109 { "192.168.0.1", "192.168.0.0/16a", FALSE },
110 { "192.168.0.1", "192.168.0.0/16 ", TRUE },
111 { "192.168.0.1", "192.168.0.0/a16", FALSE },
112 { "192.168.0.1", "192.168.0.0/ 16", FALSE },
113 { "192.168.0.1", "192.168.0.0/24", TRUE },
114 { "192.168.0.1", "192.168.0.0/32", FALSE },
115 { "192.168.0.1", "192.168.0.1/32", TRUE },
116 { "192.168.0.1", "192.168.0.1/33", FALSE },
117 { "192.168.0.1", "192.168.0.0", FALSE },
118 { "192.168.1.1", "192.168.0.0/24", FALSE },
119 { "192.168.1.1", "192.168.0.0/33", FALSE },
120 { "192.168.1.1", "foo, bar, 192.168.0.0/24", FALSE },
121 { "192.168.1.1", "foo, bar, 192.168.0.0/16", TRUE },
122 { "192.168.1.1", "0.0.0.0/0", TRUE },
123 { "192.168.1.1", "0.0.0.0", FALSE },
124#ifdef USE_IPV6
125 { "::1", "::/0", TRUE },
126 { "::1", "::", FALSE },
127 { "::1", "::/128", FALSE },
128 { "::1", "foo, bar, 192.168.0.0/16", FALSE },
129 { "::1", "foo, bar, ::1/64", TRUE },
130 { "::1", "::1/64", TRUE },
131 { "::1", "::1/96", TRUE },
132 { "::1", "::1/129", FALSE },
133 { "::1", "::1/128", TRUE },
134 { "::1", "::1/127", TRUE },
135 { "::1", "::1/a127", FALSE },
136 { "::1", "::1/127a", FALSE },
137 { "::1", "::1/ 127", FALSE },
138 { "::1", "::1/127 ", TRUE },
139 { "::1", "::1/126", TRUE },
140 { "::1", "::1/125", TRUE },
141 { "::1", "::1/124", TRUE },
142 { "::1", "::1/123", TRUE },
143 { "::1", "::1/122", TRUE },
144 { "2001:db8:8000::1", "2001:db8::/65", FALSE },
145 { "2001:db8:8000::1", "2001:db8::/66", FALSE },
146 { "2001:db8:8000::1", "2001:db8::/67", FALSE },
147 { "2001:db8:8000::1", "2001:db8::/68", FALSE },
148 { "2001:db8:8000::1", "2001:db8::/69", FALSE },
149 { "2001:db8:8000::1", "2001:db8::/70", FALSE },
150 { "2001:db8:8000::1", "2001:db8::/71", FALSE },
151 { "2001:db8:8000::1", "2001:db8::/72", FALSE },
152 { "2001:db8::1", "2001:db8::/65", TRUE },
153 { "2001:db8::1", "2001:db8::/66", TRUE },
154 { "2001:db8::1", "2001:db8::/67", TRUE },
155 { "2001:db8::1", "2001:db8::/68", TRUE },
156 { "2001:db8::1", "2001:db8::/69", TRUE },
157 { "2001:db8::1", "2001:db8::/70", TRUE },
158 { "2001:db8::1", "2001:db8::/71", TRUE },
159 { "2001:db8::1", "2001:db8::/72", TRUE },
160 { "::1", "::1/129", FALSE },
161 { "bar", "foo, bar, ::1/64", TRUE },
162 { "BAr", "foo, bar, ::1/64", TRUE },
163 { "BAr", "foo,,,,, bar, ::1/64", TRUE },
164#endif
165 { "www.example.com", "foo, .example.com", TRUE },
166 { "www.example.com", "www2.example.com, .example.net", FALSE },
167 { "example.com", ".example.com, .example.net", TRUE },
168 { "nonexample.com", ".example.com, .example.net", FALSE },
169 { NULL, NULL, FALSE }
170 };
171 for(i = 0; list4[i].a; i++) {
172 bool match = cidr4_match(list4[i].a, list4[i].n, list4[i].bits);
173 if(match != list4[i].match) {
174 curl_mfprintf(stderr, "%s in %s/%d should %smatch\n",
175 list4[i].a, list4[i].n, list4[i].bits,
176 list4[i].match ? "" : "not ");
177 err++;
178 }
179 }
180#ifdef USE_IPV6
181 for(i = 0; list6[i].a; i++) {
182 bool match = cidr6_match(list6[i].a, list6[i].n, list6[i].bits);
183 if(match != list6[i].match) {
184 curl_mfprintf(stderr, "%s in %s/%d should %smatch\n",
185 list6[i].a, list6[i].n, list6[i].bits,
186 list6[i].match ? "" : "not ");
187 err++;
188 }
189 }
190#endif
191 for(i = 0; list[i].a; i++) {
192 bool match = proxy_check_noproxy(list[i].a, list[i].n);
193 if(match != list[i].match) {
194 curl_mfprintf(stderr, "%s in %s should %smatch\n",
195 list[i].a, list[i].n,
196 list[i].match ? "" : "not ");
197 err++;
198 }
199 }
200 fail_if(err, "errors");
201#endif
203 UNITTEST_END_SIMPLE
204}
Diagnostics4 git calls · 37 ms
CallStatusSizeTime037 ms
discover200152 B2 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 · 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=33 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.8 KiB · hit33 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1842 git.response.cache=HIT git.response.duration_ms=33 git.fetch.wants=656e0a94d035b6d17525842aa307526c2075ee51 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=1842 git.pkt.payload.max=1821 git.sideband.band1.bytes=1820 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
- a5e2eaa19e5f4bc2
- Request
- 60a52847…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format