-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add Proxy support to Client #531
Comments
It would be awesome to have this feature! |
Yes please. Some of us need this to use Rust at work. |
Something like:
|
I would like to give this a try. |
@seanmonstar Could you give more information on how you think this should be implemented? |
@mattnenterprise an api suggested by @shaleh looks fine. It'd likely require adding a method to |
Note the requirement for a list of proxies. When the final HTTP call is made it should check the request's scheme against defined proxies for a matching scheme. |
Since Rust does not support optional arguments I used |
I think using a container for the proxies avoids the need for |
There's a PR for this at #639, if others interested in this feature could help looking it over. |
Hello everybody, I have been working on the proxy implementation for a while (on and off) but I missed this conversation :-) I will evolve my PR based on this feedback. |
Hi All, Do you have an ETA on this one ? it seems like it hasn't evolved since October. Any chance to see this merged or is it still not mature enough. Thanks ! |
I'm in the same boat. I really need proxy support. Is there any chance I can help out with this? |
Any updates on this? |
My focus is entirely on the async branch, which makes this easy: struct ProxiedHandler(hyper::Method, &'static str);
impl Handler for ProxiedHandler {
fn on_request(&mut self, req: &mut Request) -> Next {
req.set_method(self.0);
req.set_uri(RequestUri::AbsoluteUri(self.1.parse().unwrap());
Next::read()
}
// ...
}
client.request("http://proxy.server", ProxiedHandler(GET, "http://target.domain/path")); I can try to add in some support to the sync branch, such that if the |
This works by configuring proxy options on a `Client`, such as `client.set_proxy("http", "127.0.0.1", "8018")`. Closes #531
This works by configuring proxy options on a `Client`, such as `client.set_proxy("http", "127.0.0.1", "8018")`. Closes #531
See #771 to add simple support to the sync branch. This will be released in hyper 0.9.2. @shaleh this doesn't add support for lists, or |
No worries, I do not need either lists or Proxy-Authorization. |
@seanmonstar I am in need of |
@JeffBelgum possibly. When exactly should the header be sent, as part of the normal request, or as part of the |
It's send as part of the |
Then it seems that would require a new It probably should, and I think it can be done in a backwards compatible way, by adding a method to |
Great, thanks for the help! Would you be open to a PR against the 10.x branch that implements proxy authorization in the current Proxy struct? |
@JeffBelgum for increased flexibility, I'd probably suggest allowing the Some proxies use different headers for auth, and may or may not require other headers like User-Agent. Best to just let people configure any header. |
I imagine some sort of
Proxy
type being added a property ofClient
, with a correspondingset_proxy(Option<Proxy>)
method.Use of a proxy can have different requirements: all requests, only https requests, only http... So it would probably mean
Proxy
would be an enum... and the proxy would be consulted in theRequestBuilder.send
method.The text was updated successfully, but these errors were encountered: