Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
The Cowboy behavior has changed a little and gives more
accurate error responses now. And in some cases, successes.
|
|
|
|
|
|
|
|
|
|
They have equivalents in req_SUITE.
|
|
|
|
They are now cowboy:start_clear/3 and cowboy:start_tls/3.
The NumAcceptors argument can be specified via the
num_acceptor transport option. Ranch has been updated
to 1.4.0 to that effect.
|
|
Introduces the new stream_handler_SUITE test suite. More cases
will be added later on.
|
|
This option allows customizing the compacting of the Req object
when using Websocket. By default it will keep most public fields
excluding headers of course, since those can be large.
|
|
|
|
|
|
h2spec must be preinstalled on the machine and its location
pointed at by the H2SPEC environment variable.
|
|
Existing tests pass. A number of things remain to be done.
Has only been tested with Gun so far. Feedback welcome!
|
|
|
|
The inactivity timeout is used to close the connection in the absence of
any data from the client.
Since this is not part or the rfc7540 spec, a new http2_SUITE module has
been created with a test for the inactivity_timeout.
|
|
This fixes the connection being dropped because of request_timeout
despite there being some active streams.
|
|
|
|
|
|
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).
|
|
Maps make more sense because the keys are unique.
|
|
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.
|
|
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.
|
|
|
|
|
|
Also finish implementing the relevant test, getting rid of todos.
|
|
A bit late but at least removes a todo.
|
|
... 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`.
|
|
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).
|
|
Currently marked as experimental because it can't be tweaked
(just enabled/disabled) and because it is not documented yet.
|
|
|
|
|
|
Putting them in the correct test suite, with the proper
documentation etc.
|
|
This commit changes Cowboy to follow RFC6585.
|
|
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
|
|
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'.
|
|
|