mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 04:30:25 +00:00
Implement flow control for HTTP/1.1
We now stop reading from the socket unless asked to, when we reach the request body. The option initial_stream_flow_size controls how much data we read without being asked, as an optimization. We may also have received additional data along with the request headers. This commit also reworks the timeout handling for HTTP/1.1 because the stray timeout message was easily reproducible after implementing the flow control. The issue should be gone for good this time.
This commit is contained in:
parent
0c4103984b
commit
cc54c207e3
3 changed files with 120 additions and 97 deletions
|
@ -17,25 +17,26 @@ as a Ranch protocol.
|
|||
[source,erlang]
|
||||
----
|
||||
opts() :: #{
|
||||
chunked => boolean(),
|
||||
connection_type => worker | supervisor,
|
||||
http10_keepalive => boolean(),
|
||||
idle_timeout => timeout(),
|
||||
inactivity_timeout => timeout(),
|
||||
linger_timeout => timeout(),
|
||||
logger => module(),
|
||||
max_empty_lines => non_neg_integer(),
|
||||
max_header_name_length => non_neg_integer(),
|
||||
max_header_value_length => non_neg_integer(),
|
||||
max_headers => non_neg_integer(),
|
||||
max_keepalive => non_neg_integer(),
|
||||
max_method_length => non_neg_integer(),
|
||||
max_request_line_length => non_neg_integer(),
|
||||
max_skip_body_length => non_neg_integer(),
|
||||
proxy_header => boolean(),
|
||||
request_timeout => timeout(),
|
||||
sendfile => boolean(),
|
||||
stream_handlers => [module()]
|
||||
chunked => boolean(),
|
||||
connection_type => worker | supervisor,
|
||||
http10_keepalive => boolean(),
|
||||
idle_timeout => timeout(),
|
||||
inactivity_timeout => timeout(),
|
||||
initial_stream_flow_size => non_neg_integer(),
|
||||
linger_timeout => timeout(),
|
||||
logger => module(),
|
||||
max_empty_lines => non_neg_integer(),
|
||||
max_header_name_length => non_neg_integer(),
|
||||
max_header_value_length => non_neg_integer(),
|
||||
max_headers => non_neg_integer(),
|
||||
max_keepalive => non_neg_integer(),
|
||||
max_method_length => non_neg_integer(),
|
||||
max_request_line_length => non_neg_integer(),
|
||||
max_skip_body_length => non_neg_integer(),
|
||||
proxy_header => boolean(),
|
||||
request_timeout => timeout(),
|
||||
sendfile => boolean(),
|
||||
stream_handlers => [module()]
|
||||
}
|
||||
----
|
||||
|
||||
|
@ -79,6 +80,12 @@ inactivity_timeout (300000)::
|
|||
|
||||
Time in ms with nothing received at all before Cowboy closes the connection.
|
||||
|
||||
initial_stream_flow_size (65535)::
|
||||
|
||||
Amount of data in bytes Cowboy will read from the socket
|
||||
right after a request was fully received. This is a soft
|
||||
limit.
|
||||
|
||||
linger_timeout (1000)::
|
||||
|
||||
Time in ms that Cowboy will wait when closing the connection. This is
|
||||
|
@ -144,7 +151,7 @@ Ordered list of stream handlers that will handle all stream events.
|
|||
|
||||
== Changelog
|
||||
|
||||
* *2.7*: The `logger` option was added.
|
||||
* *2.7*: The `initial_stream_flow_size` and `logger` 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue