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

387 commits

Author SHA1 Message Date
Loïc Hoguin
9f9bd5ef56
Add more sys tests 2018-03-27 00:58:15 +02:00
Loïc Hoguin
5964273cc4
Fix the flushing of messages when switching to Websocket
We now flush messages that are specific to cowboy_http only.

Stream handlers should also flush their own specific messages
if necessary, although timeouts will be flushed regardless
of where they originate from.

Also renames the http_SUITE to old_http_SUITE to distinguish
new tests from old tests. Most old tests need to be removed
or converted eventually as they're legacy tests from Cowboy 1.0.
2018-03-26 18:53:07 +02:00
Loïc Hoguin
4d5174632c
Add initial support for system messages in cowboy_loop 2018-03-23 18:33:16 +01:00
Loïc Hoguin
21c9c66971
Merge the two separate receive loops in cowboy_websocket
Also rename a bunch of functions to make the code easier to read.
2018-03-23 16:32:53 +01:00
Bartek Walkowicz
2131709328
Add case for handling infinity for idle/request_timeout
Currently cowboy assumes that idle_timeout or request_timeout is
a number and always starts timers. Similar situation takes place
in case of preface_timeout for http2. This commit adds case for
handling infinity as a timeout, allowing to not start mentioned
timers.
2018-03-14 17:15:06 +01:00
Loïc Hoguin
f9092126fa
Handle system messages in cowboy_websocket 2018-03-13 11:19:13 +01:00
Loïc Hoguin
b9c8d86502
Handle supervisor calls properly everywhere 2018-03-13 10:40:14 +01:00
Loïc Hoguin
a89732e8e0
Initial work on the sys_SUITE
There's already tests failing and quite some refactoring to be
done to make some things easier to test or fix issues.
2018-03-12 16:52:02 +01:00
Loïc Hoguin
e4f1c332a3
Add a test suite for RFC7538; update Cowlib to 2.2.0
This adds the 308 status code and fixes a few small
parsing bugs.
2018-03-05 16:48:56 +01:00
Loïc Hoguin
19054e40e0
Fix crash in cowboy_http2 when content-length is invalid 2018-02-28 16:18:29 +01:00
Loïc Hoguin
482de55a96
Fix a miscount of output flow control window for HTTP/2
The miscount occurred because of a faulty iolist split function.
The bug should now be corrected, a PropEr test has been added
and a regression test has also been added.
2018-01-23 16:14:18 +01:00
Loïc Hoguin
3a7b411143
Don't crash in delete_resp_header if no resp headers are set 2018-01-22 14:00:05 +01:00
Paul Fisher
82cd22a88b
Allow colon within path segments
Allow `cowboy_router:compile` to handle colon characters within
path segments, rather than exiting with `badarg`.  This is allowed
via RFC 7230 2.7 -> [RFC 3986 3.3](https://tools.ietf.org/html/rfc3986#section-3.3):

```
      segment       = *pchar
      segment-nz    = 1*pchar
      segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
                    ; non-zero-length segment without any colon ":"

      pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
```
2018-01-16 11:24:49 +01:00
Loïc Hoguin
eafca21198
Fix HTTP/1.1 pipelining
Cases where a request body was involved could sometimes
fail depending on timing. Also fix all of the old
http_SUITE tests.
2017-12-12 11:37:48 +01:00
Loïc Hoguin
01e13c0846
Fix how we require HTTP/1.0 from Gun in rfc7231_SUITE 2017-12-11 17:43:02 +01:00
Loïc Hoguin
17719a136d
Add the few remaining tests to the rfc7231 test suite 2017-12-08 20:38:31 +01:00
Loïc Hoguin
b000d53855
Add more rfc7231 tests and a new max_skip_body_length option
The option controls how much body we accept to skip for HTTP/1.1
connections when the user code did not consume the body fully.
It defaults to 1MB.
2017-12-07 22:33:52 +01:00
Loïc Hoguin
c2b813684e
Send a 426 when Websocket is required and client didn't upgrade 2017-12-06 17:31:32 +01:00
Loïc Hoguin
5269bf580b
Fix 408 not sending connection: close for HTTP/1.1
Also make sure the header is sent for all types of early_error
that result in the closing of the connection.
2017-12-06 16:30:30 +01:00
Loïc Hoguin
1f4c1e2c67
Add more rfc7231 tests 2017-12-06 14:38:27 +01:00
Loïc Hoguin
bc39b433bb
Properly handle OPTIONS * requests
Support for these was broken during the development
of Cowboy 2.0. It is now fixed and better handled
than it ever was.
2017-12-06 14:05:30 +01:00
Loïc Hoguin
2eb3e3f994
Also disable the TRACE method entirely 2017-12-06 10:54:23 +01:00
Loïc Hoguin
dd002b8141
Disable the CONNECT method completely
It's safer than allow it with the wrong behavior.
2017-12-06 00:30:59 +01:00
Loïc Hoguin
10dc2c2ef0
Add an rfc7231 test suite, fix an HTTP/2 bug with HEAD
In some cases there could be a body sent as a response to
a HEAD request when using HTTP/2. This has been corrected.
2017-12-04 18:21:10 +01:00
Loïc Hoguin
b0519af42a
Don't include a content-length in 204 responses 2017-11-29 21:38:10 +01:00
Loïc Hoguin
14b4afa669
Fix a test description 2017-11-29 18:07:38 +01:00
Loïc Hoguin
37d069cd51
Fix many rfc7230 tests that were echoing the URI 2017-11-29 18:07:23 +01:00
Loïc Hoguin
bec9a43d50
Fix a broken test case in the rfc7540 suite 2017-11-29 17:52:09 +01:00
Loïc Hoguin
bd6c32d3b7
Fix an intermittent test failure in the rfc7540 suite 2017-11-29 17:17:22 +01:00
Loïc Hoguin
1066a8d376
Remove two warnings in test suites 2017-11-29 17:03:16 +01:00
Loïc Hoguin
cf3ab5832a
Add nowarn_export_all to all test suites 2017-11-29 16:57:10 +01:00
Loïc Hoguin
73126e7693
Add many rfc7540 tests, improve detection of malformed requests 2017-11-29 14:54:47 +01:00
Loïc Hoguin
4cdd1aa70e
Add more flow control tests to rfc7540 and fix related issues 2017-11-27 22:49:50 +01:00
Loïc Hoguin
7f80ff28a5
Add more rfc7540 tests along with their respective fixes 2017-11-27 19:00:35 +01:00
Loïc Hoguin
bc82679330
Fix a few rfc7540 tests
Cowboy takes a few shortcuts to avoid wasting resources when
there is a protocol error. The RFC wants us to send a different
error depending on the state of the stream at the time of the
error, and for us to maintain the connection in cases where we
would have to spend valuable resources to decode headers. In
all these cases Cowboy will simply close the connection with
an appropriate error.
2017-11-27 13:42:04 +01:00
Loïc Hoguin
843b104fcb
Don't send the response immediately when using h2spec
In some cases we were sending a response faster than h2spec
was sending us the test case data, resulting in the request
being processed successfully instead of failing as expected.
2017-11-27 13:23:31 +01:00
Loïc Hoguin
e71733232e
Fix an rfc7230 test 2017-11-26 10:12:25 +01:00
Loïc Hoguin
7cd59f4367
Add more tests to the rfc7230 suite
A few more bugs detected. I'm at the end of the list. I need to
do a second reading, implement what I can, fix what I can and
then the suite should be complete.
2017-11-24 22:40:15 +01:00
Loïc Hoguin
aa453d4825
Add a few more rfc7230 tests
A few seems to highlight more bugs. They have no fix yet.
2017-11-24 19:08:49 +01:00
Loïc Hoguin
ce32e1985a
Add more tests to the rfc7230 suite
Found more bugs! Unfortunately no fix for them in this commit.
2017-11-24 00:16:19 +01:00
Loïc Hoguin
14173d5929
Move the pipeline test to the rfc7230 suite 2017-11-23 18:50:07 +01:00
Loïc Hoguin
c4e43ec26a
Add more rfc7230 tests and better handle bad chunk sizes
Bad chunk sizes used to be accepted and could result in
a badly parsed body or a timeout. They are now properly
rejected.

Chunk extensions now have a hard limit of 129 characters.
I haven't heard of anyone using them and Cowboy does not
provide an interface for them, but we can always increase
or make configurable if it ever becomes necessary (but
I honestly doubt it).

Also a test from the old http suite could be removed. Yay!
2017-11-22 23:10:00 +01:00
Loïc Hoguin
1af508c4cd
Add more rfc7230 tests and improve transfer-encoding
It's worth noting that transfer-encoding now takes precedence
over content-length as recommended by the RFC, so that when
both headers are sent we only care about transfer-encoding
and explicitly remove content-length from the headers.
2017-11-20 21:12:05 +01:00
Loïc Hoguin
3da9a6eef9
Add a test for early errors that occur on the request-line 2017-11-20 16:26:37 +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
62bf505d33
Add more rfc7230 tests
Also fixes the handling of the max_headers option for HTTP/1.1.
It is now a strict limit and not dependent on whether data is
already in the buffer.
2017-11-20 00:23:27 +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
f6539a9a68
Move tests from old http suite to rfc7230 suite 2017-11-19 22:04:48 +01:00
Loïc Hoguin
8be803cb07
The static suite's large file is not created on Windows 2017-11-19 16:13:48 +01:00