Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
Conflicts:
src/cowboy_rest.erl
|
|
|
|
Basic HTTP authorization according to RFC 2617 is implemented.
Added an example of its usage with REST handler.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This is more for consistency than anything.
|
|
|
|
|
|
Ultimately few things change, it's mostly just a nicer syntax and
slightly different expectations. The name of the value `dispatch`
did not change, because the previous dispatch values will now fail
if the code is not updated to using `cowboy_router:compile/1`.
No constraints have been implemented in this commit.
|
|
There is one another {upgrade, ...} quintuple allowed as the result of
Handler:init call, somewhy not mentioned in the callback specifications.
|
|
Types and code are moved to cowboy_router. The match/3 export
from cowboy_dispatcher isn't available anymore as it is called
internally.
|
|
|
|
|
|
|
|
|
|
|
|
This should have been done a *long* time ago, back when I initially
added Websocket support. This is the first part of two in improving
loop handler support with regards to socket closure.
Reason may include: {normal, shutdown} for the most normal shutdown,
{normal, timeout} for a loop handler timeout shutdown, or {error, _}
if an error occured.
|
|
|
|
Reported and fixed over email by Adrian Roe.
|
|
|
|
This makes it similar to the other has_* functions.
|
|
|
|
|
|
For optional header name capitalization. See the guide section about it.
|
|
Also fixes a warning.
|
|
|
|
We now always send a failure reason (bad protocol, bad encoding, etc.)
unless the closure was initiated by the client and it didn't send a
close code.
We now check that the close frames have a payload that is valid UTF-8,
unless they don't have a payload at all.
We now do not crash the process anymore when bad opcodes are sent, or
when the opcode 0 is sent before fragmentation was initiated.
Overall this makes us closer to full compliance with the RFC.
|
|
The autobahntestsuite now passes 100% of the tests. We are
getting close to fully implementing the Websocket RFC.
|
|
No change in functionality, but this will allow us to validate
that text frames are utf8 without having to receive the frame
entirely.
|
|
Good in theory, but implementations may vary. If something stops
working after this commit we might need some tweaks to support
existing clients.
Please try it and give feedback.
|
|
It was only used by Safari 5.0.1 and possibly 5.1. Their market share
is dropping as we speak. It was also insecure (disabled in Firefox
for that reason).
This will allow us to make much more efficient and cleaner code for
the rest of the Websocket versions we support (drafts 7 to 17 + RFC),
which are pretty much all versions seen in the wild excluding the
one we're removing here.
|
|
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.
|
|
This allows streaming a body without knowing the length in advance.
Also allows {stream, StreamFun} response body in the REST code.
|
|
It was added to help with response body streaming functions.
But it was a clumsy solution that we discarded in favor of
passing socket and transport to said function. It was also
very odd compared to the rest of the cowboy_req interface.
If you used this function before, worry not, here's its
proper equivalent.
[Socket, Transport] = cowboy_req:get([socket, transport], Req)
|
|
Before we were required to get the socket and transport ourselves,
now they're passed to the function.
|
|
|
|
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.
|
|
|
|
Using a 4xx error would be more appropriate for this since the server is parsing the content from the client and needs to let the client know the data is malformed (not the actual HTTP request but i.e. JSON semantics). The definition for 422 is described in [RFC 4918](https://tools.ietf.org/html/rfc4918#section-11.2)
|
|
This function was badly thought out and would cause more harm
than good if used at all. Recommendation will be for people
who need to limit body length to check it beforehand or when
not possible to use the stream_body API.
|
|
This reverts commit cc65a723d70bb078b048bab81eeb8a4bd7ed39ce.
|