Repository navigation
script: Encode field names and filenames correctly when encoding <form> data - #44943
Merged
Merged
Conversation
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
yezhizhen
commented
May 15, 2026
| [Newline normalization - \\n in name (formdata)] | ||
| expected: FAIL | ||
|
|
||
| [Newline normalization - \\r in name (urlencoded)] |
Member
Author
There was a problem hiding this comment.
I guess we have the same problem for urlencoded form. Checking this later.
yezhizhen
commented
May 15, 2026
| // This character isn't LF but is | ||
| // preceded by CR | ||
| _ if prev == '\r' => { | ||
| buf.push('\r'); |
Member
Author
There was a problem hiding this comment.
This was buggy before. For example, \rA would generate \r\r\nA previously. New passing.
3 tasks done
yezhizhen
marked this pull request as ready for review
May 15, 2026 05:35
TimvdLippe
approved these changes
May 15, 2026
| fn escape_for_header(s: &DOMString) -> String { | ||
| s.str() | ||
| .replace('\r', "%0D") | ||
| .replace('\n', "%0A") |
Contributor
There was a problem hiding this comment.
Ultra-nit: the order is different here than what's written in the spec
Signed-off-by: Euclid Ye <[email protected]>
yezhizhen
enabled auto-merge
May 15, 2026 07:10
alice
pushed a commit
to alice/servo
that referenced
this pull request
May 15, 2026
…rm>` data (servo#44943) [Spec](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart/form-data-encoding-algorithm) 1. Escape field name for non-file field correctly. Escape both field name and filenames for field field correctly. 2. Fixed a corner case bug in step 1 implementation. Testing: Many new passing in existing WPT. I was still following the FileAPI, but somehow the fix is about form data. The tests should probably be moved to `forms` folder. But that should probably be discussed in upstream. Part of servo#10778 --------- Signed-off-by: Euclid Ye <[email protected]>
pull Bot
pushed a commit
to A-Archives-and-Forks/servo
that referenced
this pull request
May 16, 2026
…ed `<form>` POST (servo#44953) [Spec](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-enctype-urlencoded) for submit entity body (POST) for x-www-form-urlencoded. We also extract inner fn `clean_crlf` to `normalize_crlf` as this is widely common. Follow up of servo#44943. Testing: Passing in existing tests. Part of servo#10778. (Well this isn't FileAPI, but that's what led me here.) --------- Signed-off-by: Euclid Ye <[email protected]>
jschwe
pushed a commit
to jschwe/servo
that referenced
this pull request
Jun 26, 2026
…rm>` data (servo#44943) [Spec](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart/form-data-encoding-algorithm) 1. Escape field name for non-file field correctly. Escape both field name and filenames for field field correctly. 2. Fixed a corner case bug in step 1 implementation. Testing: Many new passing in existing WPT. I was still following the FileAPI, but somehow the fix is about form data. The tests should probably be moved to `forms` folder. But that should probably be discussed in upstream. Part of servo#10778 --------- Signed-off-by: Euclid Ye <[email protected]> (cherry picked from commit 590d22c)
jschwe
pushed a commit
that referenced
this pull request
Jun 26, 2026
…rm>` data (#44943) [Spec](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart/form-data-encoding-algorithm) 1. Escape field name for non-file field correctly. Escape both field name and filenames for field field correctly. 2. Fixed a corner case bug in step 1 implementation. Testing: Many new passing in existing WPT. I was still following the FileAPI, but somehow the fix is about form data. The tests should probably be moved to `forms` folder. But that should probably be discussed in upstream. Part of #10778 --------- Signed-off-by: Euclid Ye <[email protected]> (cherry picked from commit 590d22c)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec
Testing: Many new passing in existing WPT. I was still following the FileAPI, but somehow the fix is about form data. The tests should probably be moved to
formsfolder. But that should probably be discussed in upstream.Part of #10778