-
Notifications
You must be signed in to change notification settings - Fork 96
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
Add --ssl option for forcing a TLS version #168
Conversation
I'm guessing this is a bug in native-tls's |
If possible, I think it's better to add TLS 1.1 or less to |
@sorairolake It should be possible via the cfg_attr attribute /// Force a particular TLS version.
///
/// "auto" or "ssl2.3" gives the default behavior of negotiating a version
/// with the server.
#[cfg_attr(feature = "native-tls", structopt(long, value_name = "VERSION", parse(from_str = parse_tls_version), possible_values = &["auto", "ssl2.3", "tls1", "tls1.1", "tls1.2", "tls1.3"]))]
#[cfg_attr(not(feature = "native-tls"), structopt(long, value_name = "VERSION", parse(from_str = parse_tls_version), possible_values = &["auto", "ssl2.3", "tls1.2", "tls1.3"]))]
// An explicit path to Option disables structopt magic we don't want here
pub ssl: std::option::Option<tls::Version>, |
You get a more confusing error message that way, so I'd rather not. |
cmd.push("--tls-max"); | ||
cmd.push("1.3"); | ||
} | ||
_ => unreachable!(), |
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.
I think If we used our own enum for representing TLS versions, we could have avoided the catch-all arm here plus the Option<std::option::Option>
hack. What do you think?
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.
If we do it like that then we need extra effort to ignore TlsVersion::Auto
. So I'm not sure it'd end up cleaner overall.
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.
LGTM
Resolves #120.