From: Stefan Eissing Date: Fri, 1 Aug 2025 09:01:55 +0000 (+0200) Subject: pytest: test very long urls X-Git-Tag: curl-8_16_0~292 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7f5ad2028dab7e31c560283289b455f5d1c9a80d;p=thirdparty%2Fcurl.git pytest: test very long urls test_02_36 tests h1/h2/h3 with urls longer than 1/16/32/64K. Protocols behave the same until the size exceed 64k when h2 frame limits bite and h3 exhibits a different http status. Failed attempt to reproduce #18121 Closes #18129 --- diff --git a/lib/vquic/curl_quiche.c b/lib/vquic/curl_quiche.c index e6f1d196e7..9bb72511e9 100644 --- a/lib/vquic/curl_quiche.c +++ b/lib/vquic/curl_quiche.c @@ -1024,6 +1024,7 @@ static CURLcode h3_open_stream(struct Curl_cfilter *cf, stream3_id = quiche_h3_send_request(ctx->h3c, ctx->qconn, nva, nheader, stream->send_closed); + CURL_TRC_CF(data, cf, "quiche_send_request() -> %" FMT_PRIu64, stream3_id); if(stream3_id < 0) { if(QUICHE_H3_ERR_STREAM_BLOCKED == stream3_id) { /* quiche seems to report this error if the connection window is diff --git a/tests/http/test_02_download.py b/tests/http/test_02_download.py index f9b33b4098..462e7645df 100644 --- a/tests/http/test_02_download.py +++ b/tests/http/test_02_download.py @@ -751,3 +751,39 @@ class TestDownload: '-P', f'{pause_offset}', '-V', proto, url ]) r.check_exit_code(0) + + # download with looong urls + @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("url_junk", [1024, 16*1024, 32*1024, 64*1024]) + def test_02_36_looong_urls(self, env: Env, httpd, nghttpx, proto, url_junk): + if proto == 'h3' and not env.have_h3(): + pytest.skip("h3 not supported") + if proto == 'h3' and env.curl_uses_lib('quiche'): + pytest.skip("quiche fails from 16k onwards") + curl = CurlClient(env=env) + # url is longer than 'url_len' + url = f'https://{env.authority_for(env.domain1, proto)}/data.json?{"x"*(url_junk)}' + r = curl.http_download(urls=[url], alpn_proto=proto) + if url_junk <= 1024: + r.check_exit_code(0) + r.check_response(http_status=200) + elif url_junk <= 16*1024: + r.check_exit_code(0) + # server replies with 414, Request URL too long + r.check_response(http_status=414) + elif url_junk <= 32*1024: + r.check_exit_code(0) + # server replies with 414, Request URL too long + r.check_response(http_status=414) + else: + # with urls larger than 64k, behaviour differs + if proto == 'http/1.1': + r.check_exit_code(0) + r.check_response(http_status=414) + elif proto == 'h2': + # h2 is unable to send such large headers (frame limits) + r.check_exit_code(55) + elif proto == 'h3': + r.check_exit_code(0) + # nghttpx reports 431 Request Header Field too Large + r.check_response(http_status=431)