-
Notifications
You must be signed in to change notification settings - Fork 33
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
server_name: offer ServerName::to_str w/ alloc/std features #14
Conversation
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.
It seems to me that ServerName
is an input-only type from the perspective of webpki/rustls so it's not that obvious why it needs non-trivial implementations to change it back to string form. What's the ffi/platform verifier use case, exactly?
For rustls-ffi the For rustls-platform-verifier the Since there are two separate uses and the functionality existed before moving to the pki-types arrangement it seemed sensible to implement. Does the above help convince you? |
b56342f
to
1a03948
Compare
1a03948
to
c245500
Compare
Downstream crates may want to represent a `ServerName` as a `String` or `&str`, e.g. for passing through a `ffi` boundary to external code. This commit implements support for converting a `pki_types::IpAddr` to a `std::net::IpAddr` (to use the `to_string` impl), and adds a `ServerName::to_str` that can return a `Cow<'_, str>` for a `DnsName` or an `IpAddr`.
c245500
to
dbd46ff
Compare
Published rustls-pki-types v0.2.3 at registry |
Argh - I broke semver calling this 0.2.3 😢 af0db93 was in That makes it incompatible with I could cut a new 0.2.4 that includes this branch's changes but not af0db93, or we could roll forward and fix webpki. I'm not sure what the best course of action is given this crate is pretty internal to the Rustls ecosystem. |
Here's a webpki fix PR: rustls/webpki#212 |
I guess we should add a cargo-semver-checks job? :D I suppose the webpki fix will be good enough for now while this only causes issues for alphas. |
It was there, but CI wasn't running 😭 I should have fixed that before I merged the other work. Silly mistakes. |
Downstream crates may want to represent a
ServerName
as aString
or&str
, e.g. for passing through affi
boundary to external code (for example, inrustls-ffi
, or inrustls-platform-verifier
).This commit implements support for converting a
pki_types::IpAddr
to astd::net::IpAddr
(to use theto_string
impl), and adds aServerName::to_str
that can return aCow<'_, str>
for aDnsName
or anIpAddr
.