mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #21933 - notriddle:navigation-redirect-status-code, r=nox
Thread the status through navigation redirects This is necessary because status codes affect whether the redirect is done with the same HTTP method or a different one. This is part of #21886, but there's also a flaw in how iframes are handled that is causing the redirect to take over the entire window, so this commit doesn't entirely fix slither.io. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes are part of #21886, but more changes are needed to actually fix it <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/21933) <!-- Reviewable:end -->
This commit is contained in:
commit
aa9591137a
5 changed files with 57 additions and 0 deletions
|
@ -113,6 +113,9 @@ impl NetworkListener {
|
|||
location_url: metadata.location_url.clone(),
|
||||
headers: headers.clone().into_inner(),
|
||||
referrer: metadata.referrer.clone(),
|
||||
status_code: metadata.status.as_ref()
|
||||
.map(|&(code, _)| code)
|
||||
.unwrap_or(200),
|
||||
});
|
||||
|
||||
// XXXManishearth we don't have the cancel_chan anymore and
|
||||
|
|
|
@ -82,6 +82,7 @@ pub struct ResponseInit {
|
|||
serialize_with = "::hyper_serde::serialize")]
|
||||
#[ignore_malloc_size_of = "Defined in hyper"]
|
||||
pub headers: Headers,
|
||||
pub status_code: u16,
|
||||
pub referrer: Option<ServoUrl>,
|
||||
pub location_url: Option<Result<ServoUrl, String>>,
|
||||
}
|
||||
|
@ -147,6 +148,7 @@ impl Response {
|
|||
res.location_url = init.location_url;
|
||||
res.headers = init.headers;
|
||||
res.referrer = init.referrer;
|
||||
res.status = Some(StatusCode::from_u16(init.status_code));
|
||||
res
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue