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

feat: use reqwest as http client #2822

Merged

Conversation

@bartlomieju
Copy link
Contributor

commented Aug 27, 2019

Closes #2720

@bartlomieju

This comment has been minimized.

Copy link
Contributor Author

commented Aug 27, 2019

I'm getting compilation errors related to mismatched crate versions. It looks like reqwest uses url crate with version 1.7.2 while in our Cargo.toml we define url with version 2.1.0.

@ry does this situation disqualify using reqwest? (I mean that I can downgrade url so there's no conflict, but are you ok with that solution?)

cli/http_util.rs Outdated Show resolved Hide resolved
@bartlomieju

This comment has been minimized.

Copy link
Contributor Author

commented Aug 28, 2019

@ry PTAL, this is now feature complete. If you're fine with downgrading url crate then I'd ask you to add reqwest to third_party repo so CI can build with GN.

Benefits of using reqwest:

cli/http_body.rs Show resolved Hide resolved
cli/resources.rs Outdated Show resolved Hide resolved

@ry ry requested a review from piscisaureus Aug 28, 2019

@ry

This comment has been minimized.

Copy link
Collaborator

commented Aug 28, 2019

@ry PTAL, this is now feature complete. If you're fine with downgrading url crate then I'd ask you to add reqwest to third_party repo so CI can build with GN.

@piscisaureus can you run gnargo on this?

@ry

This comment has been minimized.

Copy link
Collaborator

commented Aug 28, 2019

Does this patch add proxy support?

@bartlomieju

This comment has been minimized.

Copy link
Contributor Author

commented Aug 28, 2019

Does this patch add proxy support?

Implicitly - it's done by reqwest transparently. Tests for proxy will follow in other PR

@ry

This comment has been minimized.

Copy link
Collaborator

commented Aug 28, 2019

Implicitly - it's done by reqwest transparently

I suppose that means there's an environmental variable? Can you add some docs for this?

@bartlomieju

This comment has been minimized.

Copy link
Contributor Author

commented Aug 28, 2019

Implicitly - it's done by reqwest transparently

I suppose that means there's an environmental variable? Can you add some docs for this?

Ah, sorry. It's not on by default:

A Client can be configured to make use of HTTP proxies by adding Proxys to a ClientBuilder.

** NOTE** System proxies will be used in the next breaking change.

I'll enable & document it in a follow up PR.

@ry

This comment has been minimized.

Copy link
Collaborator

commented Aug 28, 2019

I'll enable & document it in a follow up PR.

I'm fine with landing this as two PRs, but I think we should see a proof-of-concept for proxy before landing this, since that's the whole purpose of reqwest (?). Maybe just do that work in this branch.

@@ -87,26 +87,3 @@ impl AsyncRead for HttpBody {
}
}
}

#[test]
fn test_body_async_read() {

This comment has been minimized.

Copy link
@bartlomieju

bartlomieju Aug 28, 2019

Author Contributor

Unfortunately all methods of Decoder are private or crate scoped, so there's no way to construct it manually...

@piscisaureus

This comment has been minimized.

Copy link
Collaborator

commented Aug 28, 2019

@bartlomieju Url can be downgraded back to 1.7.2 IMO.

@bartlomieju

This comment has been minimized.

Copy link
Contributor Author

commented Aug 28, 2019

@piscisaureus can you update deps in third_party?

cli/Cargo.toml Outdated Show resolved Hide resolved
@piscisaureus

This comment has been minimized.

Copy link
Collaborator

commented Aug 29, 2019

@bartlomieju I've added reqwest to the GN build. It builds for me but there are a few test failures.

@bartlomieju

This comment has been minimized.

Copy link
Contributor Author

commented Aug 29, 2019

@piscisaureus tests fixed, please decide on the DNS resolver (I suggest we try the new one) and review

piscisaureus added a commit to bartlomieju/deno that referenced this pull request Aug 29, 2019
piscisaureus added a commit to bartlomieju/deno that referenced this pull request Aug 29, 2019

@piscisaureus piscisaureus force-pushed the bartlomieju:feat-use_reqwest_as_http_client branch from 7faaeec to d764ea8 Aug 29, 2019

piscisaureus added a commit to bartlomieju/deno that referenced this pull request Aug 29, 2019

@piscisaureus piscisaureus force-pushed the bartlomieju:feat-use_reqwest_as_http_client branch from d764ea8 to 19839f6 Aug 29, 2019

@piscisaureus piscisaureus requested review from ry and piscisaureus Aug 29, 2019

@@ -539,11 +531,6 @@ fn filter_shebang(bytes: Vec<u8>) -> Vec<u8> {
}
}

fn url_into_uri(url: &url::Url) -> http::uri::Uri {

This comment has been minimized.

Copy link
@piscisaureus

piscisaureus Aug 29, 2019

Collaborator

Nice to see this go!

@piscisaureus
Copy link
Collaborator

left a comment

LGTM.
@ry I noticed you had some comments about a POC HTTP proxy, but that isn't implemented at this point.
You still want to wait for that?

@ry ry referenced this pull request Aug 29, 2019
@bartlomieju

This comment has been minimized.

Copy link
Contributor Author

commented Aug 29, 2019

@piscisaureus proxy support is enabled - see get_client function. There are no tests yet, I'll add them once I'm back

@ry

This comment has been minimized.

Copy link
Collaborator

commented Aug 29, 2019

If it can go green I’m ok with landing it

@piscisaureus piscisaureus force-pushed the bartlomieju:feat-use_reqwest_as_http_client branch from 19839f6 to 723284f Aug 30, 2019

@piscisaureus piscisaureus merged commit 723284f into denoland:master Aug 30, 2019

4 checks passed

Travis CI - Branch Build Passed
Details
Travis CI - Pull Request Build Passed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
license/cla Contributor License Agreement is signed.
Details
@piscisaureus

This comment has been minimized.

Copy link
Collaborator

commented Aug 30, 2019

@bartlomieju, @ry

I landed this patch without the trust-dns feature, because with that feature the tests weren't passing.

The patch that adds trust-dns (master...piscisaureus:reqwest_trust_dns) still applies, so we can land that at a later time if the tests can be made to go green.

@ry

This comment has been minimized.

Copy link
Collaborator

commented Aug 30, 2019

This patch added 1 megabyte to the executable.

Screen Shot 2019-08-30 at 7 45 46 PM

@bartlomieju bartlomieju deleted the bartlomieju:feat-use_reqwest_as_http_client branch Sep 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.