Merge pull request #12392 from qzhuyan/perf/william/ws-no-utf8-validate

perf: new ws listener option to disable UTF-8 validation
This commit is contained in:
William Yang 2024-01-26 16:01:04 +01:00 committed by GitHub
commit 933c00c7ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 1 deletions

View File

@ -1104,6 +1104,14 @@ fields("ws_opts") ->
sc(
ref("deflate_opts"),
#{}
)},
{"validate_utf8",
sc(
boolean(),
#{
default => true,
desc => ?DESC(fields_ws_opts_validate_utf8)
}
)}
];
fields("tcp_opts") ->

View File

@ -205,7 +205,8 @@ init(Req, #{listener := {Type, Listener}} = Opts) ->
compress => get_ws_opts(Type, Listener, compress),
deflate_opts => get_ws_opts(Type, Listener, deflate_opts),
max_frame_size => get_ws_opts(Type, Listener, max_frame_size),
idle_timeout => get_ws_opts(Type, Listener, idle_timeout)
idle_timeout => get_ws_opts(Type, Listener, idle_timeout),
validate_utf8 => get_ws_opts(Type, Listener, validate_utf8)
},
case check_origin_header(Req, Opts) of
{error, Reason} ->

4
changes/perf-12392.en.md Normal file
View File

@ -0,0 +1,4 @@
New WebSocket listener option: `validate_utf8` for performance tuning.

View File

@ -1275,6 +1275,13 @@ fields_ws_opts_allow_origin_absence.desc:
fields_ws_opts_allow_origin_absence.label:
"""Allow origin absence"""
fields_ws_opts_validate_utf8.desc:
"""Set to <code>false</code> to disable WebSocket Frame UTF-8
validation for performance"""
fields_ws_opts_validate_utf8.label:
"""Enable/Disable WebSocket Frame utf8 validation"""
common_ssl_opts_schema_versions.desc:
"""All TLS/DTLS versions to be supported.<br/>
NOTE: PSK ciphers are suppressed by 'tlsv1.3' version config.<br/>