add a Proxy type

Proxies can currently be configured to intercept HTTP, HTTPS, and all
requests. HTTPS tunneling is supported.

Closes #30
This commit is contained in:
Sean McArthur
2017-05-02 16:45:27 -07:00
parent a25b9a6002
commit 6cdaff4b66
8 changed files with 481 additions and 16 deletions

View File

@@ -7,7 +7,7 @@ use futures::sync::{mpsc, oneshot};
use request::{self, Request, RequestBuilder};
use response::{self, Response};
use {async_impl, Certificate, Method, IntoUrl, RedirectPolicy, wait};
use {async_impl, Certificate, Method, IntoUrl, Proxy, RedirectPolicy, wait};
/// A `Client` to make Requests with.
///
@@ -141,6 +141,13 @@ impl ClientBuilder {
self
}
/// Add a `Proxy` to the list of proxies the `Client` will use.
#[inline]
pub fn proxy(&mut self, proxy: Proxy) -> &mut ClientBuilder {
self.inner.proxy(proxy);
self
}
/// Set a `RedirectPolicy` for this client.
///
/// Default will follow redirects up to a maximum of 10.