Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
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.
|
|
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
|
|
|
|
|
|
This commit prevents erlang messages from keeping a websocket connection
alive. Previously, the timer was canceled upon any activity. Now, the
timeout is only canceled when actual data is sent from the client. The
handler_loop_timeout/1 function is called from websocket_data/4 instead
of handler_before_loop/4. It is also called after every successful reply
in handler_call/4.
|
|
|
|
|
|
|
|
This should be equivalent to what we do in Set-Cookie. Real-world
testing is needed to confirm it works as intended.
|
|
|
|
|
|
No more trying to quote, this is still completely broken everywhere.
|
|
|
|
|
|
|
|
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).
|
|
Fix broken 'make docs'
|
|
|
|
|
|
|
|
|
|
Includes:
* cowboy_clock:rfc2109/1 now expects UTC datetime
* Rewrite of the cookie code to cowboy_http
* Removal of cowboy_cookies
* Add type cowboy_req:cookie_opts/0
Cookies should now be set using cowboy_req:set_resp_cookie/3.
Code calling cowboy_cookies directly will need to be updated.
|
|
|
|
|
|
Add the function cowboy_clock:rfc1123/1 that formats the given
date to the RFC1123 format.
|
|
|