Cowboy 2.5 focused on making the test suites pass. A variety of new features, fixes and improvements have also been worked on.
linger_timeout
to control how long Cowboy will wait before closing the socket when shutting down the connection. This helps avoid the TCP reset problem HTTP/1.1 suffers from. The default is now 1000 ms.
{Commands, State}
where Commands
can be frames to be sent or commands yet to be introduced. New commands will be available only through this new interface.
{active, boolean()}
Websocket handler command. It allows disabling reading from the socket when false
is returned. true
reenables reading from the socket.
logger
that allows configuring which logger module will be used. The logger module must follow the interface of the new logger
module in Erlang/OTP 21, or be set to error_logger
to keep the old behavior. A similar transport option exists in Ranch 1.6; both options are necessary to override Cowboy's default behavior completely.
{log, Level, Format, Args}
stream handler command. Making it a command rather than a direct call will simplify silencing particular log messages.
cowboy_req:stream_events/3
streams one or more text/event-stream events, encoding them automatically.
cowboy_req:read_and_match_urlencoded_body/2,3
can be used to read, parse and match application/x-www-form-urlencoded request bodies, in a similar way to cowboy_req:match_qs/2
.
cowboy_stream_h
.
settings_timeout
option when the value is set to infinity
.
cowboy_req:stream_reply/2,3
is used to send a response.
switch_protocol
is used after a response was sent, Cowboy will no longer attempt to send the 101 informational response for the protocol upgrade. This caused a crash of the connection previously.
content_types_provided
does not exist have been improved.
websocket_handle
.
Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:
Recurring payment options are also available via GitHub Sponsors. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.