0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 04:30:25 +00:00
Commit graph

616 commits

Author SHA1 Message Date
Loïc Hoguin
e5a8088e68
Make the new cowboy_req tests more realistic 2017-01-04 19:45:35 +01:00
Johan Lövdahl
3f4e79d42f
Add functions for getting and setting response headers 2017-01-04 13:37:50 +01:00
Loïc Hoguin
42c95b1584
Rewrite the tests for header name/value limits
Putting them in the correct test suite, with the proper
documentation etc.
2017-01-03 18:07:39 +01:00
José Valim
f59c29dff0
Return status 431 if the request header field is too large
This commit changes Cowboy to follow RFC6585.
2017-01-03 17:47:23 +01:00
Loïc Hoguin
43adacc760
Welcome to 2017 2017-01-02 19:36:36 +01:00
Loïc Hoguin
ed664345d7
Add a few more test cases for cowboy_req:match_qs 2017-01-02 14:56:20 +01:00
Christopher Adams
59c32506c0
Fix if_modified_since match of last_modified
Correct expected return type from `no_call` to `undefined` in
if_modified_since when last_modified callback is not defined. Add an
http_SUITE test to catch regressions.
2016-10-18 10:43:47 +02:00
Loïc Hoguin
1d01d0fc06 Allow websocket_init/1 to reply/close/hibernate 2016-08-15 19:21:38 +02:00
Loïc Hoguin
af88442610 Modernize the Websocket test suite 2016-08-15 18:06:16 +02:00
Loïc Hoguin
d1b65a67cf Remove Req from the Websocket interface
After the switch to Websocket, we are no longer in a request/response
scenario, therefore a lot of the cowboy_req functions do not apply
anymore.

Any data required from the request will need to be taken from Req
in init/2 and saved in the handler's state.
2016-08-12 19:27:23 +02:00
Loïc Hoguin
e44ac98c83 Merge branch 'master' of https://github.com/camshaft/cowboy 2016-08-12 17:26:28 +02:00
Loïc Hoguin
97986df276 Fix Websocket compression
The option for enabling Websocket compression has been
renamed. Previously it was shared with HTTP compression,
now it's specific to Websocket. The new option is named
'websocket_compress'.
2016-08-12 16:56:08 +02:00
Loïc Hoguin
b75b0a6d4d Use integer_to_binary when possible 2016-08-11 11:53:05 +02:00
Loïc Hoguin
699164fbdd Add a test for echo_get example undefined 2016-08-11 11:48:09 +02:00
Loïc Hoguin
e2d5c268aa Fix timer-sent events in the websocket example 2016-08-11 11:06:03 +02:00
Loïc Hoguin
83aa3f1b9c Use binary_to_integer instead of to list and back 2016-08-10 17:50:28 +02:00
Loïc Hoguin
e30d120bd8 Make reply functions return Req 2016-08-10 17:15:02 +02:00
Loïc Hoguin
aa6f2ab5a4 Update the multipart reading interface
Now named read_part/read_part_body, with a verb indicating action.
2016-08-10 15:09:04 +02:00
Loïc Hoguin
3a057683af Add a lot of todos 2016-08-10 11:52:41 +02:00
Loïc Hoguin
ae0dd61673 Add tests for responses and request body reading
This is a large commit. The cowboy_req interface has largely
changed, and will change a little more. It's possible that
some examples or tests have not been converted to the new
interface yet. The documentation has not yet been updated.
All of this will be fixed in smaller subsequent commits.

Gotta start somewhere...
2016-08-10 11:49:31 +02:00
Cameron Bytheway
e09a856805 send resp_headers with websocket responses 2016-06-27 11:33:25 -06:00
Loïc Hoguin
0ba3a9a222 Add forgotten changes to a test handler 2016-06-22 13:10:33 +02:00
Loïc Hoguin
99a0e0fc46 Move TERM= declaration to make variable side 2016-06-22 13:09:27 +02:00
Loïc Hoguin
63c7d05eb2 Add tests for cowboy_req: match_cookies and match_qs 2016-06-22 09:27:29 +02:00
Loïc Hoguin
19468d0503 Add cowboy_req:uri/1,2
Along with more cowboy_req tests.

This commit also removes cowboy_req:url/1 and cowboy_req:host_url/1
in favor of the much more powerful new set of functions.
2016-06-21 19:04:52 +02:00
Loïc Hoguin
d9cad866f2 Add initial req suite 2016-06-20 17:31:31 +02:00
Loïc Hoguin
57901a7116 Fix upload example 2016-06-16 22:17:14 +02:00
Loïc Hoguin
43ccea87bc Fix rest_pastebin example 2016-06-15 13:27:31 +02:00
Loïc Hoguin
5003bae369 Fix eventsource example 2016-06-14 17:05:41 +02:00
Loïc Hoguin
84fb85e2e4 Fix cookie example 2016-06-14 16:23:51 +02:00
Loïc Hoguin
a55679b231 Fix rest_basic_auth example 2016-06-14 11:30:42 +02:00
Loïc Hoguin
a4fb56018e Fix websocket example 2016-06-13 18:10:33 +02:00
Loïc Hoguin
352cfce663 Fix markdown_middleware example 2016-06-13 17:35:26 +02:00
Loïc Hoguin
6f75598b70 Fix chunked_hello_world example 2016-06-13 16:26:00 +02:00
Loïc Hoguin
88227898ed Merge static_world and web_server examples
The new example is called file_server and it's basically
the same as web_server was. The name is clearer than the
original, all examples being "Web servers".

The new example is also tested and the test suite has
been refactored a little.
2016-06-13 13:26:24 +02:00
Loïc Hoguin
4293a40d9e Fix rest_hello_world example 2016-06-09 16:33:31 +02:00
Loïc Hoguin
4ced1d0994 Fix echo_post example 2016-06-08 23:35:02 +02:00
Loïc Hoguin
98323c2d72 Fix echo_get example 2016-06-08 20:18:09 +02:00
Loïc Hoguin
fd07b38952 Add a test suite that checks examples are working 2016-06-08 14:28:52 +02:00
Loïc Hoguin
e291c3bb94 Add the static_handler test suite 2016-06-06 17:41:26 +02:00
Loïc Hoguin
45158c1da4 Clarify comments about remaining tests to add to rfc7540_SUITE 2016-03-14 00:00:00 +01:00
Loïc Hoguin
3969c31824 Fix most remaining HTTP/2 handshake tests
One category of tests involving the SETTINGS ack still fails.
It is probably wise to leave these until more SETTINGS related
tests are written.
2016-03-13 23:14:57 +01:00
Loïc Hoguin
2620d65fde Fix more HTTP/2 handshake test cases 2016-03-13 11:26:26 +01:00
Loïc Hoguin
4e6a4ee53f Add initial HTTP/1.1 Upgrade to HTTP/2
The same edge cases that fail with other handshake methods
also fail here (mostly bad preface/timeouts stuff). In
addition, the HTTP2-Settings header contents are currently
not checked and so the related edge case tests also fail.
2016-03-12 18:25:35 +01:00
Loïc Hoguin
92edad53d2 Add the beginning of the rfc7540 test suite
Currently only testing handshake.

Tests that pass currently involve no request/response.
ALPN and prior knowledge support have some edge cases left to fix.
HTTP/1.1 Upgrade has not been implemented yet.
2016-03-10 23:30:49 +01:00
Loïc Hoguin
7bdd710849 Completely remove SPDY 2016-03-06 17:48:35 +01:00
Loïc Hoguin
b370442a63 Initial commit with connection/streams
Breaking changes with previous commit. This is a very large change,
and I am giving up on making a single commit that fixes everything.
More commits will follow slowly adding back features, introducing
new tests and fixing the documentation.

This change contains most of the work toward unifying the interface
for handling both HTTP/1.1 and HTTP/2. HTTP/1.1 connections are now
no longer 1 process per connection; instead by default 1 process per
request is also created. This has a number of pros and cons.

Because it has cons, we also allow users to use a lower-level API
that acts on "streams" (requests/responses) directly at the connection
process-level. If performance is a concern, one can always write a
stream handler. The performance in this case will be even greater
than with Cowboy 1, although all the special handlers are unavailable.

When switching to Websocket, after the handler returns from init/2,
Cowboy stops the stream and the Websocket protocol takes over the
connection process. Websocket then calls websocket_init/2 for any
additional initialization such as timers, because the process is
different in init/2 and websocket_*/* functions. This however would
allow us to use websocket_init/2 for sending messages on connect,
instead of sending ourselves a message and be subject to races.
Note that websocket_init/2 is optional.

This is all a big change and while most of the tests pass, some
functionality currently doesn't. SPDY is broken and will be removed
soon in favor of HTTP/2. Automatic compression is currently disabled.
The cowboy_req interface probably still have a few functions that
need to be updated. The docs and examples do not refer the current
functionality anymore.

Everything will be fixed over time. Feedback is more than welcome.
Open a ticket!
2016-03-05 20:20:42 +01:00
Alexey Lebedeff
b290b88a67 Use 'Connection' header only when necessary
Fixes #839 when 'Connection: Keep-Alive' wasn't sent in a HTTP/1.0
response. Now the usage of 'Connection' header is consistent with
current protocol version: when this header is not specified explicitly
in the response, HTTP/1.0 implies 'Connection: close' and HTTP/1.1
implies 'Connection: Keep-Alive'. So if current 'Connection' value
matches the default value of current protocol, we won't state obvious
fact in the response; and vice versa.

Amended to fix and improve tests, and revert the variable name
change from HTTP11Headers to StdHeaders. I think it's still good
to leave it as is because it's not really a standard header for
HTTP/1.0, and it's gone from HTTP/2 entirely.
2015-08-07 12:48:07 +02:00
Loïc Hoguin
3098986710 Fix autobahn test suite report link when used in CI 2015-07-22 23:57:57 +02:00
Loïc Hoguin
fe5acb20f1 Add autobahn test suite output to the console 2015-07-22 23:05:49 +02:00