Age | Commit message (Collapse) | Author |
|
The implementation is only partial for now but should work for
all browsers implementing it.
|
|
Mostly thanks to Magnus Klaar as it took me a while to figure
out how PropEr tests had to be written.
|
|
Improves the readability of websocket handler code by having
two functions: websocket_handle/3 handles the packets received
from the socket, removing the tuple construct that was otherwise
needed, so only websocket_handle(Data, Req, State) is needed now;
websocket_info/3 handles the messages that the websocket handler
process received, as websocket_info(Info, Req, State).
Both functions return values are handled identically by Cowboy
so nothing changes on that end.
|
|
Browsers get mad that the returned location address is not the same
as what they sent, since the :(80|443) is stripped.
Add a simple eunit test due to existing ct websockets tests not
covering this case.
|
|
Send the status line and headers using
cowboy_http_req:chunked_reply/3, and
individual chunks with cowboy_http_req:chunk/2.
|
|
The previous commit switching to raw recv + erlang:decode_packet/3
works around the OTP bug regarding headers size in http recv.
|
|
The server now does a single recv (or more, but only if needed)
which is then sent to erlang:decode_packet/3 multiple times. Since
most requests are smaller than the default MTU on many platforms,
we benefit from this greatly.
In the case of requests with a body, the server usually read at
least part of the body on the first recv. This is bufferized
properly and used when later retrieving the body.
In the case of pipelined requests, we can end up reading many
requests in a single recv, which are then handled properly using
only the buffer containing the received data.
|
|
Returns the port given in the Host header if present,
otherwise the default port of 443 for HTTPS and 80 for HTTP
is returned.
|
|
Basically:
cat /dev/urandom | nc host port
Only run this test if cat and nc are available.
|
|
|
|
Now the server defines default headers that can be overwritten by the
handler simply by passing them to the reply/4 function. Default headers
include, for now, Connection and Content-Length headers. Note that it isn't
enough to change the Connection header to close a keep-alive connection
server-side.
|
|
|
|
|
|
Defaults to 5. Prevents someone from indefinitely sending empty lines.
|
|
|
|
|
|
Handles two basic tests for both HTTP and HTTPS.
Also renames 'make test' into 'make tests'.
|