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

2198 commits

Author SHA1 Message Date
Boris Pozdnyakov
e200272178
Reject invalid Connection header
LH: Small tweaks and added an HTTP/1.0 test.
2023-12-15 17:12:37 +01:00
Loïc Hoguin
1547e9b93e
Increase loop_handler_timeout timeouts
It seems that macOS GH runners don't do timeouts well.
2023-12-15 16:22:06 +01:00
jdamanalo
a81dc8af9d
Add timeout to cowboy_loop
LH: I have added a test that does both hibernate and timeout
    and fixed a related issue. I also tweaked the docs and tests.
2023-12-15 15:37:34 +01:00
Loïc Hoguin
a72bf4105f
Fix static_handler suite code path
A future OTP release will use 'strict' code path by default.
This change ensures it works both for old and new OTP.
2023-12-15 10:35:37 +01:00
Loïc Hoguin
67bd791dcc
Change send_timeout_close test to accomodate macOS 2023-12-14 15:25:25 +01:00
Loïc Hoguin
efb681d749
Handle socket errors in HTTP/1.1 and HTTP/2
Doing so will let us notice when the connection is gone instead
of waiting for timeouts, at least in the cases where the remote
socket was closed properly. Timeouts are still needed in case
of TCP half-open problems.

This change means that the order of stream handler commands is
more important than before because socket errors may occur
during the processing of commands.
2023-12-12 15:05:33 +01:00
Sergei Shuvatov
3f5f326b73
Add test for send_timeout_close
LH: I reworked the test a little and added the same test
for HTTP/2 so that both HTTP/1.1 and HTTP/2 get the issue
fixed.
2023-12-12 15:05:01 +01:00
Loïc Hoguin
0ce9696e5e
Note that we won't implement the HTTP/2 PRIORITY mechanism 2023-12-07 16:45:30 +01:00
Loïc Hoguin
6bc6100bbd
Fix position of rate_limited/2 callback in REST workflow guide 2023-12-07 16:11:50 +01:00
lin
4f26d6a573
Add UTF-8 support to example file_server
LH: I have fixed issues in the PR and incorporated changes
from a sister PR by @djankovic (git author: Dom J). I also
made sure the UTF-8 files were readable without Chinese
fonts and added their downloading to the examples test suite.
2023-12-07 15:31:11 +01:00
Loïc Hoguin
32594a5199
Fix Websocket subprotocol example 2023-12-07 14:17:13 +01:00
Anatolii Kosorukov
4907734a83
Fix echo_post example
Fix input parameter of `cowboy_req:reply` function.
2023-12-07 13:16:09 +01:00
Kian-Meng, Ang
b12b4300ba
Fix typos in documentation 2023-12-06 18:46:56 +01:00
Maria Scott
a93ac120f4
Remove official IRC channel 2023-12-06 12:46:40 +01:00
Viktor Söderqvist
42d87dd776
Add 'max_cancel_stream_rate' config for the rapid reset attack
Co-authored-by: Björn Svensson <bjorn.a.svensson@est.tech>
2023-12-06 12:41:58 +01:00
Loïc Hoguin
879a6b8bc5
Remove unneeded Makefile variables 2023-12-04 11:11:54 +01:00
Loïc Hoguin
ca6477af7b
Use init_per_suite instead of all/0 for init in tracer_SUITE 2023-12-01 15:46:23 +01:00
Loïc Hoguin
521266326d
Don't dialyze the tests by default 2023-12-01 11:08:01 +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
d64ac25e92
Use GitHub actions for testing Cowboy
Now tested against OTP-24+.
Erlang.mk has been updated as well.
2023-12-01 10:00:33 +01:00
Loïc Hoguin
b2a16a2ee6
Don't force verify client cert in tests
This makes req_SUITE's cert_undefined test work again.
2023-11-23 15:09:06 +01:00
Loïc Hoguin
22adc4de51
Fix Ranch link in user guide 2023-05-02 11:20:02 +02:00
Loïc Hoguin
9e600f6c1d
Cowboy 2.10.0 2023-04-28 10:41:18 +02:00
Loïc Hoguin
326939c8a8
We are not using erl_make_certs anymore 2023-03-30 16:38:08 +02: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
251e70b219
Fix OTP-26+ warnings in test suites 2023-03-30 10:35:08 +02:00
Loïc Hoguin
4958af5745
Update Cowlib to 2.12.1 2023-03-29 15:20:48 +02:00
Loïc Hoguin
b9d4e05be0
Fix tests for OTP-25+ 2023-03-29 15:17:09 +02:00
Loïc Hoguin
30ee75cea1
Update Erlang.mk 2022-09-19 14:17:37 +02:00
Loïc Hoguin
105edf1d6e
Fix data sent after RST_STREAM in HTTP/2 in rare cases 2022-09-19 14:10:32 +02:00
Loïc Hoguin
137e86de7b
Update LICENSE copyright year 2022-07-12 16:38:41 +02:00
Loïc Hoguin
2a08250499
Add Hex metadata 2021-05-12 12:04:03 +02:00
Loïc Hoguin
04ca4c5d31
Cowboy 2.9.0 2021-05-12 10:24:40 +02:00
Loïc Hoguin
136e74fc51
Two more HTTP specs 2021-04-24 16:31:29 +02:00
Loïc Hoguin
880c72ef99
Cowlib 2.11.0 and Ranch 1.8.0 2021-04-24 16:31:14 +02:00
Martin Björklund
8795233c57
AcceptCallback may now return created/see_other tuples for POST
They replace and deprecate the {true,URI} return value.
2020-11-27 16:17:43 +01:00
Sebastian Strollo
63a6b86fba
Also include trace messages when timestamp flag isn't used 2020-11-27 16:02:54 +01:00
Simon Johansson
f6049b85a3
Use functions for inititalizing rate limiting
... to ensure that the same values are used in all places.
2020-11-27 15:51:09 +01:00
Viktor Söderqvist
059d58d39f
Graceful shutdown
Note: This commit makes cowboy depend on cowlib master.

Graceful shutdown for HTTP/2:

1. A GOAWAY frame with the last stream id set to 2^31-1 is sent and a
   timer is started (goaway_initial_timeout, default 1000ms), to wait
   for any in-flight requests sent by the client, and the status is set
   to 'closing_initiated'. If the client responds with GOAWAY and closes
   the connection, we're done.
2. A second GOAWAY frame is sent with the actual last stream id and the
   status is set to 'closing'. If no streams exist, the connection
   terminates. Otherwise a second timer (goaway_complete_timeout,
   default 3000ms) is started, to wait for the streams to complete. New
   streams are not accepted when status is 'closing'.
3. If all streams haven't completed after the second timeout, the
   connection is forcefully terminated.

Graceful shutdown for HTTP/1.x:

1. If a request is currently being handled, it is waited for and the
   response is sent back to the client with the header "Connection:
   close". Then, the connection is closed.
2. If the current request handler is not finished within the time
   configured in transport option 'shutdown' (default 5000ms), the
   connection process is killed by its supervisor (ranch).

Implemented for HTTP/1.x and HTTP/2 in the following scenarios:

* When receiving exit signal 'shutdown' from the supervisor (e.g. when
  cowboy:stop_listener/3 is called).
* When a connection process is requested to terminate using
  sys:terminate/2,3.

LH: Edited tests a bit and added todos for useful tests to add.
2020-11-27 15:38:21 +01:00
Loïc Hoguin
fa9c8ad832
Use gun:ws_send/3 in tests 2020-11-23 11:02:01 +01:00
Loïc Hoguin
e12d7bbe21
Don't produce an error report for normal stream process exits 2020-11-23 11:02:01 +01:00
Loïc Hoguin
c47f1e5fb8
Update Erlang.mk 2020-10-07 13:44:24 +02:00
Thomas Sciaroni
70d393caad
Minor grammar corrections
Verb agreement error "The request process executes
middlewares which, by default, including the router
and then the execution of handlers." -> "The request
process executes middlewares. By default, the request
process executes the router and then the handlers."

Adverbial clause at beginning of sentence needs comma
"By default Cowboy comes..." -> "By default, Cowboy comes..."
2020-08-19 14:37:50 +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
5aac00d60c
Tweak a sentence in the guide
Thanks Tamir Halperin for pointing this out.

[skip ci]
2020-07-01 13:55:58 +02:00
Loïc Hoguin
de955079f9
Fix the cowboy_req:inform/3 example in the manual 2020-05-28 21:07:20 +02:00
Loïc Hoguin
3eec447960
Remove jQuery, cleanup Websocket example a bit 2020-05-23 11:00:17 +02:00
Loïc Hoguin
8d5628c5f1
Cowboy 2.8.0 2020-05-21 19:02:12 +02:00
Loïc Hoguin
39b2816255
204 and 304 responses must not include a body
When calling cowboy_req:reply/4 with a body a crash will occur
resulting in a 500 response. When calling cowboy_req:stream_reply/2,3
and then attempting to send a body a crash will occur.
2020-05-20 13:41:05 +02:00