Skip to content

Commit

Permalink
LibWeb: Use a more restrictive regex for method token production
Browse files Browse the repository at this point in the history
This changes the regular expression for is_method() to a more
restrictive pattern.
  • Loading branch information
kennethmyhra authored and linusg committed Apr 23, 2022
1 parent 053bcd4 commit fccea88
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ static bool is_forbidden_method(String const& method)
// https://fetch.spec.whatwg.org/#concept-method
static bool is_method(String const& method)
{
Regex<ECMA262Parser> regex { R"~~~(^.*["(),\/:;<=>?@\\[\]{}]+.*$)~~~" };
return !regex.has_match(method);
Regex<ECMA262Parser> regex { R"~~~(^[A-Za-z0-9!#$%&'*+-.^_`|~]+$)~~~" };
return regex.has_match(method);
}

// https://fetch.spec.whatwg.org/#concept-method-normalize
Expand Down

0 comments on commit fccea88

Please sign in to comment.