> Am 21.06.2023 um 08:04 schrieb Pontakorn Prasertsuk via curl-library 
> <curl-library@lists.haxx.se>:
> 
> 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:<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:
> 
> <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?

Most POST request have a body. That is the reason for sending the HEADER frame 
without EOF and wait for the subsequent body send to end the request.

You seem to send POSTs without body. If curl can know it will be empty, it 
would be possible to optimize for this. What is the "Content-Length" header on 
your requests, if there is one?

Kind Regards,
Stefan

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

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

Reply via email to