Age | Commit message (Collapse) | Author |
|
|
|
It's been found slower than a custom equivalent to what we were
using it for. As this is the critical path we prefer the custom
solution.
|
|
|
|
We now obtain the peer address before creating the Req object.
If an error occurs, then something went wrong, we close the connection
nicely directly.
|
|
|
|
|
|
This behavior can be enabled with the `compress` protocol option.
See the `compress_response` example for more details.
All tests are now ran with and without compression for both HTTP
and HTTPS.
|
|
This changes the behavior of the `timeout` protocol option to
mean "Time in which the full request line and headers must be
received". The default of 5s should be fine for all normal uses.
This change has no noticeable impact on performance and is thus
enabled by default for everyone. It can be disabled by setting
`timeout` to `infinity` although that is definitely not encouraged.
Inspired by the contribution from @naryl on github.
|
|
Middlewares allow customizing the request processing.
All existing Cowboy project are incompatible with this commit.
You need to change `{dispatch, Dispatch}` in the protocol options
to `{env, [{dispatch, Dispatch}]}` to fix your code.
|
|
this change makes sure that once a request has been created
the error_terminate/3 function uses the original request instead
of making a new empty one with undefined values making the request
attributes easier to look at in many error cases
Conflicts:
src/cowboy_protocol.erl
|
|
|
|
The purpose of this patch is to make the arguments cowboy passes to
error_logger more consistent. With this patch there's only 3 variations
on the error_logger argument list; a 5 element list, an 8 element list
and a 10 element list. In all cases, the first 3 arguments are the
Module, Function and Arity of the function being called and the
second-to-last argument is always the Request. Additionally, for lists
longer than 5 elements, the last argument is always the stack-trace.
The added consistency of the argument ordering makes it much easier to
write code in lager's error_logger handler to catch these messages and
write a pretty one-liner (while writing the full message to the
crash.log).
|
|
|
|
|
|
|
|
like /%qq
|
|
We do not always provide the body however. It is not available
when using chunked replies, or when using set_resp_body_fun.
|
|
It is only enforced when Cowboy needs to wait for more data.
Also fix a few types and a few status codes.
|
|
|
|
This allows inconsistent behavior and is not used enough to be supported.
|
|
They should not be used unless you have a very special need,
which generally involves interacting with the internals of Cowboy.
|
|
* #state{} changes are avoided where possible
* #state{} is now smaller and use less memory
* the Req object is created only after the whole request is parsed
* parsing makes use of a single binary match context
* external calls are avoided in the critical path
* URL fragment is now extracted properly (retrieval API next commit)
* argument orders to local functions modified to avoid extra operations
* dispatching waits as long as possible before tokenizing host/path
* handler opts are no longer shown in the error messages except in init
The code may not look as beautiful as it was before. But it really
is, for parsing code. The parsing section of the file may be skipped
if your eyes start to burn.
|
|
This reduces the number of operations done each time the buffer changes.
|
|
|
|
The former is a BIF while the latter is not.
|
|
Header names are now binaries. Since header names are case insensitive
they are all converted to lowercase. For example: <<"content-length">>.
The max_line_length option was removed. Three new options have been
added instead:
* max_request_line_length (defaults to 4096)
* max_header_name_length (defaults to 64)
* max_header_value_length (defaults to 4096)
|
|
First step in making all methods and header names binaries to
get rid of many inconsistencies caused by decode_packet/3.
Methods are all binary now. Note that since they are case
sensitive, the usual methods become <<"GET">>, <<"POST">> and so on.
|
|
|
|
Originally suggested by Roberto Ostinelli.
|
|
|
|
This removes cowboy_protocol's dependency on http.hrl!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Private means you must not used it. It's meant for internal use.
|
|
More cleanup towards making cowboy_req:req() opaque.
|
|
Just more cleanup in order to have req() opaque.
|
|
The signature of parse_header, body_qs, multipart_data and
the set_resp_* functions has changed.
See the cowboy_req module edoc for more details.
|
|
There's no need for more complex logic now that we have
the API for it.
|
|
|
|
Removes a lot of duplicate code when printing error messages.
|
|
This removes cowboy_static's dependency on http.hrl.
|
|
|
|
The latter is much more useful than the former, which ends up
being removed.
|
|
The latter is much more useful than the former, which ends up
being removed.
|
|
|