-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
API for setting an HTTP proxy for a Client #30
Comments
As far as I can tell, reqwest doesn't implement the standard Unix convention of using the |
Well, at the very least if reqwest had something like |
Yes, that's what we currently do - we manually get the proxy URL from the environment and use the url crate to extract the necessary components for As such, an equivalent to |
I've been working on this feature the past couple days, along with adding support to hyper for https-over-https-proxies. I'd like to take this opportunity to get the design right. Some things I'd like to consider for this feature:
I've spent most of my time getting https-over-https working, so the code I have so far doesn't handle most of the above considerations. At the moment, it only supports a single proxy, but making them is quite easy. let http = Proxy::http("example.proxy.domain", 4321);
let https = Proxy::https("secure.proxy.example", 5432);
let proxy = Proxy::env(); // constructor name? allow passing a list of env vars to check?
// how to use them is not determined yet
// either
let client = reqwest::Client::proxied(http);
// or
client.proxy(https); Maybe building a list is simply adding or anding proxies together? I'm not sure how you would clearly add an authorization to a proxy. Perhaps a mutator method, |
It's a bit niche, but I'm sure it would make life easier for people, particularly if it implements the |
I'm evaluating rust, and I wanted to test reqwest but without proxy support it's not very usefull in my case. All the use cases you listed are important. Exclude list are niche indeed, but they might as well be implemented to support PAC files. I would add to your list :
|
@seanmonstar would it be bad to add it as a method of Client:
I imagine url will be IntoUrl, so I don't know how you'd do the user:pass thing... maybe:
|
@seanmonstar I also don't think Reqwest should read envvar... that's something that apps should handle, not libraries. I don't even think there should be a convenience API to read such. It should be easy enough to do this in those apps, once the API for using proxies is added. |
Any movement on this? This is also blocking me from using reqwest instead of hyper. |
Proxies can currently be configured to intercept HTTP, HTTPS, and all requests. HTTPS tunneling is supported. Closes #30
Proxies can currently be configured to intercept HTTP, HTTPS, and all requests. HTTPS tunneling is supported. Closes #30
woot! 🎉🎉🎉 |
How would one use a proxy now then? |
@ark- you should look at the proxy tests for guidance. |
@sebasmagri Thanks that does what I need |
Along the line of
hyper::Client::with_http_proxy
Useful for debugging without affecting other applications like an OS-level proxy setting would.
The text was updated successfully, but these errors were encountered: