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

63 commits

Author SHA1 Message Date
Loïc Hoguin
ecf3d43613
Improve reliability of a few tests
GitHub Actions runners are not as good as self-hosted BuildKite
so some adjustments need to be made to timeouts and such.
2024-01-17 20:56:46 +01:00
geeksilva97
308045fd67
Reject responses with explicit set-cookie header
LH: The tests received a lot of fixes and tweaking.
    I also reworded the error message to be more concise.
2024-01-15 17:43:14 +01:00
Loïc Hoguin
906a7ffc3c
Better error message when trying to reply twice
Also crash if trying to push after a reply was sent.
2024-01-09 13:06:11 +01:00
Loïc Hoguin
e4a78aaeb1
Document body reading in auto mode
It is now tested both via cowboy_req:read_body and
via cowboy_req:cast.

Removes a bad example from the guide of body reading
with period of infinity, which does not work.
2024-01-08 15:13:18 +01:00
Loïc Hoguin
deb2ec3931
Reduce CT logs size in a couple test cases 2023-12-01 10:45:41 +01:00
Loïc Hoguin
8093d716fa
Fix tests with serialised maps
The key order of serialised maps changed in OTP-26.
2023-03-30 15:39:13 +02:00
Loïc Hoguin
12108ab668
Fix TLS tests for OTP-26+
ct_helper now uses the test certificates generated by
public_key. A few adjustments had to be made as a result.
2023-03-30 15:38:29 +02:00
Loïc Hoguin
4958af5745
Update Cowlib to 2.12.1 2023-03-29 15:20:48 +02:00
Loïc Hoguin
03d306e6d1
Fix concurrent body streaming getting stuck with HTTP/2 2020-07-03 11:02:59 +02:00
Loïc Hoguin
0d0e7d164c
Increase the timetrap timeout in req_SUITE on Windows
Still seeing intermittent failures on Windows due to
timetrap so let's see if doubling the timeout again helps.
2020-04-08 10:28:27 +02:00
Loïc Hoguin
5203ee6a84
Increase the req_SUITE timetrap timeout on Windows
The local network is much slower so the tests take longer there.
2020-04-06 12:27:41 +02:00
Loïc Hoguin
962d715ad4
Make req_SUITE:read*_body_urlencoded_too_long tests reliable 2020-04-02 15:46:38 +02:00
Loïc Hoguin
0143d9e5a9
Use infinity timeout for gun:await* calls in req_SUITE 2020-04-02 14:57:10 +02:00
Loïc Hoguin
789768e8d3
Rework the req_SUITE:read_body_period test
To avoid intermittent test failures. We only want to make
sure the function eventually returns so we don't need to
use timeouts in the test itself, or check exactly what was
read.
2020-04-02 14:01:26 +02:00
Loïc Hoguin
2b65b575c6
Change a few flaky tests to use timetrap and infinity timeouts
The experiment was successful in Gun, let's see if it helps
with Cowboy as well.
2020-04-01 21:11:59 +02:00
Loïc Hoguin
bcef70818b
Fix the req_SUITE:parse_cookie test
We now allow spaces in cookie names.
2020-03-30 17:46:42 +02:00
Tony Han
43f1754f33
Test trailers bug when there are data frames in queue 2019-12-31 11:06:31 +01:00
Loïc Hoguin
03dac1486d
Add cowboy_req:filter_cookies/2 2019-10-05 11:23:57 +02:00
Loïc Hoguin
eaa052616f
Ensure we can stream the response body from any process 2019-10-02 20:30:32 +02:00
Loïc Hoguin
20660d7566
Ensure we can read the request body from any process 2019-10-02 19:12:05 +02:00
Loïc Hoguin
e1d4524118
Update gun_down messages in test suites 2019-10-02 10:10:43 +02:00
Loïc Hoguin
d143235a79
Fix closing of connection on response_body_too_small 2019-09-16 11:34:51 +02:00
Loïc Hoguin
8452df0617
Split up urlencoded tests to speed up req_SUITE 2019-09-15 21:49:45 +02:00
Loïc Hoguin
da5487b5a3
Skip req_SUITE:read_body_mtu on Windows
On Windows the loopback MTU seems to be set to 0xFFFFFFFF
(basically no limit) which makes the test irrelevant.
2019-09-15 21:34:14 +02:00
Loïc Hoguin
2888e9e6ef
Increase the period for req_SUITE:read_body_period
This should increase the likelihood of the test succeeding
on slower systems when run over TLS.
2019-09-15 16:30:09 +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
36836594f8
Fix tests failing following Gun update to master 2019-09-06 15:37:42 +02:00
Loïc Hoguin
86c16fdccc
Rename Gun's transport_opts to tls_opts 2019-09-06 13:33:15 +02: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
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
4b385749f2
Add cowboy_req:read_and_match_urlencoded_body/2,3 2018-09-07 13:56:12 +02:00
Loïc Hoguin
0fb68ec07f
Add test cases for cowboy_req:stream_events 2018-06-27 13:40:11 +02:00
Eric Meadows-Jönsson
f08f4610a0
Add streaming without chunking for HTTP/1.1
If content-length is set in the response headers
we can skip chunked transfer-encoding.
2018-06-25 11:44:38 +02:00
Loïc Hoguin
3d35319112
Remove/convert tests about request body from old_http_SUITE 2018-05-17 16:23:33 +02:00
Loïc Hoguin
827bd8c1c9
Increase a timeout to make some slower tests pass 2018-05-16 14:04:58 +02:00
Loïc Hoguin
d732e74dd5
Use default port when not given in :authority 2018-05-16 10:42:25 +02:00
Loïc Hoguin
cf3ab5832a
Add nowarn_export_all to all test suites 2017-11-29 16:57:10 +01:00
Loïc Hoguin
92672b49af
Queue HTTP/2 trailers when there's still data in the buffer 2017-11-20 15:46:23 +01:00
Loïc Hoguin
9969684035
Improve trailers test when no te header is sent 2017-11-20 12:17:44 +01:00
Loïc Hoguin
d7761b5259
Remove another test from the old http suite 2017-11-19 22:17:57 +01:00
Loïc Hoguin
39baed6c80
Add preliminary support for trailers in responses
This depends on changes in Cowlib that are only available on
master.
2017-11-15 14:58:49 +01:00
Loïc Hoguin
83bd8bc935
Fix two edge cases for cowboy_req:stream_body
Sending data of size 0 with the fin flag set resulted in nothing
being sent to the client and still considering the response to
be finished for HTTP/1.1.

For both HTTP/1.1 and HTTP/2, the final chunk of body that is
sent automatically by Cowboy at the end of a response that the
user did not properly terminate was not passing through stream
handlers. This resulted in issues like compression being incorrect.

Some tests still fail under 20.1.3. They are due to recent zlib
changes and should be fixed in a future patch release. Unfortunately
it does not seem to be any 20.1 version that is safe to use for
Cowboy, although some will work better than others.
2017-11-01 15:33:10 +00:00
Loïc Hoguin
217fac7f44
Handle expect: 100-continue request headers
The 100 continue response will only be sent if the client
has not sent the body yet (at all), if the connection is
HTTP/1.1 or above and if the user has not sent it yet.

The 100 continue response is sent when the user calls
read_body and it is cowboy_stream_h's responsibility
to send it. This means projects that don't use the
cowboy_stream_h stream handler will need to handle the
expect header themselves (but that's okay because they
might have different considerations than normal Cowboy).
2017-10-30 16:21:25 +00:00
Loïc Hoguin
f3d6b05b86
Add cowboy_req:inform/2,3
User code can now send as many 1xx responses as necessary.
2017-10-29 21:03:04 +00:00
Loïc Hoguin
ef58e15547
Introduce cowboy_req:sock/1 and cowboy_req:cert/1
To obtain the local socket ip/port and the client TLS
certificate, respectively.
2017-10-25 21:03:26 +01:00
Jeffrey Griffin
6460e9d2d2
Fix infinite loop on incomplete multipart body
I have amended a lot of changes from the original commit
to make it behave as expected, including returning a 400
error. LH
2017-10-02 13:28:43 +02:00
Loïc Hoguin
fda2d150db
Fix error response when constraint validation fails 2017-09-27 16:20:38 +02:00
Loïc Hoguin
3cbf885961
Improve how we detect request errors
When the request process exits with a {request_error, Reason, Human}
exit reason, Cowboy will return a 400 status code instead of 500.
Cowboy may also return a more specific status code depending on
the error. Currently it may also return 408 or 413.

This should prove to be more solid that looking inside the stack
trace.
2017-09-14 13:42:17 +02:00
Loïc Hoguin
9f5a1803da
Add tests for direct Req access 2017-09-05 15:28:11 +02:00
Loïc Hoguin
4fd6e2f7cd
Accept sendfile tuple with 0 length in cowboy_req
This will result in no data being sent. It's simply easier to
do this than to have to handle 0 size cases in user code.
2017-09-04 20:48:07 +02:00