Cowboy 2.1 focused on adding features that were temporarily removed in Cowboy 2.0. A number of bugs found in the 2.0 release were also fixed.
expect: 100-continue
header is now handled
automatically. The 100 response will be sent on the
first cowboy_req:read_body/2,3,4
call. This only applies
when using the default cowboy_stream_h
stream handler.
Experimental features are previews of features that will be added in a future release. They are not documented and their interface may change at any time. You are welcome to try them and provide feedback.
cowboy_metrics_h
stream handler can be used to
extract metrics out of Cowboy. It must be used first in
the list of stream handlers, and will record all events
related to requests, responses and spawned processes.
When the stream terminates it will pass this information
to a user-defined callback.
cowboy_tracer_h
stream handler can be used to setup
automatic tracing of specific requests. You can conditionally
enable tracing based on a function, header, path or any other
element from the request and the trace will apply to the
entire connection and any processes created by it. This is
meant to be used for debugging both in tests and production.
cowboy_rest
handler now implements a mechanism for
switching to a different type of handler from any callback
where stop
is also allowed. Switch by returning
{switch_handler, Module}
or {switch_handler, Module, Opts}
.
This is especially useful for switching to cowboy_loop
for streaming the request or response body.
stop
as a return value
are now explicitly listed in the documentation.
cowboy_req:sock/1
returns the IP/port
of the local socket.
cowboy_req:cert/1
returns the client
TLS certificate or undefined
if it isn’t available.
cowboy_req:inform/2,3
sends an
informational response.
stop
command is returned.
cowboy_req:stream_body/3
could lead to issues with
HTTP/1.1. This has been fixed.
cowboy_compress_h
was being used. This
is now corrected.
terminate/3
will now be
called when switching to another protocol using the
command switch_protocol
. This doesn’t apply when
doing upgrades to HTTP/2 as those occur before the
stream is initialized.
cowboy_clock
process is not running. This can happen when Cowboy
is being restarted during upgrades, for example.