curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

HTTP/2 deferring DATA frame to another TCP packet

From: Pontakorn Prasertsuk via curl-library <curl-library_at_lists.haxx.se>
Date: Wed, 21 Jun 2023 14:04:00 +0800

Hi,

I am currently testing HTTP/2 connection to my local server using Curl i.e.
running:

SSLKEYLOGFILE=/tmp/sslkeylog.log src/curl --location "https://localhost:8000"
--insecure --http2 --data "1234567890" -H "Content-type: text/plain" -v

The packets sent are as shown belows:[image: curl_http2_post_request.png]
The DATA frame is on a different packet from the HEADER frame.

However, sending HEADER and DATA frames together should be possible. Belows
are the packets sent using my own HTTP/2 client:

[image: custom_http2_post_request.png]

I have looked into libcurl `http2.c` and it seems that curl performs
`nghttp2_submit_request` to send headers with callback deferring the DATA
frame. The DATA frame then is sent on a second call to `cf_h2_send`,
causing the DATA frame to be on a different TCP packet from the HEADER
frame.

My questions are:
1. What are the ideas behind this design? Is this design deliberate? If so,
are there any ways I can send HTTP/2 requests with HEADER and DATA frames
in the same packet? We want to do so to achieve higher throughput while
still using libcurl.
2. Otherwise, what modification should be required for libcurl to support
such operation?

Regards,
Pontakorn


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

curl_http2_post_request.png
(image/png attachment: curl_http2_post_request.png)

custom_http2_post_request.png
(image/png attachment: custom_http2_post_request.png)

Received on 2023-06-21