Debian Codegraph @

doc/src/guide/migrating_from_2.12.asciidoc

raw
1 [appendix]
2 == Migrating from Cowboy 2.12 to 2.13
3
4 Cowboy 2.13 focuses on improving the performance of
5 Websocket, as well as the HTTP protocols. It also
6 contains a variety of new features and bug fixes.
7 In addition, Cowboy 2.13 is the first Cowboy version
8 that contains the experimental HTTP/3 support.
9
10 Cowboy 2.13 requires Erlang/OTP 24.0 or greater.
11
12 === Features added
13
14 * The option `dynamic_buffer` has been added. When
15 enabled, Cowboy will dynamically change the
16 `buffer` socket option based on how much data
17 it receives. It will start at 1024 bytes and
18 go up to 131072 bytes by default. This applies
19 to HTTP/1.1, HTTP/2 and Websocket. The performance
20 gains are very important depending on the scenario.
21
22 * HTTP/1.1 and HTTP/2 now accept the `hibernate`
23 option. When set the connection process will
24 automatically hibernate to reduce memory usage
25 at a small performance cost.
26
27 * The `protocols` and `alpn_default_protocol` protocol
28 options have been added to control exactly which
29 HTTP protocols are allowed over clear and TLS listeners.
30
31 * The Websocket `max_frame_size` option can now be
32 set dynamically via the `set_options` command.
33 This allows configuring a smaller max size and
34 increase it after authentication or other checks.
35
36 * `cowboy_req:set_resp_headers` now accept lists of
37 headers. This can be used to simplify passing
38 headers coming from client applications such as
39 Gun. Note that the set-cookie header cannot be
40 provided using this function.
41
42 * `cowboy_rest` now always sets the allow header.
43
44 * Update Ranch to 1.8.1.
45
46 * Update Cowlib to 2.14.0.
47
48 * When using Hex.pm, version check requirements will
49 now be relaxed. Cowboy will accept any Ranch version
50 from 1.8.0 to 2.2.0 as well as future 2.x versions.
51 Similarly, any Cowlib 2.x version from 2.14.0 will
52 be accepted.
53
54 === Experimental features added
55
56 * Experimental support for HTTP/3 has been added,
57 including Websocket over HTTP/3. HTTP/3 support
58 is disabled by default; to enable, the environment
59 variable COWBOY_QUICER must be set at compile-time.
60
61 === Features deprecated
62
63 * The `inactivity_timeout` option is now deprecated
64 for all protocols. It is de facto ignored when
65 `hibernate` is enabled.
66
67 === Optimisation-related changes
68
69 * The behavior of the `idle_timeout` timer has been
70 changed for HTTP/2 and Websocket. Cowboy used to
71 reset the timer on every data packet received from
72 the socket. Now Cowboy will check periodically
73 whether new data was received in the interval.
74
75 * URI and query string hex encoding and decoding has
76 been optimised.
77
78 * Websocket UTF-8 validation of text frames has been
79 optimised.
80
81 * Websocket unmasking has been optimised.
82
83 === Bugs fixed
84
85 * HTTP/1.1 upgrade to HTTP/2 is now disabled over TLS,
86 as HTTP/2 over TLS must be negotiated via ALPN.
87
88 * `cowboy_req:filter_cookies` could miss valid cookies.
89 It has been corrected.
90
91 * HTTP/1.1 could get to a state where it would stop
92 receiving data from the socket, or buffer the data
93 without processing it, and the connection eventually
94 time out. This has been fixed.
95
96 * Websocket did not compress zero-length frames properly.
97 This resulted in decompression errors in the client.
98 This has been corrected.
99
100 * Websocket compression will now be disabled when only
101 the server sets `client_max_window_bits`, as otherwise
102 decompression errors will occur.
103
104 * Websocket will now apply `max_frame_size` both to
105 compressed frames as well as the uncompressed payload.
106 Cowboy will stop decompressing when the limit is
107 reached.
108
109 * Cowboy now properly handles exits of request processes
110 that occurred externally (e.g. via `exit/2`).
111
112 * Invalid return values from `content_types_provided`
113 could result in an atom sent to the socket, leading
114 to a cryptic error message. The invalid value will
115 now result in a better error message.