mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
concept-response-clone: Ensure header guard is cloned after headers
https://fetch.spec.whatwg.org/#concept-response-clone
If the header guard of the response to clone is `immutable`, then copying the headers to the new response will fail with `Guard is immutable` unless we ensure the guard is copied _after_ the headers.
8650794391/components/script/dom/response.rs (L331-L334)
fn Append(&self, name: ByteString, value: ByteString) -> ErrorResult {
// Step 1
let value = normalize_value(value);
// Step 2
let (mut valid_name, valid_value) = validate_name_and_value(name, value)?;
valid_name = valid_name.to_lowercase();
// Step 3
if self.guard.get() == Guard::Immutable {
return Err(Error::Type("Guard is immutable".to_string()));
}
This commit is contained in:
parent
8650794391
commit
a744ac26da
1 changed files with 1 additions and 1 deletions
|
@ -330,8 +330,8 @@ impl ResponseMethods for Response {
|
|||
|
||||
// Step 2
|
||||
let new_response = Response::new(&self.global());
|
||||
new_response.Headers().set_guard(self.Headers().get_guard());
|
||||
new_response.Headers().copy_from_headers(self.Headers())?;
|
||||
new_response.Headers().set_guard(self.Headers().get_guard());
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-response-clone
|
||||
// Instead of storing a net_traits::Response internally, we
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue