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

24 commits

Author SHA1 Message Date
Loïc Hoguin
8af3216c4c
Document the HTTP/2 linger_timeout option 2020-04-08 10:27:45 +02:00
Loïc Hoguin
6ad842a742
Increase the default max_received_frame_rate
Allow 10000 frames every 10 seconds instead of just 1000,
as the limit was too quickly reached in some deployments.
2020-03-29 13:51:21 +02:00
Loïc Hoguin
db0d6f8d25
Use active,N
This reduces the number of times we need to ask for more packets,
and as a result we get a fairly large boost in performance,
especially with HTTP/1.1.

Unfortunately this makes Cowboy require at least Erlang/OTP 21.3+
because the ssl application did not have active,N. For simplicity
the version required will be Erlang/OTP 22+.

In addition this change improves hibernate handling in
cowboy_websocket. Hibernate will now work for HTTP/2 transport
as well, and stray or unrelated messages will no longer cancel
hibernate (the process will handle the message and go back into
hibernation).

Thanks go to Stressgrid for benchmarking an early version of this
commit: https://stressgrid.com/blog/cowboy_performance_part_2/
2020-01-06 12:58:14 +01:00
Loïc Hoguin
53bc54a860
Document the logger option 2019-10-07 11:43:44 +02:00
Loïc Hoguin
ab44985a9e
Fix HTTP/2 CVEs
A number of HTTP/2 CVEs were documented recently:

  https://www.kb.cert.org/vuls/id/605641/

This commit, along with a few changes and additions in Cowlib,
fix or improve protection against all of them.

For CVE-2019-9511, also known as Data Dribble, the new option
stream_window_data_threshold can be used to control how little
the DATA frames that Cowboy sends can get.

For CVE-2019-9516, also known as 0-Length Headers Leak, Cowboy
will now simply reject streams containing 0-length header names.

For CVE-2019-9517, also known as Internal Data Buffering, the
backpressure changes were already pretty good at preventing this
issue, but a new option max_connection_buffer_size was added for
even better control over how much memory we are willing to allocate.

For CVE-2019-9512, also known as Ping Flood; CVE-2019-9515, also
known as Settings Flood; CVE-2019-9518, also known as Empty Frame
Flooding; and similar undocumented scenarios, a frame rate limiting
mechanism was added. By default Cowboy will now allow 1000 frames
every 10 seconds. This can be configured via max_received_frame_rate.

For CVE-2019-9514, also known as Reset Flood, another rate limiting
mechanism was added and can be configured via max_reset_stream_rate.
By default Cowboy will do up to 10 stream resets every 10 seconds.

Finally, nothing was done for CVE-2019-9513, also known as Resource
Loop, because Cowboy does not currently implement the HTTP/2
priority mechanism (in parts because these issues were well known
from the start).

Tests were added for all cases except Internal Data Buffering,
which I'm not sure how to test, and Resource Loop, which is not
currently relevant.
2019-10-02 10:44:45 +02:00
Loïc Hoguin
49af57d546
Implement backpressure on cowboy_req:stream_body
This should limit the amount of memory that Cowboy is using
when a handler is sending data much faster than the network.

The new max_stream_buffer_size is a soft limit and only has
an effect when the cowboy_stream_h handler is used.
2019-09-14 18:21:05 +02:00
Loïc Hoguin
d14c59d905
Document unit for options that are in bytes 2019-09-06 11:53:19 +02:00
Loïc Hoguin
48f417ac8f
Fix and optimize sending of WINDOW_UPDATE frames
For long-running connections it was possible for the connection
window to become larger than allowed by the protocol because the
window increases claimed by stream handlers were never reclaimed
even if no data was consumed.

The new code applies heuristics to fix this and reduce the number
of WINDOW_UPDATE frames that are sent. It includes six new options
to control that behavior: margin, max and threshold for both the
connection and stream windows. The margin is some extra space
added on top of the requested read size. The max is the maximum
window size at any given time. The threshold is a minimum window
size that must be reached before we even consider sending more
WINDOW_UPDATE frames. We also avoid sending WINDOW_UPDATE frames
when there is already enough space in the window, or when the
read size is 0.

Cowlib is set to master until a new tag is done.
2019-09-05 14:07:38 +02:00
Loïc Hoguin
6cc3b0ccca
Document cowboy_stream_h/cowboy_compress_h 2018-11-18 23:03:30 +01:00
Loïc Hoguin
8185d356c5
Add the idle_timeout option to HTTP/2 2018-11-16 16:30:57 +01:00
Loïc Hoguin
15fb3187f5
Add some missing items to a few module changelogs 2018-11-14 18:04:32 +01:00
Loïc Hoguin
ef05956a5a
Document the proxy_header protocol option 2018-11-14 12:32:31 +01:00
Loïc Hoguin
be09711687
Add an option to disable sendfile for a listener 2018-11-03 18:55:40 +01:00
Loïc Hoguin
f0d9805601
Fix cowboy_http2 manual page formatting
[ci skip]
2018-05-02 11:08:40 +02:00
Loïc Hoguin
2db5ffbf84
Add SETTINGS ack timeout and option settings_timeout 2018-04-28 11:00:50 +02:00
Loïc Hoguin
9a29aea148
Add options controlling maximum h2 frame sizes 2018-04-27 17:58:37 +02:00
Loïc Hoguin
d38d86c4a9
Add options controlling initial control flow windows 2018-04-26 22:08:05 +02:00
Loïc Hoguin
7373822b86
Add the max_concurrent_streams h2 option 2018-04-25 21:32:58 +02:00
Loïc Hoguin
8f4adf437c
Add options to control h2's SETTINGS_HEADER_TABLE_SIZE 2018-04-25 16:55:52 +02:00
Loïc Hoguin
bbfc1569cc
Add initial implementation of Websocket over HTTP/2
Using the current draft:

  https://tools.ietf.org/html/draft-ietf-httpbis-h2-websockets-01
2018-04-04 17:23:37 +02:00
Loïc Hoguin
6f7b59886e
Remove NumAcceptors argument from start_clear/tls
They are now cowboy:start_clear/3 and cowboy:start_tls/3.
The NumAcceptors argument can be specified via the
num_acceptor transport option. Ranch has been updated
to 1.4.0 to that effect.
2017-06-07 15:15:54 +02:00
Loïc Hoguin
7db724f04a
Add inactivity_timeout and other options improvements 2017-05-05 13:48:25 +02:00
Loïc Hoguin
cbc7056395
Update cowboy_websocket_manual 2016-12-22 18:13:25 +01:00
Loïc Hoguin
e584412de7
Add the manual for cowboy_http2 2016-12-22 15:19:38 +01:00