perf: new ws listener option to disable UTF-8 validation

This commit is contained in:
William Yang 2024-01-24 23:57:10 +01:00
parent c93fabb5cc
commit 726302ef6a
3 changed files with 17 additions and 1 deletions

View File

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

View File

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

View File

@ -1275,6 +1275,13 @@ fields_ws_opts_allow_origin_absence.desc:
fields_ws_opts_allow_origin_absence.label: fields_ws_opts_allow_origin_absence.label:
"""Allow origin absence""" """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: common_ssl_opts_schema_versions.desc:
"""All TLS/DTLS versions to be supported.<br/> """All TLS/DTLS versions to be supported.<br/>
NOTE: PSK ciphers are suppressed by 'tlsv1.3' version config.<br/> NOTE: PSK ciphers are suppressed by 'tlsv1.3' version config.<br/>