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

616 commits

Author SHA1 Message Date
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
Tony Han
22cc88bae4
Add a zero-length DATA frame in the lingering_data test 2019-07-26 10:05:30 +02:00
Tony Han
7708fc77cd
Data received after RST_STREAM counts toward window 2019-07-16 15:32:58 +02:00
Fredrik Enestad
7ff9e963b8
Fallback to host header if authority is missing 2019-04-01 15:04:33 +02:00
Loïc Hoguin
705fa9755f
Add a cowboy_static test with an uppercase filename/extension 2019-04-01 15:04:33 +02:00
Loïc Hoguin
b9d329c026
Don't error out when h2spec can't be compiled 2019-03-10 11:21:51 +01:00
Loïc Hoguin
6f1a541fa2
Improve the reliability of some http_SUITE tests 2018-11-22 12:18:00 +01:00
Loïc Hoguin
3f5af49cfd
Fix compress buffering tests before OTP 20.1 2018-11-22 10:41:02 +01:00
Loïc Hoguin
0223f69fcd
Move the final old HTTP suite tests and remove it 2018-11-22 00:12:18 +01:00
Loïc Hoguin
037b286aa8
Move many old HTTP test cases to the rest_handler test suite
A bug was fixed in cowboy_rest where when content_types_provided
returned a media type with a wildcard as first in the list, and
a request comes in without an accept header, then the media_type
value in the Req object would contain '*' instead of [] for the
parameters.
2018-11-21 18:39:59 +01:00
Loïc Hoguin
800a489009
Move a old HTTP test cases to new plain_handler test suite 2018-11-21 14:29:36 +01:00
Loïc Hoguin
bbc152ba83
Rename sec_SUITE to security_SUITE 2018-11-21 14:21:14 +01:00
Loïc Hoguin
84e474d212
Move one more old HTTP test case 2018-11-21 14:06:57 +01:00
Loïc Hoguin
dc52ebe440
Move some more tests out of the old HTTP test suite 2018-11-21 13:28:20 +01:00
Loïc Hoguin
112ff607a1
Create a security test suite based on old HTTP test cases 2018-11-21 12:25:47 +01:00
Loïc Hoguin
6058800abb
Move another test from the old HTTP test suite 2018-11-21 10:47:31 +01:00
Loïc Hoguin
dc240adc1e
Move some tests out of the old HTTP test suite
And additional minor tweaks.
2018-11-21 10:25:01 +01:00
Loïc Hoguin
9e852b4dd2
Move HTTP/1.0 tests from the old test suite to rfc7230 2018-11-20 23:10:51 +01:00
Loïc Hoguin
18ba3c7cff
Silence expected warnings for messages from unknown processes 2018-11-20 16:25:11 +01:00
Loïc Hoguin
2915c6d98c
Silence the expected set_env_missing error 2018-11-20 16:24:56 +01:00
Loïc Hoguin
36debe707a
Increase a few more timeouts to reduce intermittent failures 2018-11-20 15:05:40 +01:00
Loïc Hoguin
1a1fb95f56
Fix the request_timeout_infinity test
Wrong option was being tested.
2018-11-20 13:26:02 +01:00
Loïc Hoguin
7b5da29019
Don't run long test suites by default
The examples test suite is only useful once in a while
in order to know whether examples were broken, for example
before issuing a release.

The new ws_autobahn test suite isolates the autobahn test
suite so that it can be ignored by default. It's only
useful to run it when working on the Websocket code or
before issuing a release.
2018-11-20 13:23:59 +01:00
Loïc Hoguin
386df43ea4
Handle a test case sometimes sending a response too fast 2018-11-20 11:28:46 +01:00
Loïc Hoguin
ff674fe6e8
Wait for the connection to be up in a few tests 2018-11-20 11:28:25 +01:00
Loïc Hoguin
d12e0b55dc
Increase a test timeout to get rid of intermittent failures 2018-11-20 10:45:14 +01:00
Loïc Hoguin
031b421732
Fix case insensitive filesystems in static_handler test suite 2018-11-19 19:45:47 +01:00
Loïc Hoguin
66fd122c08
Silence expected errors from the stream_handler test suite 2018-11-19 12:37:39 +01:00
Loïc Hoguin
ae96aa6e49
Add an additional test to the static test suite 2018-11-19 12:24:28 +01:00
Loïc Hoguin
84aea5d24d
Silence expected errors from the static_handler test suite 2018-11-19 12:15:40 +01:00
Loïc Hoguin
d2f367fba3
Use try..after in tests that start their own listeners 2018-11-19 09:29:21 +01:00
Loïc Hoguin
bed328b6c9
Use ?FUNCTION_NAME instead of ct_helper:name()
Cowboy is 19+ so it's OK to use it.
2018-11-19 09:05:34 +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
8185d356c5
Add the idle_timeout option to HTTP/2 2018-11-16 16:30:57 +01:00
Loïc Hoguin
f5015cb14b
Add the set_options Websocket command
It allows overriding the idle_timeout option only for now.
2018-11-16 13:49:00 +01:00
Loïc Hoguin
75045637fc
Ensure unknown options are ignored in set_options command 2018-11-16 13:09:01 +01:00
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
6f57405b5c
Allow disabling keep-alive for HTTP/1.0 connections 2018-11-14 18:04:32 +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
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