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

1481 commits

Author SHA1 Message Date
Loïc Hoguin
b403f26da6
Remove an outdated todo comment 2017-04-18 16:36:03 +02:00
Loïc Hoguin
b7210d6d1a
Get rid of stray messages when killing HTTP/2 request processes 2017-04-18 16:33:41 +02:00
Loïc Hoguin
061cc227b1
Make the default 204 response go through stream handlers 2017-04-18 16:07:01 +02:00
Loïc Hoguin
6e8b907ae2
Pass the HTTP/2 switch_protocol event to stream handlers
To accomplish this the code for sending the 101 response was
moved to the cowboy_http2 module.
2017-04-18 14:06:34 +02:00
Loïc Hoguin
3633bceac5
Add more RFCs to the specs list 2017-04-18 12:35:45 +02:00
Loïc Hoguin
c2beff7126
Initial cowboy_stream manual 2017-04-10 16:37:01 +02:00
Loïc Hoguin
10dfd8c910
Add the early_error cowboy_stream callback
This callback is called when an error occurs before the request
(including headers, excluding body) was fully received. The
init/3 callback will not be called. The callback receives the
partial Req object (possibly empty), the reason for the error
and the response command that the server will send. It allows
you to be aware of the error and possibly modify the response
before it is sent.
2017-03-27 10:26:13 +02:00
Loïc Hoguin
14a01f71cb
Add a guide chapter linking to all specs 2017-03-20 14:21:42 +01:00
Loïc Hoguin
0d81dc04f1
Add more HTTP/2 tests for RFC7540 4.1 and 4.3 2017-03-02 19:35:24 +01:00
Loïc Hoguin
bb83a6ce33
Unknown HTTP/2 frames are ignored 2017-02-26 13:24:15 +01:00
Loïc Hoguin
a3636adcac
Add many test cases covering RFC7540 4.2
These tests cover frame sizes. It's mostly edge cases for sure
(ie misbehaving clients and us having to reject them properly).
I had these almost ready for a long time, so I'm glad I can
push them out.

This requires updating Cowlib too (we currently track master).
2017-02-25 20:05:31 +01:00
Loïc Hoguin
2af0506d51
Remove another useless todo 2017-02-19 16:52:04 +01:00
Loïc Hoguin
9255cdf1d7
Change the type of bindings from a list to a map
Maps make more sense because the keys are unique.
2017-02-19 16:51:16 +01:00
Loïc Hoguin
91ae70b06c
Change the order of set_resp_cookie arguments
The Opts value is put last, to be more consistent with the
rest of the cowboy_req module.

Additionally a test handler was fixed which reduced the number
of errors in http_SUITE.
2017-02-19 09:46:11 +01:00
Loïc Hoguin
87a05a1219
Change the type of cookie name to binary()
The API will be more consistent like this, and we can ensure
that duplicate cookie names are never sent.
2017-02-19 00:41:54 +01:00
Loïc Hoguin
d8cdd9bd15
Update version to 2.0.0-pre.7 2017-02-18 21:01:15 +01:00
Loïc Hoguin
c55db9a8ff
Ensure Websocket errors result in a crash log 2017-02-18 20:21:02 +01:00
Loïc Hoguin
c4ed8e2a37
Erlang/OTP 19.2.3 2017-02-18 19:15:45 +01:00
Loïc Hoguin
a45813c60f
Allow passing options to sub protocols
Before this commit we had an issue where configuring a
Websocket connection was simply not possible without
doing magic, adding callbacks or extra return values.
The init/2 function only allowed setting hibernate
and timeout options.

After this commit, when switching to a different
type of handler you can either return

  {module, Req, State}

or

  {module, Req, State, Opts}

where Opts is any value (as far as the sub protocol
interface is concerned) and is ultimately checked
by the custom handlers.

A large protocol like Websocket would accept only
a map there, with many different options, while a
small interface like loop handlers would allow
passing hibernate and nothing else.

For Websocket, hibernate must be set from the
websocket_init/1 callback, because init/2 executes
in a separate process.

Sub protocols now have two callbacks: one with the
Opts value, one without.

The loop handler code was largely reworked and
simplified. It does not need to manage a timeout
or read from the socket anymore, it's the job of
the protocol code. A lot of unnecessary stuff was
therefore removed.

Websocket compression must now be enabled from
the handler options instead of per listener. This
means that a project can have two separate Websocket
handlers with different options. Compression is
still disabled by default, and the idle_timeout
value was changed from inifnity to 60000 (60 seconds),
as that's safer and is also a good value for mobile
devices.
2017-02-18 18:26:20 +01:00
Loïc Hoguin
80f8cda7ff
Remove or fix a small number of todo comments
One had the todo text fixed, another had the task to do done.
2017-02-05 20:45:36 +01:00
Loïc Hoguin
1504c60c89
Add test for the compress_response example 2017-02-05 17:32:03 +01:00
Loïc Hoguin
61d66a4de2
Remove outdated todo comments from req_SUITE 2017-02-05 17:12:29 +01:00
Loïc Hoguin
182f824138
Erlang/OTP 19.2.2 and 18.3.4.5 2017-02-05 15:10:26 +01:00
Loïc Hoguin
98c614ee0b
Add missing human-readable errors for HTTP/1.1 2017-02-05 15:10:00 +01:00
Loïc Hoguin
4cbdfdd293
Fix sending of large files with HTTP/2
Also finish implementing the relevant test, getting rid of todos.
2017-02-05 13:45:35 +01:00
Loïc Hoguin
f4fddbd0a1
Test Websocket protocol version 7
A bit late but at least removes a todo.
2017-02-05 11:27:54 +01:00
Jean-Sébastien Pédron
d8d7838a77
examples_SUITE: Query system to find GNU Make executable
... instead of hard-coding "make".

First, we check the value of `$MAKE`. If it's unset, we look for `gmake`
in the `$PATH`. If it's missing, we assume it's `make`.

This fixes the testsuite where GNU Make is installed as `gmake`.
2017-01-24 11:40:52 +01:00
Jean-Sébastien Pédron
2166733628
cowboy_static: Add support for files in EZ archives
If cowboy_static is initialized with `{priv_file, ...}` or `{priv_dir,
...}`, it is now able to read files from Erlang application .ez
archives.

When serving a file from an archive, the #file_info{} comes from the
archive, not the contained file, except for the size and type. The
erl_prim_loader module is used to read the latter's #file_info{} and the
actual file content (ie. sendfile(2) is not used in this case).
2017-01-24 11:36:58 +01:00
Loïc Hoguin
3c198f7d90
Fix and update the compress example to use cowboy_compress_h 2017-01-22 20:17:52 +01:00
Loïc Hoguin
413196ace1
Erlang/OTP 19.2.1 2017-01-22 15:52:46 +01:00
Loïc Hoguin
3e05ab8f82
Add experimental cowboy_compress_h stream handler
Currently marked as experimental because it can't be tweaked
(just enabled/disabled) and because it is not documented yet.
2017-01-22 10:50:39 +01:00
Loïc Hoguin
3b91523a3c
Fix error responses not including a content-length
This would prevent the client from knowing whether the request
was received fully without the connection closing first.
2017-01-20 16:06:27 +01:00
Loïc Hoguin
353dc29d8f
Fix protocol breaking when user tries to send empty chunk
The {data, IsFin, Data} uses IsFin to indicate whether this
is the last chunk, while chunked transfer-encoding uses the
length of Data, and ends when it is 0. We must therefore not
send chunks with empty data.
2017-01-20 15:16:50 +01:00
Loïc Hoguin
0f8452cafa
Add support for multiple stream handlers
The stream handlers can be specified using the protocol
option 'stream_handlers'. It defaults to [cowboy_stream_h].

The cowboy_stream_h module currently does not forward the
calls to further stream handlers. It feels like an edge
case; usually we'd want to put our own handlers between
the protocol code and the request process. I am therefore
going to focus on other things for now.

The various types and specifications for stream handlers
have been updated and the cowboy_stream module can now
be safely used as a behavior. The interface might change
a little more, though.

This commit does not include tests or documentation.
They will follow separately.
2017-01-16 14:36:33 +01:00
Loïc Hoguin
e5a8088e68
Make the new cowboy_req tests more realistic 2017-01-04 19:45:35 +01:00
Loïc Hoguin
f34ef2ceae
Improve the manual for the new resp_header functions 2017-01-04 19:21:23 +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
1048bff929
Update rebar.config 2017-01-03 12:15:42 +01:00
Loïc Hoguin
c5a9771ac4
Remove ROADMAP file
The only ROADMAP now is small fixes toward making it stable
and very little interface changes, so the file is not that
useful anymore.
2017-01-02 19:42:47 +01:00
Loïc Hoguin
43adacc760
Welcome to 2017 2017-01-02 19:36:36 +01:00
Loïc Hoguin
fac882164c
Update Erlang.mk 2017-01-02 19:28:48 +01:00
Loïc Hoguin
0e2bd04cc9
Update README 2017-01-02 19:28:11 +01:00
Loïc Hoguin
2dff25a61d
Remove AUTHORS file
Information can be found in cgit.
2017-01-02 19:27:50 +01:00
Loïc Hoguin
309780a9fd
Remaining Dialyzer fixes 2017-01-02 18:27:03 +01:00
Loïc Hoguin
637706ff1f
Update Ranch to 1.3.0 2017-01-02 16:47:54 +01:00
Loïc Hoguin
e10daf39fa
Numerous Dialyzer fixes 2017-01-02 16:47:16 +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
Loïc Hoguin
271e31c629
Various fixes and tweaks to the user guide 2017-01-02 14:46:19 +01:00