aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/net/http_loader.rs26
-rw-r--r--components/net/resource_thread.rs6
-rw-r--r--components/net/tests/fetch.rs10
-rw-r--r--components/net/tests/http_loader.rs5
4 files changed, 7 insertions, 40 deletions
diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs
index 8ba96b01e9e..18e4e696f80 100644
--- a/components/net/http_loader.rs
+++ b/components/net/http_loader.rs
@@ -24,11 +24,8 @@ use headers::{
};
use headers::{AccessControlAllowOrigin, AccessControlMaxAge};
use headers::{CacheControl, ContentEncoding, ContentLength};
-use headers::{
- Host, IfModifiedSince, LastModified, Origin as HyperOrigin, Pragma, Referer, UserAgent,
-};
+use headers::{IfModifiedSince, LastModified, Origin as HyperOrigin, Pragma, Referer, UserAgent};
use http::header::{self, HeaderName, HeaderValue};
-use http::uri::Authority;
use http::{HeaderMap, Request as HyperRequest};
use hyper::{Body, Client, Method, Response as HyperResponse, StatusCode};
use hyper_serde::Serde;
@@ -995,24 +992,7 @@ fn http_network_or_cache_fetch(
// Step 5.16
let current_url = http_request.current_url();
- if let Ok(host) = format!(
- "{}{}",
- current_url.host_str().unwrap(),
- current_url
- .port()
- .map(|v| format!(":{}", v))
- .unwrap_or("".into())
- )
- .parse::<Authority>()
- .map(Host::from)
- {
- http_request.headers.typed_insert(host);
- } else {
- // This error should only happen in cases where hyper and rust-url disagree
- // about how to parse an authority.
- // https://github.com/servo/servo/issues/24175
- error!("Failed to parse {} as authority", current_url);
- }
+ http_request.headers.remove(header::HOST);
// unlike http_loader, we should not set the accept header
// here, according to the fetch spec
@@ -1434,7 +1414,7 @@ fn http_network_fetch(
};
if log_enabled!(log::Level::Info) {
- info!("response for {}", url);
+ info!("{:?} response for {}", res.version(), url);
for header in res.headers().iter() {
info!(" - {:?}", header);
}
diff --git a/components/net/resource_thread.rs b/components/net/resource_thread.rs
index 3e797f8917b..c948055bc55 100644
--- a/components/net/resource_thread.rs
+++ b/components/net/resource_thread.rs
@@ -4,7 +4,7 @@
//! A thread that takes a URL and streams back the binary data.
-use crate::connector::{create_http_client, create_tls_config, ALPN_H1};
+use crate::connector::{create_http_client, create_tls_config, ALPN_H2_H1};
use crate::cookie;
use crate::cookie_storage::CookieStorage;
use crate::fetch::cors_cache::CorsCache;
@@ -149,7 +149,7 @@ fn create_http_states(
http_cache: RwLock::new(http_cache),
http_cache_state: Mutex::new(HashMap::new()),
client: create_http_client(
- create_tls_config(&certs, ALPN_H1),
+ create_tls_config(&certs, ALPN_H2_H1),
HANDLE.lock().unwrap().executor(),
),
};
@@ -162,7 +162,7 @@ fn create_http_states(
http_cache: RwLock::new(HttpCache::new()),
http_cache_state: Mutex::new(HashMap::new()),
client: create_http_client(
- create_tls_config(&certs, ALPN_H1),
+ create_tls_config(&certs, ALPN_H2_H1),
HANDLE.lock().unwrap().executor(),
),
};
diff --git a/components/net/tests/fetch.rs b/components/net/tests/fetch.rs
index 5b6031335cb..f33321cc438 100644
--- a/components/net/tests/fetch.rs
+++ b/components/net/tests/fetch.rs
@@ -14,11 +14,8 @@ use devtools_traits::HttpRequest as DevtoolsHttpRequest;
use devtools_traits::HttpResponse as DevtoolsHttpResponse;
use headers::{AccessControlAllowCredentials, AccessControlAllowHeaders, AccessControlAllowOrigin};
use headers::{AccessControlAllowMethods, AccessControlMaxAge, HeaderMapExt};
-use headers::{
- CacheControl, ContentLength, ContentType, Expires, Host, LastModified, Pragma, UserAgent,
-};
+use headers::{CacheControl, ContentLength, ContentType, Expires, LastModified, Pragma, UserAgent};
use http::header::{self, HeaderMap, HeaderName, HeaderValue};
-use http::uri::Authority;
use http::{Method, StatusCode};
use hyper::body::Body;
use hyper::{Request as HyperRequest, Response as HyperResponse};
@@ -1067,11 +1064,6 @@ fn test_fetch_with_devtools() {
header::ACCEPT_ENCODING,
HeaderValue::from_static("gzip, deflate, br"),
);
- headers.typed_insert(Host::from(
- format!("{}:{}", url.host_str().unwrap(), url.port().unwrap())
- .parse::<Authority>()
- .unwrap(),
- ));
headers.insert(header::ACCEPT, HeaderValue::from_static("*/*"));
diff --git a/components/net/tests/http_loader.rs b/components/net/tests/http_loader.rs
index 480b340df44..fc4fd7153ed 100644
--- a/components/net/tests/http_loader.rs
+++ b/components/net/tests/http_loader.rs
@@ -257,11 +257,6 @@ fn test_request_and_response_data_with_network_messages() {
header::ACCEPT_ENCODING,
HeaderValue::from_static("gzip, deflate, br"),
);
- headers.typed_insert(Host::from(
- format!("{}:{}", url.host_str().unwrap(), url.port().unwrap())
- .parse::<Authority>()
- .unwrap(),
- ));
headers.insert(
header::ACCEPT,