HTTP streaming improvements
This patch was authored and released by @tanner0101.
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 #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.
- Response body stream now supports omitting the
count
parameter (fixes #2393).
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 intransfer-encoding: chunked
being used automatically.