Artifactspublic-v0

curl

master
ply4 git calls40 ms292 KiB3 cachedprotocol v2
625 lines23 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.
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.
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
21# SPDX-License-Identifier: curl
23###########################################################################
25import os
26import subprocess
27import time
29import pytest
30from testenv import CurlClient, Env
32MARK_NEEDS_HTTPS_PROXY = pytest.mark.skipif(
33 condition=not Env.curl_has_feature("HTTPS-proxy"),
34 reason="curl lacks HTTPS-proxy support"
36MARK_NEEDS_HTTP3 = pytest.mark.skipif(
37 condition=not Env.curl_has_feature("HTTP3"), reason="curl lacks HTTP/3 support"
39MARK_NEEDS_PROXY_HTTP3 = pytest.mark.skipif(
40 condition=not Env.curl_has_feature("proxy-HTTP3"),
41 reason="curl lacks experimental HTTP/3 proxy support"
43MARK_NEEDS_NGHTTP3 = pytest.mark.skipif(
44 condition=not Env.curl_uses_lib("nghttp3"), reason="only supported with nghttp3"
46MARK_NEEDS_NGHTTP2 = pytest.mark.skipif(
47 condition=not Env.curl_uses_lib("nghttp2"), reason="only supported with nghttp2"
49MARK_NEEDS_H2O = pytest.mark.skipif(
50 condition=not Env.have_h2o(), reason="no h2o available"
52MARK_NEEDS_NGHTTPX = pytest.mark.skipif(
53 condition=not Env.have_nghttpx(), reason="no nghttpx available"
56UNSUPPORTED_OPT_MSG = "does not support this"
57H2O_HELLO_MSG = '"message": "Hello from h2o HTTP/3 server"'
60def _require_available(**items):
61 missing = [name for name, value in items.items() if not value]
62 if missing:
63 pytest.skip(f"{' or '.join(missing)} not available")
66def _download_path(curl: CurlClient) -> str:
67 return os.path.join(curl.run_dir, "download_#1.data")
70def _check_download_message(curl: CurlClient, expected: str):
71 dpath = _download_path(curl)
72 assert os.path.exists(dpath), f"Download file not found: {dpath}"
73 with open(dpath, "r") as fd:
74 content = fd.read()
75 assert expected in content, f"Unexpected response content: {content}"
78def _check_download_size(curl: CurlClient, expected_size: int):
79 dpath = _download_path(curl)
80 assert os.path.exists(dpath), f"Download file not found: {dpath}"
81 actual = os.path.getsize(dpath)
82 assert actual == expected_size, f"expected {expected_size}B download, got {actual}B"
85def _nghttpx_proxy_args(
86 env: Env,
87 nghttpx,
88 nghttpx_fwd,
89 proxy_proto: str,
90 tunnel: bool,
91):
92 port = env.pts_port(proxy_proto)
93 domain = env.proxy_domain
94 xxarg = None
95 if proxy_proto == "h3":
96 port = nghttpx.port
97 domain = env.domain1
98 xxarg = "--proxy-http3"
99 elif proxy_proto == "h2":
100 xxarg = "--proxy-http2"
102 xargs = [
103 "--proxy", f"https://{domain}:{port}/",
104 "--resolve", f"{domain}:{port}:127.0.0.1",
105 "--proxy-cacert", env.ca.cert_file
106 ]
107 if xxarg:
108 xargs.append(xxarg)
109 if tunnel:
110 xargs.append("--proxytunnel")
111 return xargs
114def _h2o_proxy_args(
115 env: Env,
116 h2o_proxy,
117 proxy_proto: str,
118 tunnel: bool,
119):
120 pport = env.pts_port(proxy_proto, use_h2o=True)
121 xargs = [
122 "--proxy", f"https://{env.proxy_domain}:{pport}/",
123 "--resolve", f"{env.proxy_domain}:{pport}:127.0.0.1",
124 "--proxy-cacert", env.ca.cert_file,
125 "--cacert", env.ca.cert_file,
126 ]
127 if proxy_proto == "h2":
128 xargs.append("--proxy-http2")
129 elif proxy_proto == "h3":
130 xargs.append("--proxy-http3")
132 if tunnel:
133 xargs.append("--proxytunnel")
135 return xargs
138@MARK_NEEDS_HTTPS_PROXY
139@MARK_NEEDS_HTTP3
140@MARK_NEEDS_NGHTTP3
141class TestH3Proxy:
143 # Success matrix for HTTP/3 proxy CONNECT / CONNECT-UDP.
145 @MARK_NEEDS_PROXY_HTTP3
146 @MARK_NEEDS_H2O
147 @pytest.mark.parametrize(
148 ["alpn_proto", "proxy_proto"],
149 [
150 pytest.param("http/1.1", "h3", id="h1_over_h3_proxytunnel"),
151 pytest.param(
152 "h2",
153 "h3",
154 marks=MARK_NEEDS_NGHTTP2,
155 id="h2_over_h3_proxytunnel",
156 ),
157 pytest.param("h3", "h3", id="h3_over_h3_proxytunnel"),
158 pytest.param(
159 "h3",
160 "h2",
161 marks=MARK_NEEDS_NGHTTP2,
162 id="h3_over_h2_proxytunnel",
163 ),
164 pytest.param("h3", "http/1.1", id="h3_over_h1_proxytunnel"),
165 ],
166 )
167 def test_60_01_connect_tunnel(
168 self,
169 env: Env,
170 h2o_server,
171 h2o_proxy,
172 alpn_proto,
173 proxy_proto,
174 ):
175 _require_available(h2o_server=h2o_server, h2o_proxy=h2o_proxy)
177 curl = CurlClient(env=env)
178 url = f"https://localhost:{h2o_server.port}/data.json"
179 proxy_args = _h2o_proxy_args(
180 env, h2o_proxy, proxy_proto, tunnel=True
181 )
183 r = curl.http_download(
184 urls=[url], alpn_proto=alpn_proto, with_stats=True, extra_args=proxy_args
185 )
186 r.check_response(count=1, http_status=200)
187 _check_download_message(curl, H2O_HELLO_MSG)
189 # Failure matrix when proxy side does not support requested mode.
191 @MARK_NEEDS_PROXY_HTTP3
192 @MARK_NEEDS_NGHTTPX
193 @pytest.mark.parametrize(
194 ["alpn_proto", "proxy_proto", "exp_err"],
195 [
196 pytest.param(
197 "http/1.1",
198 "h3",
199 "could not connect to server",
200 id="fail_h1_over_h3_proxytunnel",
201 ),
202 pytest.param(
203 "h2",
204 "h3",
205 "could not connect to server",
206 marks=MARK_NEEDS_NGHTTP2,
207 id="fail_h2_over_h3_proxytunnel",
208 ),
209 pytest.param(
210 "h3",
211 "h3",
212 "could not connect to server",
213 id="fail_h3_over_h3_proxytunnel",
214 ),
215 #pytest.param(
216 # "h3",
217 # "h2",
218 # "proxy closed connection",
219 # marks=MARK_NEEDS_NGHTTP2,
220 # id="fail_h3_over_h2_proxytunnel",
221 #),
222 pytest.param(
223 "h3",
224 "http/1.1",
225 "connect-udp tunnel failed",
226 id="fail_h3_over_h1_proxytunnel",
227 ),
228 ],
229 )
230 def test_60_02_connect_tunnel_fail(
231 self,
232 env: Env,
233 httpd,
234 nghttpx,
235 nghttpx_fwd,
236 h2o_proxy,
237 alpn_proto,
238 proxy_proto,
239 exp_err,
240 ):
241 _require_available(httpd=httpd, nghttpx=nghttpx, nghttpx_fwd=nghttpx_fwd,
242 h2o_proxy=h2o_proxy)
244 curl = CurlClient(env=env)
245 url = f"https://localhost:{env.https_port}/data.json"
246 proxy_args = _nghttpx_proxy_args(
247 env, nghttpx, nghttpx_fwd, proxy_proto, tunnel=True
248 )
249 r = curl.http_download(
250 urls=[url], alpn_proto=alpn_proto, with_stats=True, extra_args=proxy_args
251 )
252 assert r.exit_code != 0, f"Expected failure but curl succeeded: {r.dump_logs()}"
253 assert exp_err in r.stderr.lower(), (
254 f"Expected protocol/proxy error but got: {r.dump_logs()}"
255 )
257 # Behavior checks for tunnel vs non-tunnel proxy mode selection.
259 @MARK_NEEDS_PROXY_HTTP3
260 @MARK_NEEDS_NGHTTPX
261 @pytest.mark.parametrize(
262 ["proxy_proto"],
263 [
264 #pytest.param("h3", id="proxy_h3"),
265 pytest.param("h2", marks=MARK_NEEDS_NGHTTP2, id="proxy_h2"),
266 pytest.param("http/1.1", id="proxy_h1"),
267 ],
268 )
269 def test_60_03_h3_target_auto_connect_udp(
270 self, env: Env, httpd, nghttpx, nghttpx_fwd, proxy_proto
271 ):
272 _require_available(
273 httpd=httpd, nghttpx=nghttpx, nghttpx_fwd=nghttpx_fwd
274 )
276 curl = CurlClient(env=env)
277 url = f"https://localhost:{httpd.ports['https']}/data.json"
278 proxy_args = _nghttpx_proxy_args(
279 env, nghttpx, nghttpx_fwd, proxy_proto, tunnel=False
280 )
281 r = curl.http_download(
282 urls=[url], alpn_proto="h3", with_stats=True, extra_args=proxy_args
283 )
285 # An HTTP/3 target auto-triggers CONNECT-UDP even without --proxytunnel,
286 # as HTTPS targets auto-trigger CONNECT. nghttpx does not support
287 # CONNECT-UDP so this fails, which confirms auto-CONNECT-UDP is active.
288 assert r.exit_code != 0, (
289 "expected failure: h3 target auto-triggers CONNECT-UDP "
290 "which nghttpx does not support"
291 )
292 assert "connect-udp" in r.stderr.lower(), (
293 f"expected CONNECT-UDP attempt in output, got: {r.dump_logs()}"
294 )
296 # Guard checks for unsupported HTTP/3 proxy options.
298 @pytest.mark.skipif(
299 condition=Env.curl_has_feature("proxy-HTTP3"), reason="curl has h3 proxy support"
300 )
301 def test_60_04_guard_proxy_http3_unsupported(self, env: Env, httpd):
302 curl = CurlClient(env=env)
303 url = f"https://localhost:{httpd.ports['https']}/data.json"
304 proxy_args = [
305 "--proxy",
306 "https://127.0.0.1:1/",
307 "--proxy-http3",
308 "--proxytunnel",
309 "--cacert",
310 env.ca.cert_file,
311 ]
313 r = curl.http_download(
314 urls=[url], alpn_proto="http/1.1", with_stats=True, extra_args=proxy_args
315 )
316 r.check_exit_code(2)
317 assert UNSUPPORTED_OPT_MSG in r.stderr.lower(), (
318 f"Expected unsupported option failure but got: {r.stderr}"
319 )
321 # Robustness checks for shutdown and proxy loss during transfer.
323 @MARK_NEEDS_PROXY_HTTP3
324 @MARK_NEEDS_H2O
325 def test_60_05_graceful_shutdown(self, env: Env, h2o_server, h2o_proxy):
326 if not env.curl_is_debug():
327 pytest.skip("needs debug curl for shutdown trace lines")
328 if not env.curl_is_verbose():
329 pytest.skip("needs verbose-strings curl build")
331 curl = CurlClient(env=env, run_env={"CURL_DEBUG": "all"})
332 url = f"https://localhost:{h2o_server.port}/data.json"
333 proxy_args = curl.get_proxy_args(proto="h3", tunnel=True)
334 proxy_args.extend(["--cacert", env.ca.cert_file, "--insecure", '--parallel'])
336 r = curl.http_download(
337 urls=[url], alpn_proto="h3", with_stats=True, extra_args=proxy_args
338 )
339 r.check_response(count=1, http_status=200)
341 shutdown_lines = [
342 line
343 for line in r.trace_lines
344 if ("start shutdown(" in line.lower())
345 or ("shutdown completely sent off" in line.lower())
346 ]
347 assert shutdown_lines, f"No shutdown trace lines found:\n{r.stderr}"
349 @MARK_NEEDS_PROXY_HTTP3
350 @MARK_NEEDS_H2O
351 def test_60_06_proxy_drop_mid_transfer(self, env: Env, h2o_server, h2o_proxy):
352 _require_available(h2o_server=h2o_server, h2o_proxy=h2o_proxy)
354 env.make_data_file(indir=h2o_server.docs_dir, fname="proxy-drop-20m", fsize=20 * 1024 * 1024)
355 proxy_port = h2o_proxy.port
356 url = f"https://localhost:{h2o_server.port}/proxy-drop-20m"
357 out_path = os.path.join(env.gen_dir, "proxy-drop.out")
358 if os.path.exists(out_path):
359 os.remove(out_path)
360 args = [
361 env.curl,
362 "--http1.1",
363 "--proxy", f"https://{env.proxy_domain}:{proxy_port}/",
364 "--resolve", f"{env.proxy_domain}:{proxy_port}:127.0.0.1",
365 "--proxy-http3",
366 "--proxytunnel",
367 "--proxy-cacert", env.ca.cert_file,
368 "--cacert", env.ca.cert_file,
369 "--limit-rate", "10k",
370 "--max-time", "20",
371 "-o", out_path,
372 "-v",
373 url,
374 ]
376 proc = None
377 try:
378 proc = subprocess.Popen(
379 args=args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
380 )
381 while not os.path.exists(out_path):
382 time.sleep(0.1)
383 assert h2o_proxy.kill(), "failed to stop h2o proxy"
384 _, stderr = proc.communicate(timeout=30)
385 assert proc.returncode != 0, (
386 "curl should fail when proxy is terminated mid-transfer"
387 )
388 assert proc.returncode == 56, f'{stderr}'
389 finally:
390 if proc and (proc.poll() is None):
391 proc.kill()
392 proc.wait(timeout=5)
393 assert h2o_proxy.start(), "failed to restart h2o proxy"
395 # Large file transfers and multiplexing through HTTP/3 proxy.
397 @MARK_NEEDS_PROXY_HTTP3
398 @MARK_NEEDS_H2O
399 def test_60_07_large_download(self, env: Env, h2o_server, h2o_proxy):
400 _require_available(h2o_server=h2o_server, h2o_proxy=h2o_proxy)
401 env.make_data_file(indir=h2o_server.docs_dir, fname="download-10m", fsize=10 * 1024 * 1024)
402 curl = CurlClient(env=env)
403 url = f"https://localhost:{h2o_server.port}/download-10m"
404 proxy_args = _h2o_proxy_args(env, h2o_proxy, "h3", tunnel=True)
405 r = curl.http_download(
406 urls=[url], alpn_proto="http/1.1", with_stats=True, extra_args=proxy_args
407 )
408 r.check_response(count=1, http_status=200)
409 _check_download_size(curl, 10 * 1024 * 1024)
411 @MARK_NEEDS_PROXY_HTTP3
412 @MARK_NEEDS_H2O
413 def test_60_08_large_upload(self, env: Env, httpd, h2o_server, h2o_proxy):
414 _require_available(h2o_proxy=h2o_proxy)
415 env.make_data_file(indir=env.gen_dir, fname="upload-2m", fsize=2 * 1024 * 1024)
416 fdata = os.path.join(env.gen_dir, "upload-2m")
417 curl = CurlClient(env=env)
418 url = f"https://localhost:{httpd.ports['https']}/curltest/echo?id=[0-0]"
419 proxy_args = _h2o_proxy_args(env, h2o_proxy, "h3", tunnel=True)
420 r = curl.http_upload(
421 urls=[url],
422 data=f"@{fdata}",
423 alpn_proto="http/1.1",
424 with_stats=True,
425 extra_args=proxy_args,
426 )
427 r.check_response(count=1, http_status=200)
429 @MARK_NEEDS_PROXY_HTTP3
430 @MARK_NEEDS_H2O
431 @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2")
432 def test_60_09_parallel_downloads(self, env: Env, h2o_server, h2o_proxy):
433 _require_available(h2o_server=h2o_server, h2o_proxy=h2o_proxy)
434 env.make_data_file(indir=h2o_server.docs_dir, fname="download-1m", fsize=1 * 1024 * 1024)
435 count = 5
436 curl = CurlClient(env=env)
437 urln = f"https://localhost:{h2o_server.port}/download-1m?[0-{count - 1}]"
438 proxy_args = _h2o_proxy_args(env, h2o_proxy, "h3", tunnel=True)
439 proxy_args.extend(["--parallel", "--parallel-max", f"{count}"])
440 r = curl.http_download(
441 urls=[urln], alpn_proto="h2", with_stats=True, extra_args=proxy_args
442 )
443 r.check_response(count=count, http_status=200)
445 @MARK_NEEDS_PROXY_HTTP3
446 @MARK_NEEDS_H2O
447 def test_60_10_proxy_basic_auth(self, env: Env, h2o_server, h2o_proxy):
448 _require_available(h2o_server=h2o_server, h2o_proxy=h2o_proxy)
449 curl = CurlClient(env=env)
450 url = f"https://localhost:{h2o_server.port}/data.json"
451 proxy_args = _h2o_proxy_args(env, h2o_proxy, "h3", tunnel=True)
452 proxy_args.extend(["--proxy-user", "testuser:testpass"])
453 r = curl.http_download(
454 urls=[url], alpn_proto="http/1.1", with_stats=True, extra_args=proxy_args
455 )
456 r.check_response(count=1, http_status=200)
457 _check_download_message(curl, H2O_HELLO_MSG)
459 @MARK_NEEDS_PROXY_HTTP3
460 @MARK_NEEDS_H2O
461 def test_60_11_connection_reuse(self, env: Env, h2o_server, h2o_proxy):
462 _require_available(h2o_server=h2o_server, h2o_proxy=h2o_proxy)
463 curl = CurlClient(env=env)
464 urln = f"https://localhost:{h2o_server.port}/data.json?[0-2]"
465 proxy_args = _h2o_proxy_args(env, h2o_proxy, "h3", tunnel=True)
466 r = curl.http_download(
467 urls=[urln], alpn_proto="http/1.1", with_stats=True, extra_args=proxy_args
468 )
469 r.check_response(count=3, http_status=200)
470 assert r.total_connects <= 3, (
471 f"expected proxy connection reuse, got {r.total_connects} connects"
472 )
474 @MARK_NEEDS_PROXY_HTTP3
475 @MARK_NEEDS_H2O
476 @pytest.mark.skipif(condition=not Env.curl_has_feature('SSLS-EXPORT'),
477 reason='curl lacks SSL session export support')
478 def test_60_12_quic_session_resumption(self, env: Env, h2o_server, h2o_proxy):
479 _require_available(h2o_server=h2o_server, h2o_proxy=h2o_proxy)
480 curl = CurlClient(env=env)
481 url = f"https://localhost:{h2o_server.port}/data.json"
482 xargs = _h2o_proxy_args(env, h2o_proxy, "h3", tunnel=True)
483 session_file = os.path.join(env.gen_dir, 'test_60_12.sessions')
484 if os.path.exists(session_file):
485 os.remove(session_file)
486 xargs.extend(['--ssl-sessions', session_file])
487 # First request establishes QUIC session
488 r1 = curl.http_download(
489 urls=[url], alpn_proto="http/1.1", with_stats=True, extra_args=xargs
490 )
491 r1.check_response(count=1, http_status=200)
492 xargs.extend(['--trace-config', 'ssls'])
493 r2 = curl.http_download(
494 urls=[url], alpn_proto="http/1.1", with_stats=True, extra_args=xargs
495 )
496 r2.check_response(count=1, http_status=200)
497 reuses = [line for line in r2.trace_lines if '[SSLS] took session for https:proxy.http.curl.se' in line]
498 assert len(reuses), f'{r2.dump_logs()}'
500 # CONNECT-UDP tunnel payload size and capsule-protocol tests.
502 @MARK_NEEDS_PROXY_HTTP3
503 @MARK_NEEDS_H2O
504 @pytest.mark.parametrize(
505 "fname,fsize",
506 [
507 ("download-1400", 1400),
508 ("download-1m", 1 * 1024 * 1024),
509 ("download-10m", 10 * 1024 * 1024),
510 ],
511 )
512 def test_60_13_udp_tunnel_payload_sizes(
513 self, env: Env, h2o_server, h2o_proxy, fname, fsize
514 ):
515 _require_available(h2o_server=h2o_server, h2o_proxy=h2o_proxy)
516 env.make_data_file(indir=h2o_server.docs_dir, fname=fname, fsize=fsize)
517 curl = CurlClient(env=env)
518 url = f"https://localhost:{h2o_server.port}/{fname}"
519 proxy_args = _h2o_proxy_args(env, h2o_proxy, "h3", tunnel=True)
520 r = curl.http_download(
521 urls=[url], alpn_proto="h3", with_stats=True, extra_args=proxy_args
522 )
523 r.check_response(count=1, http_status=200)
524 _check_download_size(curl, fsize)
526 @MARK_NEEDS_PROXY_HTTP3
527 @MARK_NEEDS_NGHTTPX
528 def test_60_14_udp_tunnel_capsule_absent(
529 self, env: Env, httpd, nghttpx, nghttpx_fwd
530 ):
531 _require_available(
532 httpd=httpd, nghttpx=nghttpx, nghttpx_fwd=nghttpx_fwd
533 )
534 curl = CurlClient(env=env)
535 url = f"https://localhost:{httpd.ports['https']}/data.json"
536 proxy_args = _nghttpx_proxy_args(
537 env, nghttpx, nghttpx_fwd, "h3", tunnel=True
538 )
539 r = curl.http_download(
540 urls=[url], alpn_proto="h3", with_stats=True, extra_args=proxy_args
541 )
542 assert r.exit_code != 0, (
543 "expected failure: nghttpx does not support CONNECT-UDP / Capsule-Protocol"
544 )
546 # Timeout and protocol-mismatch edge cases.
548 #@MARK_NEEDS_PROXY_HTTP3
549 #@MARK_NEEDS_H2O
550 #def test_60_15_connect_timeout(self, env: Env, h2o_proxy):
551 # _require_available(h2o_proxy=h2o_proxy)
552 # curl = CurlClient(env=env, timeout=15)
553 # url = f"https://localhost:{h2o_proxy.port}/data.json"
554 # # IPv6 0100::/64 is supposed to go into the void (rfc6666)
555 # xargs = [
556 # '--proxy', 'https://xxx.invalid/',
557 # '--resolve', 'xxx.invalid:443:0100::1,0100::2,0100::3',
558 # '--proxy-http3', '--proxytunnel',
559 # '--connect-timeout', '1',
560 # ]
561 # r = curl.http_download(
562 # urls=[url], alpn_proto="http/1.1", with_stats=True, extra_args=xargs
563 # )
564 # r.check_exit_code(28) # CURLE_OPERATION_TIMEDOUT
565 # assert r.duration.total_seconds() < 10, (
566 # f"timeout not respected: took {r.duration.total_seconds():.1f}s"
567 # )
569 @MARK_NEEDS_PROXY_HTTP3
570 @MARK_NEEDS_H2O
571 @MARK_NEEDS_NGHTTP2
572 def test_60_16_h2_uses_connect_tcp_not_udp(self, env: Env, httpd, h2o_proxy):
573 _require_available(httpd=httpd, h2o_proxy=h2o_proxy)
574 curl = CurlClient(env=env)
575 url = f"https://localhost:{env.https_port}/data.json"
576 proxy_args = curl.get_proxy_args("h3", tunnel=True)
577 # h2 inner traffic always uses CONNECT (TCP), never CONNECT-UDP,
578 # even through an HTTP/3 proxy with --proxytunnel. h2o supports
579 # CONNECT TCP tunneling, so this request succeeds.
580 r = curl.http_download(
581 urls=[url], alpn_proto="h2", with_stats=True, extra_args=proxy_args
582 )
583 r.check_response(count=1, http_status=200)
585 # Verify that happy eyeballs is active for HTTP/3 proxy connections.
586 #
587 # With the H3-PROXY filter sitting above HAPPY-EYEBALLS -> UDP, address
588 # family selection to the proxy is done by happy eyeballs.
590 @MARK_NEEDS_PROXY_HTTP3
591 @MARK_NEEDS_H2O
592 def test_60_17_happy_eyeballs_filter_present(self, env: Env, h2o_server, h2o_proxy):
593 """Verbose trace confirms HAPPY-EYEBALLS filter is in the H3 proxy chain."""
594 if not env.curl_is_debug():
595 pytest.skip("needs debug curl for filter trace")
596 _require_available(h2o_server=h2o_server, h2o_proxy=h2o_proxy)
597 curl = CurlClient(env=env, run_env={"CURL_DEBUG": "HAPPY-EYEBALLS,H3-PROXY"})
598 url = f"https://localhost:{h2o_server.port}/data.json"
599 proxy_args = _h2o_proxy_args(env, h2o_proxy, "h3", tunnel=True)
600 r = curl.http_download(
601 urls=[url], alpn_proto="http/1.1", with_stats=True, extra_args=proxy_args
602 )
603 r.check_response(count=1, http_status=200)
604 assert "happy-eyeballs" in r.stderr.lower(), (
605 f"expected HAPPY-EYEBALLS trace for H3 proxy, got: {r.stderr}"
606 )
608 @MARK_NEEDS_PROXY_HTTP3
609 @MARK_NEEDS_H2O
610 @MARK_NEEDS_NGHTTP2
611 def test_60_18_happy_eyeballs_ipv4_all_proto(self, env: Env, h2o_server, h2o_proxy):
612 """IPv4-forced H3 proxy works for h1/h2/h3 inner protocols."""
613 _require_available(h2o_server=h2o_server, h2o_proxy=h2o_proxy)
614 for alpn_proto in ["http/1.1", "h2", "h3"]:
615 curl = CurlClient(env=env)
616 url = f"https://localhost:{h2o_server.port}/data.json"
617 proxy_args = _h2o_proxy_args(env, h2o_proxy, "h3", tunnel=True)
618 proxy_args.append("--ipv4")
619 r = curl.http_download(
620 urls=[url],
621 alpn_proto=alpn_proto,
622 with_stats=True,
623 extra_args=proxy_args,
624 )
625 r.check_response(count=1, http_status=200)
Diagnostics4 git calls · 40 ms
CallStatusSizeTime040 ms
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
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=2
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
fetch2005.6 KiB · hit35 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=35
git.response.bytes=5688
git.response.cache=HIT
git.response.duration_ms=35
git.fetch.wants=30a210ee71b14feb279bbfe473c9f4d109503846
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=5688
git.pkt.payload.max=5667
git.sideband.band1.bytes=5666
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
a5e2d9df6eb214c2
Request
b99f880c…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format