Skip to content

HTTP/2: curl hangs with upload if server sends response early and resets stream #986

@tatsuhiro-t

Description

@tatsuhiro-t

I did this

Run h2 server. With --early-response option, this server returns HTTP response without waiting for upload completion. Additionally, it sends RST_STREAM if it expects request body from client:

$ nghttpd 8443 --no-tls -v --early-response

Then do some large upload from curl:

$ curl http://localhost:8443 --http2-prior-knowledge -T 100m  -v
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8443 (#0)
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0xf91f30)
> PUT /100m HTTP/1.1
> Host: localhost:8443
> User-Agent: curl/7.50.2-DEV
> Accept: */*
> Content-Length: 104857600
> 
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200 
< server: nghttpd nghttp2/1.15.0-DEV
< cache-control: max-age=3600
< date: Sun, 28 Aug 2016 08:49:30 GMT
< content-length: 0
< last-modified: Sun, 28 Aug 2016 08:32:37 GMT
< 

And it stuck.

Background info: nghttp2/nghttp2#669

I expected the following

curl should detect stream closure, and exit. Since upload was not completed, with some error code (not sure which one we should use here).

curl/libcurl version

I build curl from git master

curl 7.50.2-DEV (x86_64-pc-linux-gnu) libcurl/7.50.2-DEV OpenSSL/1.0.2h zlib/1.2.8 libidn/1.32 libssh2/1.5.0 nghttp2/1.8.0-DEV
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets 

operating system

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    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