-
Notifications
You must be signed in to change notification settings - Fork 2
Refactoring of https connector to make root certificates optional #47
Conversation
Co-authored-by: Nicolas Savoire <[email protected]>
Tcp{ #[pin] transport: tokio::net::TcpStream }, | ||
Tls{ #[pin] transport: tokio_rustls::client::TlsStream<tokio::net::TcpStream>}, | ||
// Tokio doesn't handle unix sockets on windows | ||
#[cfg(unix)] |
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.
very cool having this cfg right inside the enum
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.
Oh nice, I thought pin_project_lite
didn't understand cfg macros
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.
Sorry for confusion, The cfg macro got silently ignored by the pin_project_lite.
I've added windows builds to catch these in the future
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.
Thanks !
LGTM. Another set of eyes would be nice to check on lifetimes and ownership (topic on which I'm not relevant enough).
Tcp{ #[pin] transport: tokio::net::TcpStream }, | ||
Tls{ #[pin] transport: tokio_rustls::client::TlsStream<tokio::net::TcpStream>}, | ||
// Tokio doesn't handle unix sockets on windows | ||
#[cfg(unix)] |
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.
Oh nice, I thought pin_project_lite
didn't understand cfg macros
TBF I'm not certain it works as expected, I'll try quickly adding a Windows build 🤞 |
@gleocadie fyi, as you have interests in building on windows |
Ok, I've tried compiling locally for windows using cross , and it actually doesn't work. I get this error
|
Maybe if the cleaner code is worth it, we could try using |
Or we just write the projection code ourselves. Looking at the kind of code generated by pin-project https://github.com/taiki-e/pin-project/blob/HEAD/examples/struct-default-expanded.rs , anf removing the cruft it doesn't look to bad. |
55a6079
to
6924d1c
Compare
thanks for the heads up |
623ed01
to
1b1983c
Compare
Thanks @paullegranddc - with your suggestion I reimplemented the Edit: after sleeing on this I decided to switch back to pin_project (non-lite) just to reduce the number of visible code lines and the unsafe eyesore (out of sight out of mind 😂 ). |
Thanks All for the review! |
Root certificates can be missing on the machine/container this library runs in. Currently the existing hyper_rusttls implementation with panic, and exit.
One way to avoid this is to rewrite part of the client initialization code to make it fail gracefully. Started this PR to see how that could look, but don't have time this week to bring this past the finish line