mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Fixes for HTTP header compliance. (#32024)
- Fix 400 errors from nginx in response to Servo requests by implementing conformant albeit non-normative removal of whitespace from `Accept` and `Accept-Language` HTTP headers. (To match behaviour of Firefox, Safari, and Chrome) https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2 - Provide `Host` header as REQUIRED by HTTP protocol https://www.rfc-editor.org/rfc/rfc9110#field.host - Update tests.
This commit is contained in:
parent
62a25fdcc4
commit
10ec8565ea
4 changed files with 44 additions and 24 deletions
|
@ -59,9 +59,9 @@ where
|
|||
fmt::Display::fmt(&self.item, fmt)?;
|
||||
match self.quality.0 {
|
||||
1000 => Ok(()),
|
||||
0 => fmt.write_str("; q=0"),
|
||||
0 => fmt.write_str(";q=0"),
|
||||
mut x => {
|
||||
fmt.write_str("; q=0.")?;
|
||||
fmt.write_str(";q=0.")?;
|
||||
let mut digits = *b"000";
|
||||
digits[2] = (x % 10) as u8 + b'0';
|
||||
x /= 10;
|
||||
|
@ -81,7 +81,7 @@ pub fn quality_to_value(q: Vec<QualityItem<Mime>>) -> HeaderValue {
|
|||
&q.iter()
|
||||
.map(|q| q.to_string())
|
||||
.collect::<Vec<String>>()
|
||||
.join(", "),
|
||||
.join(","),
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue