mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +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)
|
||||
|
|
|
@ -454007,7 +454007,7 @@
|
|||
"support"
|
||||
],
|
||||
"common/form-submission.py": [
|
||||
"467875453c9dc64aac51add3f4a617d941820972",
|
||||
"b296ac44c57c658ca9e3189e9f79b0f80677acba",
|
||||
"support"
|
||||
],
|
||||
"common/get-host-info.sub.js": [
|
||||
|
@ -626623,7 +626623,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"html/semantics/forms/form-submission-0/submit-entity-body.html": [
|
||||
"8363f39ff32cd165a28086b3c594b55a79ced8e5",
|
||||
"a52bb0dcd2080eabb44ab1ddca379da6a5e5ea9a",
|
||||
"testharness"
|
||||
],
|
||||
"html/semantics/forms/form-submission-0/submit-file.sub.html": [
|
||||
|
|
|
@ -6,5 +6,7 @@ def main(request, response):
|
|||
else:
|
||||
result = request.POST.first('foo') == 'bar'
|
||||
|
||||
result = result and request.url_parts.query == 'query=1'
|
||||
|
||||
return ([("Content-Type", "text/plain")],
|
||||
"OK" if result else "FAIL")
|
||||
|
|
|
@ -96,7 +96,7 @@ function run_simple_test() {
|
|||
var testframe = document.getElementById("testframe");
|
||||
var testdocument = testframe.contentWindow.document;
|
||||
testdocument.body.innerHTML =
|
||||
"<form id=testform method=post action=\"form-submission.py\" enctype=\"" + test_obj.enctype + "\">" +
|
||||
"<form id=testform method=post action=\"form-submission.py?query=1\" enctype=\"" + test_obj.enctype + "\">" +
|
||||
test_obj.input +
|
||||
test_obj.submitelement +
|
||||
"</form>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue