Auto merge of #16262 - jdm:connection-pool, r=nox

Enable HTTP connection pooling

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #15694
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16262)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-05 08:09:23 -05:00 committed by GitHub
commit c2f3cf0205
2 changed files with 4 additions and 3 deletions

View file

@ -487,7 +487,9 @@ fn obtain_response(request_factory: &NetworkHttpRequestFactory,
let response = match request_writer.send() {
Ok(w) => w,
Err(HttpError::Io(ref io_error)) if io_error.kind() == io::ErrorKind::ConnectionAborted => {
Err(HttpError::Io(ref io_error))
if io_error.kind() == io::ErrorKind::ConnectionAborted ||
io_error.kind() == io::ErrorKind::ConnectionReset => {
debug!("connection aborted ({:?}), possibly stale, trying new connection", io_error.description());
continue;
},

View file

@ -330,8 +330,7 @@ impl CoreResourceManager {
let ua = self.user_agent.clone();
let dc = self.devtools_chan.clone();
let filemanager = self.filemanager.clone();
// FIXME(#15694): use group.connector.clone() instead.
let connector = create_http_connector(group.ssl_client.clone());
let connector = group.connector.clone();
thread::Builder::new().name(format!("fetch thread for {}", init.url)).spawn(move || {
let mut request = Request::from_init(init);