-
Notifications
You must be signed in to change notification settings - Fork 3k
Specify escaping in the multipart/form-data encoding algorithm #6282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56546,10 +56546,12 @@ fur | |
<li><p>Field names, field values for non-file fields, and file names for file fields, in the | ||
generated <code>multipart/form-data</code> resource must be set to the result of <span | ||
data-x="encode">encoding</span> the corresponding entry's name or value with | ||
<var>encoding</var>, converted to a byte sequence. In the case of file names, however, the | ||
precise name may be approximated if necessary (e.g., newlines could be removed from file names, | ||
quotes could be changed to "<code data-x="">%22</code>", and characters not expressible in | ||
<var>encoding</var> could be replaced by other characters before encoding).</p></li> | ||
<var>encoding</var>, converted to a byte sequence.</p></li> | ||
|
||
<li><p>For field names and file names for file fields, the result of the encoding in the | ||
|
||
previous bullet point must be escaped by replacing any 0x0A (LF) bytes with the byte sequence | ||
`<code data-x="">%0A</code>`, 0x0D (CR) with `<code data-x="">%0D</code>` and 0x22 (") with | ||
`<code data-x="">%22</code>`. The user agent must not perform any other escapes.</p></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please clarify how server-side software should distinguish filenames like The line says "must not perform any other escapes", so if the filename was Am I missing something? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, currently there is no way for server-side software to tell between those two filenames. There's a proposal to fix this in #7575, but it's not clear that making that change will not break currently existing servers. Note that this PR made the specification align to what two out of three browser engines (Chrome and Safari) were already doing. And while Firefox's behavior back then did distinguish There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A related issue: it looks like there's no way to tell which encoding did browser use to encode the filename. Does it make sense to add an explicit field for it somewhere? I'm trying to fix unicode filename upload in Apache JMeter, so I am interested in understanding the encodings better. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the form contains an But in the general case, the encoding name is not included in the form submission body, and I doubt a proposal to include it would gain much support from browser vendors, since UTF-8 is preferred for modern websites. |
||
|
||
andreubotella marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
<li><p>The parts of the generated <code>multipart/form-data</code> resource that correspond to | ||
non-file fields must not have a `<code>Content-Type</code>` header specified.</p></li> | ||
|
Uh oh!
There was an error while loading. Please reload this page.