-
Notifications
You must be signed in to change notification settings - Fork 34
ServerName can now have two kinds of value #292
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
Comments
Also, rustls_client_connection_new takes a The upstream API takes advantage of Rust's enums to take a ServerName, which can hold either a hostname (stringish) or an Ipv4Addr / Ipv6Addr. The Rust stdlib does us the favor of providing handy cross-platform IP address representations. Since we don't have fielded enums in the FFI interface, and don't have a cross-platform IP address struct, we have to make some tweaks. Some options:
I think I favor 2a. I don't like the implicit magic of (1). On the other hand, I suspect many downstream users want the behavior of "interpret this string as a hostname or an IP address, depending on what it contains." Thoughts @cpu? |
I'm less familiar with what's ergonomic for the C consumers of this API (so take all of this with many grains of salt!) but my intuition matches yours that it's probably common to have a string in-hand. It also seems like since there's not a cross-platform IP address representation that all of the consumers would have to carry some platform specific code of their own to map from a Do you think there are any users that would want an API that guarantees they connect to a hostname and never treat an input string as an IP address? |
Your argument for 2b makes sense to me.
I don't think so. Mainly my intuition for 2a was that it's a shame to take an API that explicitly splits things out into their own types, and then collapse it into a stringly-typed API. But in this case I think crossing outside of a given language and its amenities winds up making that the right thing to do. If an application arises that does want to ensure just hostnames or just IP addresses, we can provide separate constructors for those. |
That makes sense to me 👍 |
Aha, actually rustls upstream makes the same call. There is an |
Nice find 💡 I'm glad it lines up with what we're thinking. |
Fixed by #302. |
Uh oh!
There was an error while loading. Please reload this page.
In rustls_verify_server_cert_params, we treat ServerName as if it will only contain a DnsName. However, as of rustls 0.21, we can also see IpAddress. We need to update the interface to account for that.
The text was updated successfully, but these errors were encountered: