Skip to content
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

Merged
merged 3 commits into from
May 3, 2022
Merged

Conversation

niklasad1
Copy link
Member

@niklasad1 niklasad1 commented Apr 30, 2022

Closing #748

Wrapping the HttpConnector in the HttpsConnector doesn't work, see for futher info rustls/hyper-rustls#169 which this PR fixes.

@niklasad1 niklasad1 requested a review from a team as a code owner April 30, 2022 07:49
@niklasad1 niklasad1 changed the title fix: use https conn for https fix(http client): use https connector for https May 1, 2022
let client = match target.scheme_str() {
Some("http") => {
let mut connector = HttpConnector::new();

connector.set_reuse_address(true);
Copy link
Member Author

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?

Copy link
Collaborator

@jsdw jsdw May 3, 2022

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!)

Copy link
Member Author

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.

_ => return Err(Error::InvalidCertficateStore),
};
let client = Client::builder().build::<_, hyper::Body>(connector);
HyperClient::Https(client)
HyperClient::Https(Client::builder().build::<_, hyper::Body>(connector))
Copy link
Collaborator

Choose a reason for hiding this comment

The 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?

Copy link
Collaborator

Choose a reason for hiding this comment

The 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!

Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants