From 65afa113e599f743b89fe952dc70e9fcc72102c5 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Fri, 10 Jun 2022 20:39:08 +0200 Subject: [PATCH] AK: Make URL ApplicationXWWWFormUrlencoded encoding closer to spec It was mostly implemented based on a spec note, that described only allowed characters, but instead of allowing some special characters not to be escaped, we escaped every special character except those 'new in this encode set' disallowed characters from the spec definition. --- AK/URL.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/URL.cpp b/AK/URL.cpp index 8923b6924d..3b1744fd78 100644 --- a/AK/URL.cpp +++ b/AK/URL.cpp @@ -402,7 +402,7 @@ bool URL::code_point_is_in_percent_encode_set(u32 code_point, URL::PercentEncode case URL::PercentEncodeSet::Component: return code_point_is_in_percent_encode_set(code_point, URL::PercentEncodeSet::Userinfo) || "$%&+,"sv.contains(code_point); case URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded: - return code_point >= 0x7E || !(is_ascii_alphanumeric(code_point) || "!'()~"sv.contains(code_point)); + return code_point_is_in_percent_encode_set(code_point, URL::PercentEncodeSet::Component) || "!'()~"sv.contains(code_point); case URL::PercentEncodeSet::EncodeURI: // NOTE: This is the same percent encode set that JS encodeURI() uses. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI