mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
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:
commit
9caf215beb
6 changed files with 22 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -1450,13 +1450,8 @@ fn test_origin_set() {
|
|||
);
|
||||
|
||||
let origin_url = ServoUrl::parse("http://example.com").unwrap();
|
||||
// XXX: Not sure about the Some(80) here. origin_url.origin() returns 80 for the port but origin_url returns None.
|
||||
origin = Origin::try_from_parts(
|
||||
origin_url.scheme(),
|
||||
origin_url.host_str().unwrap(),
|
||||
Some(80),
|
||||
)
|
||||
.unwrap();
|
||||
origin =
|
||||
Origin::try_from_parts(origin_url.scheme(), origin_url.host_str().unwrap(), None).unwrap();
|
||||
// Test Origin header is set on Get request with CORS mode
|
||||
let mut request = Request::from_init(RequestInit {
|
||||
url: url.clone(),
|
||||
|
|
|
@ -459,7 +459,8 @@ impl HTMLFormElement {
|
|||
.headers
|
||||
.typed_insert(ContentType::from(mime::APPLICATION_WWW_FORM_URLENCODED));
|
||||
|
||||
self.set_encoding_override(load_data.url.as_mut_url().query_pairs_mut())
|
||||
let mut url = load_data.url.clone();
|
||||
self.set_encoding_override(url.as_mut_url().query_pairs_mut())
|
||||
.clear()
|
||||
.extend_pairs(
|
||||
form_data
|
||||
|
@ -467,7 +468,7 @@ impl HTMLFormElement {
|
|||
.map(|field| (field.name.clone(), field.replace_value(charset))),
|
||||
);
|
||||
|
||||
load_data.url.query().unwrap_or("").to_string().into_bytes()
|
||||
url.query().unwrap_or("").to_string().into_bytes()
|
||||
},
|
||||
FormEncType::FormDataEncoded => {
|
||||
let mime: Mime = format!("multipart/form-data; boundary={}", boundary)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue