Age | Commit message (Collapse) | Author |
|
|
|
|
|
Considering how it must be used, a simple binary is much better
than a tag and a list of subtags. We still parse them like this
to make sure they follow the specs, though.
|
|
Spotted by devinus on IRC.
|
|
These functions allow to set response headers and body in advance,
before calling any of the reply functions.
Also add has_resp_header/2 and has_resp_body/1 to check if the given
response headers have already been set.
|
|
|
|
|
|
|
|
|
|
Used to parse either a token or a quoted string in parameters values.
|
|
|
|
|
|
|
|
|
|
Implementing the full HTTP-date type (RFC1123, RFC850, asctime).
|
|
Conflicts:
src/cowboy_http.erl
|
|
|
|
|
|
Sorry I apparently used an outdated RFC when I was doing this.
|
|
|
|
See comment added with it for more information.
|
|
|
|
|
|
a release upgrade on a vm running cowboy where any other appup
includes an {update, Mod, {advanced, Extra}} instruction will hang
forever due to these child specs being wrong.
The gen_servers should be [Mod] and the non gen_server needs to be []
since there is no callback to handle this.
|
|
|
|
|
|
|
|
|
|
Rework the cowboy_http_req:parse_header/2 function while I was at it.
|
|
|
|
|
|
|
|
|
|
|
|
This function doesn't try to add any additional header besides the
Connection: Upgrade header. It also doesn't accept a body.
It should be used for the intermediate reply to an upgrade process,
before the real reply is sent (if any, for example when using TLS).
|
|
Fixed according to the websocket draft specs.
|
|
|
|
Allows to limit the size of request and header lines, thus preventing
Cowboy from infinitely reading from the socket and never finding an
end of line.
Defaults to 4096 bytes.
|
|
Introduce cowboy_http's list/2, nonempty_list/2, token/2 functions.
|
|
New functions are reply/2, reply/3, chunked_reply/2 in cowboy_http_req.
|
|
|
|
|
|
This however does not fix the related Dialyzer warnings.
I have no idea what the warnings are about nor how to fix them,
so feel free to work on it and submit a patch!
|
|
Now init/3 can return one of the following values to enable loops:
- {loop, Req, State}
- {loop, Req, State, hibernate}
- {loop, Req, State, Timeout}
- {loop, Req, State, Timeout, hibernate}
Returning one of these tuples will activate looping in the HTTP handler.
When looping, handle/2 is never called. Instead, Cowboy will listen
for Erlang messages and forward them to the info/3 function of the
handler. If a timeout is defined, Cowboy will also close the connection
when no message has been received for Timeout milliseconds.
The info/3 function is defined as info(Msg, Req, State). It can return
either of the following tuples:
- {ok, Req, State}
- {loop, Req, State}
- {loop, Req, State, hibernate}
The first one ends the connection, calling terminate/2 before closing.
The others continue the loop.
Loops are useful when writing long-polling handlers that need to wait
and don't expect to receive anything. Therefore it is recommended to
set a timeout to close the connection if nothing arrives after a while
and to enable hibernate everywhere.
Normal HTTP handlers shouldn't need to use this and as such info/3
was made optional.
|
|
This change allows application developers to refuse websocket upgrades
by returning {shutdown, Req}. The application can also send a reply
with a custom error before returning from websocket_init/3, otherwise
an error 400 is sent.
Note that right now Cowboy closes the connection immediately. Also note
that neither terminate/3 nor websocket_terminate/3 will be called when
the connection is shutdown by websocket_init/3.
|
|
This new exported function returns a Child Spec suitable for embedding
cowboy in another applications supervisor structure. While here,
implement `start_listener/6` in terms of it.
|
|
|
|
You can now return {shutdown, Req, State} from Handler:init/3
to skip the handle/2 step.
Also allow init/3 function to send responses.
|
|
|
|
Now Cowboy checks headers sent to the client for the 'Connection'
header value, parses it, and checks whether it contains a 'close'
or 'keep-alive' value. It makes sure to close or keep the connection
alive depending on the value found there, if any.
Also change chunked replies to not close the connection by default
unless the application requests it.
|