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

244 commits

Author SHA1 Message Date
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
Loïc Hoguin
459fc959b4
Add a related RFC 2019-03-25 20:27:20 +01:00
Loïc Hoguin
e0254cdcb0
Cowboy 2.6.1 2018-11-28 12:15:17 +01:00
Loïc Hoguin
6cc3b0ccca
Document cowboy_stream_h/cowboy_compress_h 2018-11-18 23:03:30 +01:00
Loïc Hoguin
8d6d78575f
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.
2018-11-18 13:25:12 +01:00
Loïc Hoguin
417032a445
Prepare the Cowboy 2.6 release 2018-11-17 13:36:14 +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
dba17fdddb
Document using undefined as content_types_provided callback
This is a convention that indicates the callback will never
be called, for example because the methods HEAD or GET are
not accepted.
2018-11-14 18:04:32 +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
6f57405b5c
Allow disabling keep-alive for HTTP/1.0 connections 2018-11-14 18:04:32 +01:00
Loïc Hoguin
f0cae8dbcf
Document some undefined behavior in cowboy_router 2018-11-14 18:04:32 +01:00
Loïc Hoguin
c65e3ff20e
Add a use case to loop handlers 2018-11-14 18:04:31 +01:00
Loïc Hoguin
ef05956a5a
Document the proxy_header protocol option 2018-11-14 12:32:31 +01:00
Loïc Hoguin
8164b50453
Add deflate options for Websocket compression
They allow the server to configure what it is willing to accept
for both the negotiated configuration (takeover and window bits)
and the other zlib options (level, mem_level and strategy).

This can be used to reduce the memory and/or CPU footprint of
the compressed data, which comes with a cost in compression ratio.
2018-11-12 18:12:44 +01:00
Loïc Hoguin
d7b7580b39
Add sendfile support to cowboy_req:stream_body
It is now possible to stream one or more sendfile tuples.
A simple example of what can now be done would be for
example to build a tar file on the fly using the sendfile
syscall for sending the files, or to support Range requests
with more than one range with the sendfile syscall.

When using cowboy_compress_h unfortunately we have to read
the file in order to send it. More options will be added
at a later time to make sure users don't read too much
into memory. This is a new feature however so existing
code is not affected.

Also rework cowboy_http's data sending to be flatter.
2018-11-09 17:42:37 +01:00
Loïc Hoguin
805a156785
Test stop against all relevant REST callbacks 2018-11-05 10:30:26 +01:00
Loïc Hoguin
8c9ad7bf07
Add the rate_limited/2 REST callback 2018-11-04 11:58:59 +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
571719a164
Add a charset option to cowboy_static 2018-11-02 15:36:41 +01:00
Loïc Hoguin
9569043bdd
Add RFC6657 to the list of related documents 2018-11-02 14:04:32 +01:00
Loïc Hoguin
e0b036fe68
Add tests for charsets_provided
Fix cases where the q-value is 0 and where a wildcard
was sent in the accept-charset header.

Also don't send a charset in the content-type of the
response if the media type is not text.

Thanks to Philip Witty for help figuring this out.
2018-11-02 13:54:19 +01:00
Loïc Hoguin
399b6a16b4
Better handle content negotiation when accept contains charsets
Thanks to Philip Witty for help figuring this out.
2018-11-02 13:49:54 +01:00
Loïc Hoguin
d4129e6305
Exit gracefully on parent exit/sys:terminate/2,3 2018-10-28 10:20:43 +01:00
Loïc Hoguin
497e9d459e
Add yet another RFC to the list 2018-10-26 10:15:41 +02:00