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

267 commits

Author SHA1 Message Date
Loïc Hoguin
f58189df19
Clarify that protocol opts may be defined by stream handlers 2020-04-08 10:27:14 +02:00
Loïc Hoguin
0fc33c5300
Add more headers to cowboy_req:parse_header/2,3 2020-03-30 15:02:35 +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
f8e94c3315
Add more specifications 2020-03-29 13:22:06 +02:00
Loïc Hoguin
2ea1313763
Add Trace Context to the list of specs 2020-02-08 15:32:46 +01:00
Loïc Hoguin
3ec0cd8b8d
Clarify modifying/adding to the Req object 2020-02-08 15:32:46 +01:00
Loïc Hoguin
edea415da8
Fix cowboy_req:parse_header manual for unknown headers 2020-01-06 14:42:24 +01:00
Loïc Hoguin
5e0be061bb
Add a skeleton performance chapter to the guide 2020-01-06 14:04:25 +01: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
3a7232b019
No longer use erlang:get_stacktrace/0
It has been deprecated in OTP and the new way is available
on all supported OTP versions.
2019-12-31 15:10:38 +01:00
Loïc Hoguin
e81cd6328b
Add new RFCs to the list 2019-12-31 11:04:42 +01:00
Loïc Hoguin
525eeeecc9
Cowboy 2.7.0 2019-10-10 16:15:51 +02:00
Loïc Hoguin
a73004e966
Fix a number of low hanging todos 2019-10-10 16:04:28 +02:00
Loïc Hoguin
d52e84bdd9
Add shutdown_reason Websocket command
This allows changing the normal exit reason of Websocket
processes, providing a way to signal other processes of
why the exit occurred.
2019-10-10 11:33:35 +02:00
Loïc Hoguin
cc54c207e3
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.
2019-10-09 20:54:33 +02:00
Loïc Hoguin
0c4103984b
Add migration guide for Cowboy 2.7 2019-10-07 17:48:45 +02:00
Loïc Hoguin
b350180503
Add new stream handlers to the guide
Also link from the guide to manual pages.
2019-10-07 14:06:37 +02:00
Loïc Hoguin
80aef3cdaa
Document no date/server headers from response/headers commands 2019-10-07 13:45:07 +02:00
Loïc Hoguin
2e8fcb9a9e
Add cowboy_req:cast/2
Better than sending messages manually.
2019-10-07 13:25:49 +02:00
Loïc Hoguin
fad0ac8fb6
Document the set_options stream handler command 2019-10-07 12:07:23 +02:00
Loïc Hoguin
e25fb19bab
Document the log stream handler command 2019-10-07 11:58:45 +02:00
Loïc Hoguin
53bc54a860
Document the logger option 2019-10-07 11:43:44 +02:00
Loïc Hoguin
0342866c2e
Document cowboy_tracer_h 2019-10-07 10:43:22 +02:00
Loïc Hoguin
eaed063702
Document cowboy_metrics_h 2019-10-07 09:59:36 +02:00
Loïc Hoguin
3977f2b96f
Document the commands based Websocket interface
The old interface with ok|reply|stop tuples is deprecated.
2019-10-06 16:51:27 +02:00
Loïc Hoguin
2b38526351
Fix PUT when resource doesn't exist in flowchart
This required moving around a lot of things so hopefully I
did not add errors while doing so. Only time will tell.

Also add the 415 that can result from content_types_accepted.
2019-10-06 12:48:35 +02:00
Loïc Hoguin
62836cdddc
Document how to recover from cookie parsing errors 2019-10-06 10:18:16 +02:00
Loïc Hoguin
3e23aff1d1
Add Websocket option validate_utf8
This allows disabling the UTF-8 validation check
for text and close frames.
2019-10-05 17:32:50 +02:00
Loïc Hoguin
618c001291
Fix REST flowchart around 201 response for PUT
When the method is PUT we do not check the location header.
2019-10-05 11:39:53 +02:00
Loïc Hoguin
03dac1486d
Add cowboy_req:filter_cookies/2 2019-10-05 11:23:57 +02:00
Loïc Hoguin
28aee1f272
Document media type wildcard in content_types_accepted 2019-10-03 16:20:29 +02:00
Loïc Hoguin
99df823cc3
Document stopping the listener in App:stop/1 2019-10-03 10:09:35 +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
cf84f59d9b
Add persistent_term support to the router 2019-09-28 15:40:41 +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
42eb6bae69
Fix using custom fields in Req 2019-09-06 12:25:02 +02:00
Loïc Hoguin
d14c59d905
Document unit for options that are in bytes 2019-09-06 11:53:19 +02:00
Alastair Hole
bbf36a2ac0
Minor grammar correction
Noun 'setup' -> verb phrase 'set up'
2019-09-05 17:15:13 +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
5829f1b9ac
Add more related specs 2019-07-22 10:41:04 +02:00
Loïc Hoguin
504c7c55f7
Add two related specs 2019-07-12 10:46:49 +02:00
Loïc Hoguin
dfeec3b74a
Add two new RFCs to the list 2019-05-27 13:43:01 +02:00
Loïc Hoguin
3030c2d5c9
Fix a few examples using cert instead of certfile 2019-05-13 11:25:00 +02:00
Loïc Hoguin
8875b07b37
Add RFC 8586 2019-04-24 20:24:23 +02:00
Loïc Hoguin
d846827b2a
Cowboy 2.6.3 2019-04-05 11:09:55 +02:00
Loïc Hoguin
d5489b4c73
Cowboy 2.6.2
Updates Cowlib to 2.7.2.
2019-04-04 11:23:50 +02:00
Loïc Hoguin
21d267a44a
Describe what star represent in the REST flowcharts 2019-04-03 14:08:53 +02:00
Ginetom
cd9b04792c
Clarify what the private directory is 2019-04-03 13:48:57 +02:00
Jesper Louis Andersen
b86e2839bc
Fix calling convention for set_resp_cookie/3
If not providing optional values, they are set to `#{}` and
are the last parameter according to the source code. Reflect
this in the documentation.
2019-04-02 15:40:05 +02:00
Loïc Hoguin
9edfef34b2
Add this year's April Fool's RFC 2019-04-02 11:03:55 +02:00