add some traces for proxy
This commit is contained in:
@@ -136,7 +136,7 @@ pub fn new(mut res: ::hyper::client::Response, url: Url, _gzip: bool) -> Respons
|
|||||||
let status = res.status();
|
let status = res.status();
|
||||||
let headers = mem::replace(res.headers_mut(), Headers::new());
|
let headers = mem::replace(res.headers_mut(), Headers::new());
|
||||||
let body = res.body();
|
let body = res.body();
|
||||||
info!("Response: '{}' for {}", status, url);
|
debug!("Response: '{}' for {}", status, url);
|
||||||
Response {
|
Response {
|
||||||
status: status,
|
status: status,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
|
|||||||
@@ -48,11 +48,13 @@ impl Service for Connector {
|
|||||||
fn call(&self, uri: Uri) -> Self::Future {
|
fn call(&self, uri: Uri) -> Self::Future {
|
||||||
for prox in self.proxies.iter() {
|
for prox in self.proxies.iter() {
|
||||||
if let Some(puri) = proxy::intercept(prox, &uri) {
|
if let Some(puri) = proxy::intercept(prox, &uri) {
|
||||||
|
trace!("proxy({:?}) intercepts {:?}", puri, uri);
|
||||||
if uri.scheme() == Some("https") {
|
if uri.scheme() == Some("https") {
|
||||||
let host = uri.host().unwrap().to_owned();
|
let host = uri.host().unwrap().to_owned();
|
||||||
let port = uri.port().unwrap_or(443);
|
let port = uri.port().unwrap_or(443);
|
||||||
let tls = self.tls.clone();
|
let tls = self.tls.clone();
|
||||||
return Box::new(self.https.call(puri).and_then(move |conn| {
|
return Box::new(self.https.call(puri).and_then(move |conn| {
|
||||||
|
trace!("tunneling HTTPS over proxy");
|
||||||
tunnel(conn, host.clone(), port)
|
tunnel(conn, host.clone(), port)
|
||||||
.and_then(move |tunneled| {
|
.and_then(move |tunneled| {
|
||||||
tls.connect_async(&host, tunneled)
|
tls.connect_async(&host, tunneled)
|
||||||
|
|||||||
Reference in New Issue
Block a user