connection pooling

This commit is contained in:
Martin Algesten
2018-06-30 16:52:54 +02:00
parent c5fb12a1fe
commit 4a5944443f
8 changed files with 205 additions and 81 deletions

View File

@@ -6,8 +6,8 @@ use std::sync::Arc;
use super::SerdeValue;
lazy_static! {
static ref URL_BASE: Url = { Url::parse("http://localhost/")
.expect("Failed to parse URL_BASE") };
static ref URL_BASE: Url =
{ Url::parse("http://localhost/").expect("Failed to parse URL_BASE") };
}
/// Request instances are builders that creates a request.
@@ -43,13 +43,14 @@ impl ::std::fmt::Debug for Request {
write!(
f,
"Request({} {}{}, {:?})",
self.method, url.path(), query,
self.method,
url.path(),
query,
self.headers
)
}
}
impl Request {
fn new(agent: &Agent, method: String, path: String) -> Request {
Request {
@@ -95,7 +96,7 @@ impl Request {
.and_then(|url| {
let reader = payload.into_read();
let unit = Unit::new(&self, &url, &reader);
connect(unit, url, &self.method, self.redirects, reader)
connect(unit, &self.method, true, self.redirects, reader)
})
.unwrap_or_else(|e| e.into())
}