Remove proxy method on request (#220)
This commit is contained in:
committed by
GitHub
parent
d6f31ebb52
commit
920eccf37a
@@ -330,7 +330,7 @@ impl<R: Read + Sized + Into<Stream>> PoolReturnRead<R> {
|
|||||||
stream.reset()?;
|
stream.reset()?;
|
||||||
|
|
||||||
// insert back into pool
|
// 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);
|
unit.req.agent.state.pool.add(key, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ use crate::body::BodySize;
|
|||||||
use crate::body::{Payload, SizedReader};
|
use crate::body::{Payload, SizedReader};
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
use crate::header::{self, Header};
|
use crate::header::{self, Header};
|
||||||
use crate::proxy::Proxy;
|
|
||||||
use crate::unit::{self, Unit};
|
use crate::unit::{self, Unit};
|
||||||
use crate::Response;
|
use crate::Response;
|
||||||
|
|
||||||
@@ -419,14 +418,6 @@ impl Request {
|
|||||||
Url::parse(&self.url).map_err(|e| Error::BadUrl(format!("{}", e)))
|
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.
|
// Returns true if this request, with the provided body, is retryable.
|
||||||
pub(crate) fn is_retryable(&self, body: &SizedReader) -> bool {
|
pub(crate) fn is_retryable(&self, body: &SizedReader) -> bool {
|
||||||
// Per https://tools.ietf.org/html/rfc7231#section-8.1.3
|
// Per https://tools.ietf.org/html/rfc7231#section-8.1.3
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ pub(crate) fn connect_host(unit: &Unit, hostname: &str, port: u16) -> Result<Tcp
|
|||||||
} else {
|
} else {
|
||||||
unit.deadline
|
unit.deadline
|
||||||
};
|
};
|
||||||
let proxy: Option<Proxy> = unit.req.proxy();
|
let proxy: Option<Proxy> = unit.req.agent.config.proxy.clone();
|
||||||
let netloc = match proxy {
|
let netloc = match proxy {
|
||||||
Some(ref proxy) => format!("{}:{}", proxy.server, proxy.port),
|
Some(ref proxy) => format!("{}:{}", proxy.server, proxy.port),
|
||||||
None => format!("{}:{}", hostname, port),
|
None => format!("{}:{}", hostname, port),
|
||||||
|
|||||||
Reference in New Issue
Block a user