Don't disable http
tee
after first header, so that headers of re-directs can be captured and we don't panic
#504
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.
Description
From what I can tell, the intention with this change originally was to
tee
thehttp
response to efficiently get the raw headers. To save on performance, thetee
was disabled after the header, since in theory there's no need totee
afterwards on the body.The issue arrises when we re-direct. We attempt to read the
tee
'd buffer after being re-directed and thetee
being disabled and which is now out-of-sync with the underlying buffer. This causes an attempt to access a slice out-of-bounds. Since we'd want to get the headers of re-directs as well, I think a simple fix of just leaving thetee
enabled is sufficient.How to Test
I manually checked the
raw_header
and ensured that once youbase64 --decode
, both the final response and re-directraw_headers
are correct when compared to Wireshark.master
178.16.143.250
is an http site that redirects you. It panics with--raw-headers
.Branch
Notes & Caveats
If necessary, explain the motivation for this PR, and note any caveats that apply to your changes or future work that will be needed.
Issue Tracking
Resolves #463