aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
2018-11-16Ensure unknown options are ignored in set_options commandLoïc Hoguin
2018-11-16Allow overriding cowboy_http's idle_timeout per requestLoïc Hoguin
This allows requests that expect to run longer to do so without impacting the configuration of other requests.
2018-11-15Add the set_options stream handler commandLoïc Hoguin
The first two options to benefit from this are the cowboy_compress_h options.
2018-11-15Add a compress_buffering option to cowboy_compress_hLoïc Hoguin
Also changes the behavior to disable buffering by default, so that the default works in all cases, including server-sent events.
2018-11-14Don't send the content-length header in empty 304 responsesLoïc Hoguin
It's OK to send it when set explicitly, as it can be set to what the representation's size would have been.
2018-11-14Ignore the boundary parameter when accepting multipartLoïc Hoguin
2018-11-14Allow disabling keep-alive for HTTP/1.0 connectionsLoïc Hoguin
2018-11-14Document some undefined behavior in cowboy_routerLoïc Hoguin
2018-11-14Don't send an unnecessary content-type header with cowboy_restLoïc Hoguin
2018-11-13Add the {deflate, boolean()} Websocket commandLoïc Hoguin
It allows to temporarily disable Websocket compression when it was negotiated. It's ignored otherwise. This can be used as fine-grained control when some frames do not compress well.
2018-11-12Add deflate options for Websocket compressionLoïc Hoguin
They allow the server to configure what it is willing to accept for both the negotiated configuration (takeover and window bits) and the other zlib options (level, mem_level and strategy). This can be used to reduce the memory and/or CPU footprint of the compressed data, which comes with a cost in compression ratio.
2018-11-11Enable range requests support in cowboy_staticLoïc Hoguin
2018-11-11Add ProvideRangeCallback tests using sendfileLoïc Hoguin
And fix this case when multiple ranges are requested.
2018-11-11Add automatic ranged request handling for bytes unitsLoïc Hoguin
Returning the atom auto instead of a callback informs Cowboy that it needs to handle range requests automatically. This changes the behavior so that the ProvideCallback function is called and then Cowboy splits the data on its own and sends the response without any other user involvement other than defining the ranges_provided/2 callback. This is a quick and dirty way to add range request support to resources, and will be good enough for many cases including for cowboy_static as it also works when the normal response body is a sendfile tuple.
2018-11-09Add sendfile support to cowboy_req:stream_bodyLoïc Hoguin
It is now possible to stream one or more sendfile tuples. A simple example of what can now be done would be for example to build a tar file on the fly using the sendfile syscall for sending the files, or to support Range requests with more than one range with the sendfile syscall. When using cowboy_compress_h unfortunately we have to read the file in order to send it. More options will be added at a later time to make sure users don't read too much into memory. This is a new feature however so existing code is not affected. Also rework cowboy_http's data sending to be flatter.
2018-11-07Add support for range requests (RFC7233) in cowboy_restLoïc Hoguin
This is currently undocumented but is planned to be documented in the next version.
2018-11-05Fix unused type in cowboy_staticLoïc Hoguin
2018-11-05Simplify the code that calls REST callbacksLoïc Hoguin
2018-11-04Add the rate_limited/2 REST callbackLoïc Hoguin
2018-11-03Add an option to disable sendfile for a listenerLoïc Hoguin
2018-11-02Add a charset option to cowboy_staticLoïc Hoguin
2018-11-02Remove the default charset iso-8859-1 in cowboy_restLoïc Hoguin
This requirement was removed in RFC7231 and the rationale behind it was documented in RFC6657.
2018-11-02Add tests for charsets_providedLoïc Hoguin
Fix cases where the q-value is 0 and where a wildcard was sent in the accept-charset header. Also don't send a charset in the content-type of the response if the media type is not text. Thanks to Philip Witty for help figuring this out.
2018-11-02Better handle content negotiation when accept contains charsetsLoïc Hoguin
Thanks to Philip Witty for help figuring this out.
2018-10-31Add compress_threshold protocol optionSteve Domin
Currently the compression threshold is set to 300 and hardcoded in the codebase. There are cases where it make sense to allow this to be configured, for instance when you want to enforce all responses to be compressed regarldess of their size.
2018-10-31Make sure we don't send error_responses on the wrong streamLoïc Hoguin
2018-10-31Handle error_response command in cowboy_metrics_hGrigory Starinkin
2018-10-31Improve a few types, including cowboy_req:req()Loïc Hoguin
2018-10-31Always dialyze tests and fix some cowboy_req specsLoïc Hoguin
2018-10-30Initial support for the PROXY protocol headerLoïc Hoguin
Depend on Ranch master for now since it isn't in any release yet.
2018-10-28Remove a useless todoLoïc Hoguin
2018-10-28Rename a few functions and shuffle argumentsLoïc Hoguin
2018-10-28Remove an unnecessary functionLoïc Hoguin
2018-10-28Exit gracefully on parent exit/sys:terminate/2,3Loïc Hoguin
2018-10-27Fix small issues introduced in the previous commitLoïc Hoguin
2018-10-27Use cow_http2_machine's timer handlingLoïc Hoguin
2018-10-26Use cow_http2:parse_sequence/1Loïc Hoguin
2018-10-26Switch cowboy_http2 to the new cow_http2_machineLoïc Hoguin
The new module is a merge of the Cowboy and Gun HTTP/2 state machines. Using a common code will help future developments rather than duplicating the work. A notable change is in how streams are terminated when the handler stops before the body is sent. The cowboy_stream:terminate function is now called only after the body has been sent fully (or the stream is reset in-between), not when the stop command is returned. This will most likely have an impact on metrics but will be closer to reality. I had to comment a broken test in rfc7231_SUITE that was cheating, cheating is no longer possible. This depends on Cowlib master for the time being. A new Cowlib version will be released once both Cowboy and Gun are ported to use cow_http2_machine and I'm satisfied with it.
2018-10-26Simplify a case clauseLoïc Hoguin
2018-10-02Fix ranch:start_tls when transport options are a mapLoïc Hoguin
2018-09-21Add the {active, boolean()} Websocket commandLoïc Hoguin
This command is currently not documented. It allows disabling the reading of incoming data from the socket, and can be used as a poor man's flow control.
2018-09-12Do not send a 101 after a final response in switch_protocolLoïc Hoguin
2018-09-11Add a commands-based interface to Websocket handlersLoïc Hoguin
This feature is currently experimental. It will become the preferred way to use Websocket handlers once it becomes documented. A commands-based interface enables adding commands without having to change the interface much. It mirrors the interface of stream handlers or gen_statem. It will enable adding commands that have been needed for some time but were not implemented for fear of making the interface too complex.
2018-09-07Add cowboy_req:read_and_match_urlencoded_body/2,3Loïc Hoguin
2018-08-13Improve errors for when the ProvideCallback is missingLoïc Hoguin
2018-08-13Update Ranch to 1.6.1Loïc Hoguin
2018-08-13Fix cancelling undefined settings timerBing Han
when settings_timeout is infinity
2018-08-06Add missing log command to the commands() typeLoïc Hoguin
2018-07-09Add missing logger spec for cowboy_http2 optsLoïc Hoguin
2018-06-28Introduce undocumented option loggerLoïc Hoguin
This commit reworks the logging that Cowboy does via error_logger to make the module that will do the actual logging configurable. The logger module interface must be the same as logger and lager: a separate function per log level with the same log levels they support. The default behavior remains to call error_logger, although some messages were downgraded to warnings instead of errors. Since error_logger only supports three different log levels, some messages may get downgraded/upgraded depending on what the original log level was to make them compatible with error_logger. The {log, Level, Format, Args} command was also added to stream handlers. Stream handlers should use this command to log messages because it allows writing a stream handler to intercept some of those messages and extract information or block them as necessary. The logger option only applies to Cowboy itself, not to the messages Ranch logs, so more work remains to be done in that area.