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

HEAD requests fail with: HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR #13725

Closed
jeroen opened this issue May 20, 2024 · 2 comments
Closed
Assignees
Labels

Comments

@jeroen
Copy link
Contributor

jeroen commented May 20, 2024

Users of the R bindings found that after a recent libcurl update, the following started failing:

curl --compressed -IL "http://www.dropbox.com/s/srkb2ife75px2yz/modeling_results_BayesSpace_k09.Rdata?dl=1"
# HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (

If we disable HTTP/2 the request also errors but with chunk hex-length char not a hex digit: 0x1f error:

curl --compressed  -IL --http1.1 "http://www.dropbox.com/s/srkb2ife75px2yz/modeling_results_BayesSpace_k09.Rdata?dl=1"
# chunk hex-length char not a hex digit: 0x1f

curl/libcurl version

I confirmed the problem started appearing on curl 8.6.0 and 8.7.1 on MacOS.

I also confirmed the problem did not appear on curl 8.4.0 on MacOS.

operating system

MacOS

@jeroen
Copy link
Contributor Author

jeroen commented May 21, 2024

FYI it is not just http/2 it also happens with http 1.1.

@icing
Copy link
Contributor

icing commented May 21, 2024

The server sends a response to the HEAD request which includes bytes after the headers. This is invalid HTTP (in 1.1 and 2). curl 8.4 ignored these bytes with a warning while 8.6 and newer fail.

I made #13732 to fix this.

icing added a commit to icing/curl that referenced this issue May 21, 2024
- as reported in curl#13725, some servers wrongly send body bytes in
  responses to a HEAD request. This used to be tolerated in curl
  8.4 and before and leads to failed transfers in newer versions.
- restore previous behaviour for HTTP/1.1 and HTTP/2:
  * 1.1: do not add 'Transfer-Encoding' writers from HEAD
    responses. RFC 9112 says they do not apply.
  * 2: when the transfer expects 'no_body', to not report stream
    resets as error when all response headers have been received.
@bagder bagder closed this as completed in 5a4769b May 21, 2024
icing added a commit to icing/curl that referenced this issue May 21, 2024
- test HEAD request with 'Transfer-Encoding:chunked' and
  non-encoded response content
- verifies curl#13725
bagder pushed a commit that referenced this issue May 22, 2024
- test HEAD request with 'Transfer-Encoding:chunked' and
  non-encoded response content
- verifies #13725

Closes #13735
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants