0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00

Add the chunked option for HTTP/1.1

It allows disabling the chunked transfer-encoding. It
can also be disabled on a per-request basis, although
it will be ignored for responses that are not streamed.
This commit is contained in:
Loïc Hoguin 2018-11-18 13:21:36 +01:00
parent 417032a445
commit 8d6d78575f
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
5 changed files with 129 additions and 14 deletions

View file

@ -24,23 +24,26 @@ experimental.
data in order to compress them. This is the case for
gzip compression.
* Add an `http10_keepalive` option to allow disabling
* Add the `chunked` option to allow disabling chunked
transfer-encoding for HTTP/1.1 connections.
* Add the `http10_keepalive` option to allow disabling
keep-alive for HTTP/1.0 connections.
* Add an `idle_timeout` option for HTTP/2.
* Add the `idle_timeout` option for HTTP/2.
* Add a `sendfile` option to both HTTP/1.1 and HTTP/2.
* Add the `sendfile` option to both HTTP/1.1 and HTTP/2.
It allows disabling the sendfile syscall entirely for
all connections. It is recommended to disable sendfile
when using VirtualBox shared folders.
* Add the `rate_limited/2` callback to REST handlers.
* Add a `deflate_opts` option to Websocket handlers that
* Add the `deflate_opts` option to Websocket handlers that
allows configuring deflate options for the
permessage-deflate extension.
* Add a `charset` option to `cowboy_static`.
* Add the `charset` option to `cowboy_static`.
* Add support for the SameSite cookie attribute.
@ -81,8 +84,9 @@ experimental.
handlers and Websocket handlers. This can be used
to update options on a per-request basis. Allow
overriding the `idle_timeout` option for both
HTTP/1.1 and Websocket, and the `cowboy_compress_h`
options for HTTP/1.1 and HTTP/2.
HTTP/1.1 and Websocket, the `cowboy_compress_h`
options for HTTP/1.1 and HTTP/2 and the `chunked`
option for HTTP/1.1.
=== Bugs fixed

View file

@ -17,6 +17,7 @@ as a Ranch protocol.
[source,erlang]
----
opts() :: #{
chunked => boolean(),
connection_type => worker | supervisor,
env => cowboy_middleware:env(),
http10_keepalive => boolean(),
@ -51,6 +52,13 @@ Ranch functions `ranch:get_protocol_options/1` and
The default value is given next to the option name:
chunked (true)::
Whether chunked transfer-encoding is enabled for HTTP/1.1 connections.
Note that a response streamed to the client without the chunked
transfer-encoding and without a content-length header will result
in the connection being closed at the end of the response body.
connection_type (supervisor)::
Whether the connection process also acts as a supervisor.
@ -140,7 +148,7 @@ Ordered list of stream handlers that will handle all stream events.
== Changelog
* *2.6*: The `http10_keepalive`, `proxy_header` and `sendfile` options were added.
* *2.6*: The `chunked`, `http10_keepalive`, `proxy_header` and `sendfile` options were added.
* *2.5*: The `linger_timeout` option was added.
* *2.2*: The `max_skip_body_length` option was added.
* *2.0*: The `timeout` option was renamed `request_timeout`.