Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP streaming improvements #2404

Merged
merged 11 commits into from Jun 24, 2020
Merged

HTTP streaming improvements #2404

merged 11 commits into from Jun 24, 2020

Conversation

tanner0101
Copy link
Member

@tanner0101 tanner0101 commented Jun 22, 2020

Improves HTTP request and response streaming (#2404).

  • Streaming request body skipping will only happen if the entire response has been sent before the user starts reading the request body (fixes body streaming doesn't stream #2393).

Note: Previously, streaming request bodies would be drained automatically by Vapor as soon as the response head was sent. This made it impossible to implement realtime streaming, like an echo server. With these changes, you have much more control over streaming HTTP while still preventing hanging if the request body is ignored entirely.

Note: Previously streaming bodies required a count and would always set the content-length header. Now, setting a count of -1 indicates a stream with indeterminate length. -1 will be used if the stream count is omitted. This results in transfer-encoding: chunked being used automatically.

@tanner0101 tanner0101 added the bug Something isn't working label Jun 22, 2020
@tanner0101 tanner0101 added this to Awaiting Review in Vapor 4 via automation Jun 22, 2020
@tanner0101 tanner0101 changed the title Echo server fixes HTTP streaming fixes Jun 24, 2020
@tanner0101 tanner0101 marked this pull request as ready for review June 24, 2020 17:50
@tanner0101 tanner0101 added the semver-minor Contains new API label Jun 24, 2020
@tanner0101 tanner0101 changed the title HTTP streaming fixes HTTP streaming improvements Jun 24, 2020
@tanner0101 tanner0101 merged commit 2f9be8b into master Jun 24, 2020
Vapor 4 automation moved this from Awaiting Review to Done Jun 24, 2020
@tanner0101 tanner0101 deleted the tn-echo-server branch June 24, 2020 18:36
@tanner0101
Copy link
Member Author

These changes are now available in 4.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working semver-minor Contains new API
Projects
Vapor 4
  
Done
1 participant