Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http/2 h2c request to Cloudflare sites results in Recv failure: Connection reset by peer #6099

Closed
candrews opened this issue Oct 18, 2020 · 4 comments
Labels
HTTP/2 not-a-curl-bug This is not a bug in curl

Comments

@candrews
Copy link

candrews commented Oct 18, 2020

I did this

This issue appears to be reproducible with any site handled by Cloudflare, including http://cloudflare.com

$ curl http://cloudflare.com --http2 -v
*   Trying 2606:4700::6811:b055:80...
* Connected to cloudflare.com (2606:4700::6811:b055) port 80 (#0)
> GET / HTTP/1.1
> Host: cloudflare.com
> User-Agent: curl/7.73.0
> Accept: */*
> Connection: Upgrade, HTTP2-Settings
> Upgrade: h2c
> HTTP2-Settings: AAMAAABkAAQCAAAAAAIAAAAA
> 
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

$ curl http://image.tmdb.org --http2 -v
*   Trying 2606:4700::6810:399b:80...
* Connected to image.tmdb.org (2606:4700::6810:399b) port 80 (#0)
> GET / HTTP/1.1
> Host: image.tmdb.org
> User-Agent: curl/7.73.0
> Accept: */*
> Connection: Upgrade, HTTP2-Settings
> Upgrade: h2c
> HTTP2-Settings: AAMAAABkAAQCAAAAAAIAAAAA
> 
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

Realistically, h2c isn't commonly used so this isn't a high priority issue. But, it's not working, so I thought curl should know about it, in case it is a problem that curl can fix (or work around).

I expected the following

A successful response (should be a 404)

curl/libcurl version

$ curl -V
curl 7.73.0 (x86_64-pc-linux-gnu) libcurl/7.73.0 OpenSSL/1.1.1h zlib/1.2.11 brotli/1.0.9 zstd/1.4.5 libidn2/2.3.0 libssh2/1.9.0_DEV nghttp2/1.41.0 quiche/0.5.1 librtmp/2.3
Release-Date: 2020-10-14
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s rtmp rtsp scp sftp smtp smtps tftp 
Features: alt-svc AsynchDNS brotli HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Largefile libz Metalink NTLM SSL TLS-SRP UnixSockets zstd

operating system

$ uname -a
Linux irrational 5.8.6-gentoo-x86_64 #1 SMP Fri Sep 4 18:34:47 EDT 2020 x86_64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz GenuineIntel GNU/Linux
@candrews candrews changed the title http/2 request to http://image.tmdb.org results in Recv failure: Connection reset by peer http/2 h2c request to Cloudflare sites results in Recv failure: Connection reset by peer Oct 18, 2020
@jay
Copy link
Member

jay commented Oct 18, 2020

This doesn't appear to be a curl issue. cloudflare closes the connection. Maybe they shut it off to mitigate smuggling issues?

/cc @the-bumble

@jay jay added not-a-curl-bug This is not a bug in curl HTTP/2 labels Oct 18, 2020
@candrews
Copy link
Author

candrews commented Oct 18, 2020

If curl isn't doing anything wrong, then the problem is that Cloudflare is incorrectly closing the connection: if the client requests an h2c upgrade, and the server doesn't want to do the upgrade, then the server should ignore the request and continue as usual with HTTP/1.1. I submitted an issue on their community support forum: https://community.cloudflare.com/t/http-h2c-upgrade-requests-result-in-connection-reset-by-peer/214761

If someone has a better way to contact Cloudflare to make them aware of this issue so they can fix it, can you please do so?

@bagder
Copy link
Member

bagder commented Oct 21, 2020

I have passed on this information to some relevant persons. As we don't see any curl problem here, let's close this issue.

@bagder bagder closed this as completed Oct 21, 2020
@alexwala
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HTTP/2 not-a-curl-bug This is not a bug in curl
Development

No branches or pull requests

4 participants