0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00

Websocket: Allow setting the max_frame_size option dynamically

This can be used to limit the maximum frame size before
some authentication or other validation is completed.
This commit is contained in:
Loïc Hoguin 2025-01-16 14:40:37 +01:00
parent 818b448ae9
commit 81de580aee
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
4 changed files with 65 additions and 14 deletions

View file

@ -138,7 +138,9 @@ commands() :: [Command]
Command :: {active, boolean()}
| {deflate, boolean()}
| {set_options, #{idle_timeout => timeout()}}
| {set_options, #{
idle_timeout => timeout(),
max_frame_size => non_neg_integer() | infinity}}
| {shutdown_reason, any()}
| Frame :: cow_ws:frame()
----
@ -159,8 +161,8 @@ effect on connections that did not negotiate compression.
set_options::
Set Websocket options. Currently only the option `idle_timeout`
may be updated from a Websocket handler.
Set Websocket options. Currently only the options `idle_timeout`
and `max_frame_size` may be updated from a Websocket handler.
shutdown_reason::
@ -285,6 +287,7 @@ normal circumstances if necessary.
== Changelog
* *2.13*: The `max_frame_size` option can now be set dynamically.
* *2.11*: Websocket over HTTP/2 is now considered stable.
* *2.11*: HTTP/1.1 Websocket no longer traps exits by default.
* *2.8*: The `active_n` option was added.