Directly read HTTP response from connection instead of copying to byt… #79
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.
…es first.
Currently, there are cases where go-ftw will block until read timeout even after getting a whole HTTP response. I'm not exactly sure what causes it (I notice in my tests when Envoy returns an error response directly without proxying it seems to happen), but it sort of makes sense - usually you'd expect to need to parse the HTTP response to know when it's done since a connection is just otherwise a stream of bytes, so I'm actually less sure why it wouldn't always be blocking until read timeout.
This changes to parse straight into the HTTP response so HTTP semantics correctly let the response parsing finish when it's done, now I see some tests that always passed after 1s taking the expected several ms.