]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
pytest: test very long urls
authorStefan Eissing <stefan@eissing.org>
Fri, 1 Aug 2025 09:01:55 +0000 (11:01 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 1 Aug 2025 12:35:37 +0000 (14:35 +0200)
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

lib/vquic/curl_quiche.c
tests/http/test_02_download.py

index e6f1d196e7ce83496f2a250ef82a9f5f41d4808e..9bb72511e98238b48480c64b0b9b6543b8d55e84 100644 (file)
@@ -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
index f9b33b40988a3834a278be005d81cf28b2b548bd..462e7645dfa1f2d96851114df5f022ad6b0723a6 100644 (file)
@@ -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)