Age | Commit message (Collapse) | Author |
|
|
|
|
|
Regardless of whether a location header has been set, as explained
in the HTTP RFC.
|
|
|
|
Thanks Richard Carlsson for the remainder.
|
|
|
|
|
|
This is an undocumented workaround to disable chunks when using HTTP/1.1.
It can be used when the client advertises itself as HTTP/1.1 despite not
understanding the chunked transfer-encoding.
Usage can be found looking at the test for it. When activated, Cowboy
will still advertise itself as HTTP/1.1, but will send the body the same
way it would if it was HTTP/1.0.
|
|
* Parsing code was moved to cowlib: cowboy_qs:parse_qs/1
* A function was added to build query strings: cowboy_qs:qs/1
* Also added cowboy_qs:urlencode/1 and cowboy_qsurldecode/1
|
|
Changes include:
* Much simplified route configuration.
* Etag generation is now enabled by default.
* Web mimetypes are now detected by default. A bigger list of
mimetypes can be detected without any additional library.
* Mimetypes can no longer be specified as a list. Copying this
list for new connections is too costy. You can easily convert
it into a function and pass that function to the handler instead.
* You can however specify a single hardcoded mimetype. Mostly
useful when serving a single file, like an index.html file,
to avoid extra operations.
* Specifying a path as a list of tokens is not possible anymore.
Use either a binary or a string.
* Using a private directory will not work if the application
was not started properly. Cowboy will not attempt to find
the location of this directory if the VM doesn't know it,
as this caused issues in some setups.
* Overall the code has been much simplified and clarified,
and of course has now been documented.
|
|
The code for parsing has also been rewritten to be more efficient
and to be able to handle cookie values with space inside them properly.
Update cowlib to 0.2.0.
|
|
|
|
Start moving a few functions from Cowboy into cowlib.
|
|
|
|
|
|
|
|
|
|
|
|
And various other improvements following the addition of two tests.
New dependency cowlib that will gradually receive most of the parse
code from SPDY but also HTTP and its headers.
|
|
this will be used by tests
|
|
|
|
|
|
|
|
|
|
When something went wrong in a handler we used to report errors
and then terminate the process normally. This doesn't work so
well with links which won't detect failure.
Now we still catch the error, but throw another one with more
details on why it happened, including the Req object information
and the stacktrace. Ranch will then print an error message with
all this information.
Because we crash directly, this also means that we will not hog
resources unnecessarily for too long when something bad happens.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Previously cowboy_http:te_chunked/2 would enter an incorrect state if
it tried to parse an incomplete chunk when the length was known from the
partial chunk.
Previosuly cowboy_http:te_chunked/2 expected the trailing "\r\n" to
always be present if chunk body was present in the buffer. This is not
guaranteed and so this commit accommodates that situation.
|
|
|
|
The unmasking logic was based on the length of inflated data instead
of the length of the deflated data. This meant data would get corrupted
when we receive a websocket frame split across multiple TCP packets.
|
|
|
|
|
|
|
|
|
|
|
|
We can change this call when we start supporting only R16B+,
which may happen when R17B is released or some time before.
|
|
|
|
Certain clients send malformed Accept-Encoding headers, which causes
cowboy_req to crash is compression is enabled.
|
|
|
|
|
|
This stacktrace is very useful in the `onresponse` hook. For example:
```erlang
internal_error_hook(500, Headers, <<>>, Req) ->
StackTrace = erlang:get_stacktrace(),
Headers0 = [{N, V} || {N, V} <- Headers, N =/= <<"content-length">>],
Body = io_lib:format("~p", [StackTrace]),
{ok, Req0} = cowboy_req:reply(500, Headers0, Body, Req),
Req0;
internal_error_hook(Status, Headers, Body, Req) ->
{ok, Req0} = cowboy_req:reply(Status, Headers, Body, Req),
Req0.
```
|
|
|
|
|
|
|
|
|
|
|