]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ngtcp2: fix handling of large requests
authorStefan Eissing <stefan@eissing.org>
Thu, 7 Sep 2023 12:51:44 +0000 (14:51 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 7 Sep 2023 15:32:47 +0000 (17:32 +0200)
- requests >64K are send in parts to the filter
- fix parsing of the request to assemble it correctly
  from several sends
- open a QUIC stream only when the complete request has
  been collected

Closes #11815

lib/vquic/curl_ngtcp2.c

index ffdbb575c183ae81a255214101e899e4cf879fde..ddd0992a64e3c378c9f1915ac837c3212553992e 100644 (file)
@@ -1655,13 +1655,6 @@ static ssize_t h3_stream_open(struct Curl_cfilter *cf,
   stream = H3_STREAM_CTX(data);
   DEBUGASSERT(stream);
 
-  rc = ngtcp2_conn_open_bidi_stream(ctx->qconn, &stream->id, NULL);
-  if(rc) {
-    failf(data, "can get bidi streams");
-    *err = CURLE_SEND_ERROR;
-    goto out;
-  }
-
   nwritten = Curl_h1_req_parse_read(&stream->h1, buf, len, NULL, 0, err);
   if(nwritten < 0)
     goto out;
@@ -1696,6 +1689,13 @@ static ssize_t h3_stream_open(struct Curl_cfilter *cf,
     nva[i].flags = NGHTTP3_NV_FLAG_NONE;
   }
 
+  rc = ngtcp2_conn_open_bidi_stream(ctx->qconn, &stream->id, NULL);
+  if(rc) {
+    failf(data, "can get bidi streams");
+    *err = CURLE_SEND_ERROR;
+    goto out;
+  }
+
   switch(data->state.httpreq) {
   case HTTPREQ_POST:
   case HTTPREQ_POST_FORM: