http2: fail if connection terminated without END_STREAM #6736
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Emit an error if HTTP/2 stream is not correctly closed when underlying TCP/SSL connection is terminated.
In rfc7540, section 8.1. HTTP Request/Response Exchange,
In case of the server or proxy server is SIGKILLed during data transfer, Linux kernel will terminated the TCP connection by
FIN+ACK
. And if the server doesn't provideContent-Length
(eg. GitHub tarball archive URLs), our current behavior is to exit without error, leaving incomplete data.The misbehavior makes downstream programs unexpectedly cache incomplete files (NixOS/nix#4533).
Note:
Reproduce misbehavior: (reproduced in master 7b2f067)
https_proxy
.curl -LO https://codeload.github.com/NixOS/nixpkgs/legacy.tar.gz/772406c2a4e22a85620854056a4cd02856fa10f0
, or any other URL withoutContent-Length
. (For GitHub, it may be cached if an archive is recently downloaded. You can try different commits, or wait for minutes between two fetch, untilcurl
doesn't show total bytes, which indicates missingContent-Length
)kill -9
the proxy server.curl
instance exited with 0 without any error, leaving the incomplete file.