mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:04:59 +00:00
AK: Iterate the bytes of a URL query with an unsigned type
Otherwise, we percent-encode negative signed chars incorrectly. For example, https://www.strava.com/login contains the following hidden <input> field: <input name="utf8" type="hidden" value="✓" /> On submitting the form, we would percent-encode that field as: utf8=%-1E%-64%-6D Which would cause us to receive an HTTP 500 response. We now properly percent-encode that field as: utf8=%E2%9C%93 And can login to Strava :^)
This commit is contained in:
parent
dc47210360
commit
e3b5e24ce0
2 changed files with 10 additions and 1 deletions
|
@ -714,7 +714,7 @@ ErrorOr<String> URLParser::percent_encode_after_encoding(StringView input, URL::
|
|||
StringBuilder output;
|
||||
|
||||
// 3. For each byte of encodeOutput converted to a byte sequence:
|
||||
for (auto byte : input) {
|
||||
for (u8 byte : input) {
|
||||
// 1. If spaceAsPlus is true and byte is 0x20 (SP), then append U+002B (+) to output and continue.
|
||||
if (space_as_plus && byte == ' ') {
|
||||
output.append('+');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue