Skip to content

Curl doesn't send request body when the server responds with HTTP 101 #12022

@djelinski

Description

@djelinski

I did this

Using a local Liberty server and curl 8.3.0 client, I sent a HTTP POST request over plain HTTP1 as follows:

curl --http2 -v -H"Expect:100-continue" http://localhost:9080/system/greeter/hello --data "foo"

The server sent the following 2 response headers in quick succession:

HTTP/1.1 100 Continue
Content-Length: 0
Date: Tue, 03 Oct 2023 19:06:00 GMT

HTTP/1.1 101 Switching Protocols
Date: Tue, 03 Oct 2023 19:06:00 GMT
Upgrade: h2c
Connection: Upgrade
Content-Length: 0

In response to that, Curl sent the HTTP2 connection preface without sending the data.
It doesn't fail every time; sometimes when the HTTP 101 header is late enough, curl manages to send the request body correctly.

I expected the following

I expected curl to send the request data before sending the HTTP2 preface

curl/libcurl version

curl 8.3.0 (x86_64-w64-mingw32) libcurl/8.3.0 OpenSSL/3.1.2 (Schannel) zlib/1.3 brotli/1.1.0 zstd/1.5.5 WinIDN libssh2/1.11.0 nghttp2/1.56.0 ngtcp2/0.19.1 nghttp3/0.15.0

operating system

Windows 11

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions