Auto merge of #22354 - jdm:ddg, r=Manishearth

Fix DuckDuckGo HTML search

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22090
- [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/22354)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-12-21 23:32:12 -05:00 committed by GitHub
commit 9caf215beb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 13 deletions

View file

@ -793,7 +793,11 @@ fn try_immutable_origin_to_hyper_origin(url_origin: &ImmutableOrigin) -> Option<
match *url_origin {
ImmutableOrigin::Opaque(_) => Some(HyperOrigin::NULL),
ImmutableOrigin::Tuple(ref scheme, ref host, ref port) => {
HyperOrigin::try_from_parts(&scheme, &host.to_string(), Some(port.clone())).ok()
let port = match (scheme.as_ref(), port) {
("http", 80) | ("https", 443) => None,
_ => Some(*port),
};
HyperOrigin::try_from_parts(&scheme, &host.to_string(), port).ok()
},
}
}
@ -1195,6 +1199,13 @@ fn http_network_fetch(
.as_ref()
.map(|_| uuid::Uuid::new_v4().to_simple().to_string());
if log_enabled!(log::Level::Info) {
info!("request for {} ({:?})", url, request.method);
for header in request.headers.iter() {
info!(" - {:?}", header);
}
}
// XHR uses the default destination; other kinds of fetches (which haven't been implemented yet)
// do not. Once we support other kinds of fetches we'll need to be more fine grained here
// since things like image fetches are classified differently by devtools