-
-
Notifications
You must be signed in to change notification settings - Fork 335
strip out options unsupported in TLS1.3 before listening on socket #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
dc8ba08
4c8e58f
8aef9e6
67d26b4
40c11ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,7 +129,8 @@ do_listen(SocketOpts0, Logger) -> | |
| SocketOpts1 = ranch:set_option_default(SocketOpts0, backlog, 1024), | ||
| SocketOpts2 = ranch:set_option_default(SocketOpts1, nodelay, true), | ||
| SocketOpts3 = ranch:set_option_default(SocketOpts2, send_timeout, 30000), | ||
| SocketOpts = ranch:set_option_default(SocketOpts3, send_timeout_close, true), | ||
| SocketOpts4 = ranch:set_option_default(SocketOpts3, send_timeout_close, true), | ||
| SocketOpts = strip_usupported_options(SocketOpts4), | ||
| %% We set the port to 0 because it is given in the Opts directly. | ||
| %% The port in the options takes precedence over the one in the | ||
| %% first argument. | ||
|
|
@@ -296,3 +297,18 @@ cleanup(#{socket_opts:=SocketOpts}) -> | |
| end; | ||
| cleanup(_) -> | ||
| ok. | ||
|
|
||
| -spec strip_usupported_options(opts()) -> opts(). | ||
| strip_usupported_options(SocketOpts) -> | ||
| case lists:keyfind(versions, 1, SocketOpts) of | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is only part of it, ie the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if you mean that other options could give a value of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We mean that the |
||
| {versions, ['tlsv1.3']} -> | ||
| Intermediate1 = lists:keydelete(secure_renegotiate, 1, SocketOpts), | ||
| Intermediate2 = lists:keydelete(reuse_sessions, 1, Intermediate1), | ||
| Intermediate3 = lists:keydelete(next_protocols_advertised, 1, Intermediate2), | ||
| lists:keydelete(alpn_preferred_protocols, 1, Intermediate3); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor detail probably, but this is not exhaustive either. |
||
| _ -> | ||
| SocketOpts | ||
| end; | ||
| strip_usupported_options(SocketOpts) -> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This clause is pointless, it will never be reached.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll remove this. It was inherited from the code, which I'd moved from the acceptors file. |
||
| SocketOpts. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo?
usupported-->unsupported?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, thank you for spotting that. The downside of autocomplete once it was written wrong.