mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Improve spec conformance around request header validation (#33418)
* fix: improve spec conformance around request header validation Signed-off-by: Shane Handley <shanehandley@fastmail.com> * account for additional test passes Signed-off-by: Shane Handley <shanehandley@fastmail.com> * fix: remove redundant .to_vec call Signed-off-by: Shane Handley <shanehandley@fastmail.com> --------- Signed-off-by: Shane Handley <shanehandley@fastmail.com>
This commit is contained in:
parent
6071b4a961
commit
6a3cdc47ec
8 changed files with 263 additions and 482 deletions
|
@ -13,6 +13,7 @@ use http::method::InvalidMethod;
|
|||
use http::Method as HttpMethod;
|
||||
use js::jsapi::JSObject;
|
||||
use js::rust::HandleObject;
|
||||
use net_traits::fetch::headers::is_forbidden_method;
|
||||
use net_traits::request::{
|
||||
CacheMode as NetTraitsRequestCache, CredentialsMode as NetTraitsRequestCredentials,
|
||||
Destination as NetTraitsRequestDestination, Origin, RedirectMode as NetTraitsRequestRedirect,
|
||||
|
@ -503,14 +504,6 @@ fn is_method(m: &ByteString) -> bool {
|
|||
m.as_str().is_some()
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#forbidden-method
|
||||
fn is_forbidden_method(m: &ByteString) -> bool {
|
||||
matches!(
|
||||
m.to_lower().as_str(),
|
||||
Some("connect") | Some("trace") | Some("track")
|
||||
)
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#cors-safelisted-method
|
||||
fn is_cors_safelisted_method(m: &HttpMethod) -> bool {
|
||||
m == HttpMethod::GET || m == HttpMethod::HEAD || m == HttpMethod::POST
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue