Remove proxy method on request (#220)

This commit is contained in:
Jacob Hoffman-Andrews
2020-11-12 23:25:05 -08:00
committed by GitHub
parent d6f31ebb52
commit 920eccf37a
3 changed files with 2 additions and 11 deletions

View File

@@ -330,7 +330,7 @@ impl<R: Read + Sized + Into<Stream>> PoolReturnRead<R> {
stream.reset()?;
// insert back into pool
let key = PoolKey::new(&unit.url, unit.req.proxy());
let key = PoolKey::new(&unit.url, unit.req.agent.config.proxy.clone());
unit.req.agent.state.pool.add(key, stream);
}

View File

@@ -9,7 +9,6 @@ use crate::body::BodySize;
use crate::body::{Payload, SizedReader};
use crate::error::Error;
use crate::header::{self, Header};
use crate::proxy::Proxy;
use crate::unit::{self, Unit};
use crate::Response;
@@ -419,14 +418,6 @@ impl Request {
Url::parse(&self.url).map_err(|e| Error::BadUrl(format!("{}", e)))
}
pub(crate) fn proxy(&self) -> Option<Proxy> {
if let Some(proxy) = &self.agent.config.proxy {
Some(proxy.clone())
} else {
None
}
}
// Returns true if this request, with the provided body, is retryable.
pub(crate) fn is_retryable(&self, body: &SizedReader) -> bool {
// Per https://tools.ietf.org/html/rfc7231#section-8.1.3

View File

@@ -338,7 +338,7 @@ pub(crate) fn connect_host(unit: &Unit, hostname: &str, port: u16) -> Result<Tcp
} else {
unit.deadline
};
let proxy: Option<Proxy> = unit.req.proxy();
let proxy: Option<Proxy> = unit.req.agent.config.proxy.clone();
let netloc = match proxy {
Some(ref proxy) => format!("{}:{}", proxy.server, proxy.port),
None => format!("{}:{}", hostname, port),