Improve handling of unconsumed request bodies at end of http1 requests #138
+3
−2
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.
This PR includes 2 related items:
Fixes an old regression where
request = nil
should be conditional upon the request body, but was incorrectly the response body. Looking at the git history, the original behavior was... unless request.body
and was changed in b3cc9ce, seemingly accidentally during a refactor.I occasionally experience random hangs when running my test suite and believe this might be one cause of them.
Changes the handling of unconsumed bodies from
request.finish
torequest.each{}
.finish
buffers the request fully in memory as aBuffered
, causing needless memory bloat in the ruby process. Usingeach
skips the buffering, but is otherwise behaves the same.Types of Changes
Contribution