-
Notifications
You must be signed in to change notification settings - Fork 175
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
fix(http client): use https connector for https #750
Changes from 2 commits
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 |
---|---|---|
|
@@ -57,13 +57,13 @@ impl HttpTransportClient { | |
return Err(Error::Url("Port number is missing in the URL".into())); | ||
} | ||
|
||
let mut connector = HttpConnector::new(); | ||
|
||
connector.set_reuse_address(true); | ||
connector.set_nodelay(true); | ||
|
||
let client = match target.scheme_str() { | ||
Some("http") => { | ||
let mut connector = HttpConnector::new(); | ||
|
||
connector.set_reuse_address(true); | ||
connector.set_nodelay(true); | ||
|
||
let client = Client::builder().build::<_, hyper::Body>(connector); | ||
HyperClient::Http(client) | ||
} | ||
|
@@ -74,16 +74,15 @@ impl HttpTransportClient { | |
.with_native_roots() | ||
.https_or_http() | ||
.enable_http1() | ||
.wrap_connector(connector), | ||
.build(), | ||
CertificateStore::WebPki => hyper_rustls::HttpsConnectorBuilder::new() | ||
.with_webpki_roots() | ||
.https_or_http() | ||
.enable_http1() | ||
.wrap_connector(connector), | ||
.build(), | ||
_ => return Err(Error::InvalidCertficateStore), | ||
}; | ||
let client = Client::builder().build::<_, hyper::Body>(connector); | ||
HyperClient::Https(client) | ||
HyperClient::Https(Client::builder().build::<_, hyper::Body>(connector)) | ||
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'm not really sure what the impact of this change is; was wrapping the HttpConnector causing an issue? 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. Ah I see; I just read rustls/hyper-rustls#169. Interesting! My reading/assumption was that the wrapping would work as we had expected! |
||
} | ||
_ => { | ||
#[cfg(feature = "tls")] | ||
|
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.
remove these to more "similar" to `HTTPs connector?
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.
Does removing them have any obvious impact on anything? I did a bit of reading up on them and they both sound like optimisations anyway (I wasn't sure that nodelay would actually help anything much here; it sounds like it trades a little throughput for lower latency, and reuseaddress sounds like an optimisation around freeing up an address a little quicker mainly).
I'd vote to either remove them if no real difference is observed, or add a comment above them saying why they are important to have here. (I'd have thought you could set them for the https connector too but it wasn't so obvious to me how!)
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.
nah, no real difference might reduce the number of file descriptors for the benchmarks.
let's remove it.