Fix timeouts causing unexplained EOFs #246
Merged
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.
If a request errors after the response headers have already been received, but the full response body has not been read yet, then the response body stream will begin returning EOF without any other explanation other than what is written to the logger. This gives the appearance that everything is fine but half of the response body is missing.
To fix this, be sure to communicate to the response stream when a transfer error occurs while streaming the response body, so that the next call to read from the response will return an appropriate error instead of an unexplained EOF.
This is especially an obvious problem when combined with the timeout option, which can very likely occur during reading of the response body, whereas most other errors are likely to occur before that time.
First raised in #154.