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

1932 commits

Author SHA1 Message Date
Loïc Hoguin
1949357f0c
Allow overriding cowboy_http's idle_timeout per request
This allows requests that expect to run longer to do so
without impacting the configuration of other requests.
2018-11-16 12:54:34 +01:00
Loïc Hoguin
240da3f2d9
Add the set_options stream handler command
The first two options to benefit from this are the
cowboy_compress_h options.
2018-11-15 18:53:42 +01:00
Loïc Hoguin
fbfec873f6
Add a compress_buffering option to cowboy_compress_h
Also changes the behavior to disable buffering by default, so
that the default works in all cases, including server-sent events.
2018-11-15 10:11:36 +01:00
Loïc Hoguin
292039362a
Don't send the content-length header in empty 304 responses
It's OK to send it when set explicitly, as it can be set
to what the representation's size would have been.
2018-11-14 19:24:39 +01:00
Loïc Hoguin
4fedb33631
Ignore the boundary parameter when accepting multipart 2018-11-14 18:04:32 +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
637a9b3924
Don't send an unnecessary content-type header with cowboy_rest 2018-11-14 18:04:31 +01:00
Loïc Hoguin
1e2d59ed26
Ranch 1.7.0 2018-11-14 12:33:43 +01:00
Loïc Hoguin
ef05956a5a
Document the proxy_header protocol option 2018-11-14 12:32:31 +01:00
Loïc Hoguin
f9d689f9fd
Remove two unnecessary debug calls 2018-11-13 15:56:58 +01:00
Loïc Hoguin
8d920f3db9
Add the {deflate, boolean()} Websocket command
It allows to temporarily disable Websocket compression
when it was negotiated. It's ignored otherwise. This
can be used as fine-grained control when some frames
do not compress well.
2018-11-13 15:55:09 +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
fe1ee080de
Enable range requests support in cowboy_static 2018-11-11 16:25:45 +01:00
Loïc Hoguin
7840f6db7b
Add ProvideRangeCallback tests using sendfile
And fix this case when multiple ranges are requested.
2018-11-11 16:09:28 +01:00
Loïc Hoguin
dd0fbab6b7
Add automatic ranged request handling for bytes units
Returning the atom auto instead of a callback informs Cowboy
that it needs to handle range requests automatically. This
changes the behavior so that the ProvideCallback function
is called and then Cowboy splits the data on its own and
sends the response without any other user involvement other
than defining the ranges_provided/2 callback.

This is a quick and dirty way to add range request support
to resources, and will be good enough for many cases including
for cowboy_static as it also works when the normal response
body is a sendfile tuple.
2018-11-11 13:57:26 +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
29043aa7b4
Add support for range requests (RFC7233) in cowboy_rest
This is currently undocumented but is planned to be documented
in the next version.
2018-11-07 18:55:06 +01:00
Loïc Hoguin
bdd324ec01
Fix unused type in cowboy_static 2018-11-05 17:33:00 +01:00
Loïc Hoguin
9d2b1a8892
Simplify the code that calls REST callbacks 2018-11-05 11:44:24 +01:00
Loïc Hoguin
805a156785
Test stop against all relevant REST callbacks 2018-11-05 10:30:26 +01:00
Loïc Hoguin
06f9f3714f
Test switch_handler against all relevant REST callbacks 2018-11-05 10:01:51 +01:00
Loïc Hoguin
8c9ad7bf07
Add the rate_limited/2 REST callback 2018-11-04 11:58:59 +01:00
Loïc Hoguin
bf7ccc8623
Add a test suite for RFC6585 2018-11-03 20:57:51 +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
f181e510b9
Remove the default charset iso-8859-1 in cowboy_rest
This requirement was removed in RFC7231 and the rationale
behind it was documented in RFC6657.
2018-11-02 14:01:29 +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
d4dff21055
Accept a broader media type as input in rest_pastebin example 2018-11-01 14:44:55 +01:00
Loïc Hoguin
b3bfcf068c
Add a cowboy_rest test for malformed if-*-match headers 2018-10-31 22:41:59 +01:00
Steve Domin
09bf1199aa
Add compress_threshold protocol option
Currently the compression threshold is set to 300 and hardcoded in the
codebase. There are cases where it make sense to allow this to be
configured, for instance when you want to enforce all responses to be
compressed regarldess of their size.
2018-10-31 17:05:11 +01:00
Loïc Hoguin
30e117a942
Make sure we don't send error_responses on the wrong stream 2018-10-31 15:35:49 +01:00
Grigory Starinkin
5ab5615ff0
Handle error_response command in cowboy_metrics_h 2018-10-31 15:13:23 +01:00
Loïc Hoguin
473e3fb82b
Improve a few types, including cowboy_req:req() 2018-10-31 14:11:45 +01:00
Loïc Hoguin
a8335c63df
Always dialyze tests and fix some cowboy_req specs 2018-10-31 10:50:57 +01:00
Loïc Hoguin
07078eb47b
Fix a test listener not being stopped 2018-10-31 09:25:19 +01:00
Loïc Hoguin
122faedc25
Initial support for the PROXY protocol header
Depend on Ranch master for now since it isn't in any release yet.
2018-10-30 23:30:54 +01:00
Loïc Hoguin
a002df4560
Fix the sys trap_exit tests
The processes go down slower now so that caused intermittent
issues.
2018-10-28 17:11:52 +01:00
Loïc Hoguin
e11279e0d2
Remove a useless todo 2018-10-28 13:12:17 +01:00
Loïc Hoguin
a764075b89
Rename a few functions and shuffle arguments 2018-10-28 11:47:49 +01:00
Loïc Hoguin
266178b6bc
Remove an unnecessary function 2018-10-28 11:42:18 +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
21ff3ff256
Fix small issues introduced in the previous commit 2018-10-27 10:07:34 +02:00
Loïc Hoguin
f1018fd1c1
Use cow_http2_machine's timer handling 2018-10-27 00:16:13 +02:00
Loïc Hoguin
7d118b547f
Use cow_http2:parse_sequence/1 2018-10-26 18:51:49 +02:00