#22984·curl

curl_easy_perform returns CURLE_SEND_ERROR even if the http/2 request was successful.

Author: paolonevisCreated Sep 17, 2026Updated Sep 17, 2026
LabelsHTTP/2not-a-curl-bug

I did this

start the server like that:

python3 h2-backend.py localhost 11074

and run then the compiled curltest_deterministic.c.

client: curltest_deterministic.c

server: h2-backend.py

I expected the following

I would have expected that this would work without problems, but I get this error:

bash
curl: [HTTP/2] [1] cf_send(len=0) -> 55, 0, eos=1, h2 windows -1-65502 (stream-conn), buffers 0-0 (stream-conn)
curl: Connection #0 to host localhost:11074 left intact
ERROR: curl_easy_perform() failed: Failed sending data to the peer
paolo@localhost:~/tmp$

The problem seems to be that curl is finalizing the request body with len=0, eos=1 after receiving a complete early HTTP/2 response. The stream has already been marked closed internally, and cf_h2_send() incorrectly returns CURLE_SEND_ERROR instead of accepting the completed response.

Find here a possible fix. libcurl-http2-early-response.patch

The proposed patch is also consistent with libcurl’s existing cf_h2_body_send() behavior, which already treats a closed stream with completed response headers as a valid early response

I'll open a PR with the proposed patch.

curl/libcurl version

curl 8.22.0

operating system

Linux localhost.localdomain 5.14.0-611.36.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 3 17:30:12 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux