mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #28634 - negator:patch-1, r=jdm
Preserve URI fragment across redirects https://www.rfc-editor.org/rfc/rfc7231#section-7.1.2 ``` If the Location value provided in a 3xx (Redirection) response does not have a fragment component, a user agent MUST process the redirection as if the value inherits the fragment component of the URI reference used to generate the request target (i.e., the redirection inherits the original reference's fragment, if any). ``` <!-- Please describe your changes on the following line: --> --- <!-- 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 - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- 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. -->
This commit is contained in:
commit
79fb5ff6d0
1 changed files with 7 additions and 1 deletions
|
@ -831,7 +831,7 @@ pub fn http_fetch(
|
|||
}
|
||||
|
||||
// Substep 2-3.
|
||||
let location = response
|
||||
let mut location = response
|
||||
.actual_response()
|
||||
.headers
|
||||
.get(header::LOCATION)
|
||||
|
@ -845,6 +845,12 @@ pub fn http_fetch(
|
|||
});
|
||||
|
||||
// Substep 4.
|
||||
if let Some(Ok(ref mut location)) = location {
|
||||
if location.fragment().is_none() {
|
||||
let current_url = request.current_url();
|
||||
location.set_fragment(current_url.fragment());
|
||||
}
|
||||
}
|
||||
response.actual_response_mut().location_url = location;
|
||||
|
||||
// Substep 5.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue