mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
script: dont unwrap in header set (#32973)
Signed-off-by: tobinio <tobias.frischmann1@gmail.com>
This commit is contained in:
parent
b8cf0cf9af
commit
8fab6911d1
2 changed files with 32 additions and 6 deletions
|
@ -214,10 +214,20 @@ impl HeadersMethods for Headers {
|
|||
}
|
||||
// Step 7
|
||||
// https://fetch.spec.whatwg.org/#concept-header-list-set
|
||||
self.header_list.borrow_mut().insert(
|
||||
HeaderName::from_str(&valid_name).unwrap(),
|
||||
HeaderValue::from_bytes(&valid_value).unwrap(),
|
||||
);
|
||||
match HeaderValue::from_bytes(&valid_value) {
|
||||
Ok(value) => {
|
||||
self.header_list
|
||||
.borrow_mut()
|
||||
.insert(HeaderName::from_str(&valid_name).unwrap(), value);
|
||||
},
|
||||
Err(_) => {
|
||||
// can't add the header, but we don't need to panic the browser over it
|
||||
warn!(
|
||||
"Servo thinks \"{:?}\" is a valid HTTP header value but HeaderValue doesn't.",
|
||||
valid_value
|
||||
);
|
||||
},
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue