-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fix form submission's encoding algorithms #1330
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2748,7 +2748,6 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d | |
| <li><dfn data-noexport="" data-x-href="https://url.spec.whatwg.org/#concept-host-equals">Host equals</dfn> | ||
| <li><dfn data-noexport="" data-x="serialise an integer" data-x-href="https://url.spec.whatwg.org/#serialize-an-integer">serialise an integer</dfn> | ||
| <li><dfn data-noexport="" data-x-href="https://url.spec.whatwg.org/#default-encode-set">Default encode set</dfn> | ||
| <li><dfn data-noexport="" data-x-href="https://url.spec.whatwg.org/#percent-encode">Percent encode</dfn> | ||
| <li><dfn data-noexport="" data-x-href="https://url.spec.whatwg.org/#utf-8-percent-encode">UTF-8 percent encode</dfn> | ||
| <li><dfn data-noexport="" data-x-href="https://url.spec.whatwg.org/#percent-decode">Percent decode</dfn> | ||
| <li><dfn data-noexport="" data-x-href="https://url.spec.whatwg.org/#set-the-username">set the username</dfn> | ||
|
|
@@ -54448,8 +54447,6 @@ fur | |
| to the <var>submitter</var> element's <span>node document</span>. If this fails, abort these | ||
| steps.</p></li> | ||
|
|
||
| <li><p>Let <var>action</var> be the <span>resulting URL string</span>.</p></li> | ||
|
|
||
| <li><p>Let <var>parsed action</var> be the <span>resulting URL record</span>.</p></li> | ||
|
|
||
| <li><p>Let <var>scheme</var> be the <span data-x="concept-url-scheme">scheme</span> of | ||
|
|
@@ -54575,9 +54572,9 @@ fur | |
| <dt><dfn data-x="submit-mutate-action">Mutate action URL</dfn> | ||
| <dd> | ||
|
|
||
| <p>Let <var>query</var> be the result of running the <span><code | ||
| data-x="">application/x-www-form-urlencoded</code> encoding algorithm</span> with <var>form | ||
| data set</var> and <var>encoding</var>, interpreted as a US-ASCII string.</p> | ||
| <p>Let <var>query</var> be the result of running the | ||
| <span><code>application/x-www-form-urlencoded</code> serializer</span> with <var>form data | ||
| set</var> and <var>encoding</var>.</p> | ||
|
|
||
| <p>Set <var>parsed action</var>'s <span data-x="concept-url-query">query</span> | ||
| component to <var>query</var>.</p> | ||
|
|
@@ -54588,41 +54585,55 @@ fur | |
|
|
||
| <dt><dfn data-x="submit-body">Submit as entity body</dfn> | ||
| <dd> | ||
| <p>Switch on <var>enctype</var>: | ||
|
|
||
| <p>Let <var>entity body</var> be the result of running the <span>appropriate form encoding | ||
| algorithm</span> with <var>form data set</var> and <var>encoding</var>.</p> | ||
| <dl class="switch"> | ||
| <dt><code data-x="attr-fs-enctype-urlencoded">application/x-www-form-urlencoded</code></dt> | ||
|
|
||
| <p>Let <var>MIME type</var> be determined as follows:</p> | ||
| <dd> | ||
| <p>Let <var>body</var> be the result of running the | ||
| <span><code>application/x-www-form-urlencoded</code> serializer</span> with <var>form | ||
| data set</var> and <var>encoding</var>.</p> | ||
|
|
||
| <dl> | ||
| <p>Set <var>body</var> to the result of <span data-x="UTF-8 encode">encoding</span> | ||
| <var>body</var>.</p> | ||
|
|
||
| <dt>If <var>enctype</var> is <code | ||
| data-x="attr-fs-enctype-urlencoded">application/x-www-form-urlencoded</code></dt> | ||
| <p>Let <var>MIME type</var> be "<code>application/x-www-form-urlencoded</code>".</p> | ||
| </dd> | ||
|
|
||
| <dd>Let <var>MIME type</var> be "<code>application/x-www-form-urlencoded</code>".</dd> | ||
| <dt><code data-x="attr-fs-enctype-formdata">multipart/form-data</code></dt> | ||
|
|
||
| <dt>If <var>enctype</var> is <code | ||
| data-x="attr-fs-enctype-formdata">multipart/form-data</code></dt> | ||
| <dd> | ||
| <p>Let <var>body</var> be the result of running the <span><code | ||
| data-x="">multipart/form-data</code> encoding algorithm</span> with <var>form data set</var> | ||
| and <var>encoding</var>.</p> | ||
|
|
||
| <p>Let <var>MIME type</var> be the concatenation of the string "<code | ||
| data-x="">multipart/form-data;</code>", a U+0020 SPACE character, the string "<code | ||
| data-x="">boundary=</code>", and the <span><code data-x="">multipart/form-data</code> | ||
| boundary string</span> generated by the <span><code data-x="">multipart/form-data</code> | ||
| encoding algorithm</span>.</p> | ||
| </dd> | ||
|
|
||
| <dd>Let <var>MIME type</var> be the concatenation of the string "<code | ||
| data-x="">multipart/form-data;</code>", a U+0020 SPACE character, the string "<code | ||
| data-x="">boundary=</code>", and the <span><code data-x="">multipart/form-data</code> boundary | ||
| string</span> generated by the <span><code data-x="">multipart/form-data</code> encoding | ||
| algorithm</span>.</dd> | ||
| <dt><code data-x="attr-fs-enctype-text">text/plain</code></dt> | ||
|
|
||
| <dt>If <var>enctype</var> is <code | ||
| data-x="attr-fs-enctype-text">text/plain</code></dt> | ||
| <dd> | ||
| <p>Let <var>body</var> be the result of running the <span><code data-x="">text/plain</code> | ||
| encoding algorithm</span> with <var>form data set</var> and <var>encoding</var>.</p> | ||
|
||
|
|
||
| <dd>Let <var>MIME type</var> be "<code data-x="">text/plain</code>".</dd> | ||
| <p>Set <var>body</var> to the result of <span data-x="encode">encoding</span> | ||
| <var>body</var> using <var>encoding</var>.</p> | ||
|
|
||
| <p>Let <var>MIME type</var> be "<code data-x="">text/plain</code>".</p> | ||
| </dd> | ||
| </dl> | ||
|
|
||
| <p><span>Plan to navigate</span> to a new <span data-x="concept-request">request</span> whose | ||
| <span data-x="concept-request-url">url</span> is <var>parsed action</var>, <span | ||
| data-x="concept-request-method">method</span> is <var>method</var>, <span | ||
| data-x="concept-request-header-list">header list</span> consists of `<code | ||
| data-x="">Content-Type</code>`/<var>MIME type</var>, and <span | ||
| data-x="concept-request-body">body</span> is <var>entity body</var>.</p> | ||
| data-x="concept-request-body">body</span> is <var>body</var>.</p> | ||
|
|
||
| </dd> | ||
|
|
||
|
|
@@ -54637,9 +54648,9 @@ fur | |
|
|
||
| <dt><dfn data-x="submit-mailto-headers">Mail with headers</dfn> | ||
| <dd> | ||
| <p>Let <var>headers</var> be the result of running the <span><code | ||
| data-x="">application/x-www-form-urlencoded</code> encoding algorithm</span> with <var>form | ||
| data set</var> and <var>encoding</var>, interpreted as a US-ASCII string.</p> | ||
| <p>Let <var>headers</var> be the result of running the | ||
| <span><code>application/x-www-form-urlencoded</code> serializer</span> with <var>form data | ||
| set</var> and <var>encoding</var>.</p> | ||
|
|
||
| <p>Replace occurrences of U+002B PLUS SIGN characters (+) in <var>headers</var> with | ||
| the string "<code data-x="">%20</code>".</p> | ||
|
|
@@ -54652,11 +54663,27 @@ fur | |
|
|
||
| <dt><dfn data-x="submit-mailto-body">Mail as body</dfn> | ||
| <dd> | ||
| <p>Let <var>body</var> be the resulting of running the <span>appropriate form encoding | ||
| algorithm</span> with <var>form data set</var> and <var>encoding</var>, and then <span | ||
| data-x="percent encode">percent encoding</span> all the bytes in the resulting byte string | ||
| that, when interpreted as US-ASCII, are not characters in the URL <span>default encode | ||
| set</span>. <ref spec=URL></p> | ||
| <p>Switch on <var>enctype</var>: | ||
|
|
||
| <dl class="switch"> | ||
| <dt><code data-x="attr-fs-enctype-text">text/plain</code></dt> | ||
|
|
||
| <dd> | ||
| <p>Let <var>body</var> be the result of running the <span><code | ||
| data-x="">text/plain</code> encoding algorithm</span> with <var>form data set</var> and | ||
| <var>encoding</var>.</p> | ||
|
|
||
| <p>Set <var>body</var> to the result of concatonating the result of <span data-x="UTF-8 | ||
| percent encode">UTF-8 percent encoding</span> each code point in <var>body</var>, using the | ||
| <span>default encode set</span>. <ref spec=URL></p> | ||
| </dd> | ||
|
|
||
| <dt>Otherwise</dt> | ||
|
|
||
| <dd><p>Let <var>body</var> be the result of running the | ||
| <span><code>application/x-www-form-urlencoded</code> serializer</span> with <var>form data | ||
| set</var> and <var>encoding</var>.</p></dd> | ||
| </dl> | ||
|
|
||
| <p>If <var>parsed action</var>'s <span data-x="concept-url-query">query</span> is null, then | ||
| set it to the empty string. | ||
|
|
@@ -54667,8 +54694,8 @@ fur | |
| <p>Append "<code data-x="">body=</code>" to <var>parsed action</var>'s <span | ||
| data-x="concept-url-query">query</span>.</p> | ||
|
|
||
| <p>Append <var>body</var>, interpreted as a US-ASCII string, to <var>parsed action</var>'s | ||
| <span data-x="concept-url-query">query</span>.</p> | ||
| <p>Append <var>body</var> to <var>parsed action</var>'s <span | ||
| data-x="concept-url-query">query</span>.</p> | ||
|
|
||
| <p><span>Plan to navigate</span> to <var>parsed action</var>.</p> | ||
| </dd> | ||
|
|
@@ -54702,28 +54729,6 @@ fur | |
|
|
||
| </dl> | ||
|
|
||
| <p>The <dfn>appropriate form encoding algorithm</dfn> is | ||
| determined as follows:</p> | ||
|
|
||
| <dl> | ||
|
|
||
| <dt>If <var>enctype</var> is <code | ||
| data-x="attr-fs-enctype-urlencoded">application/x-www-form-urlencoded</code></dt> | ||
|
|
||
| <dd>Use the <span><code data-x="">application/x-www-form-urlencoded</code> encoding | ||
| algorithm</span>.</dd> | ||
|
|
||
| <dt>If <var>enctype</var> is <code | ||
| data-x="attr-fs-enctype-formdata">multipart/form-data</code></dt> | ||
|
|
||
| <dd>Use the <span><code>multipart/form-data</code> encoding algorithm</span>.</dd> | ||
|
|
||
| <dt>If <var>enctype</var> is <code data-x="attr-fs-enctype-text">text/plain</code></dt> | ||
|
|
||
| <dd>Use the <span><code data-x="">text/plain</code> encoding algorithm</span>.</dd> | ||
|
|
||
| </dl> | ||
|
|
||
| </li> | ||
|
|
||
| </ol> | ||
|
|
@@ -54991,26 +54996,9 @@ fur | |
|
|
||
| <h5>URL-encoded form data</h5> | ||
|
|
||
| <p>See the WHATWG URL standard for details on <code>application/x-www-form-urlencoded</code>. <ref | ||
| spec=URL></p> | ||
|
|
||
| <div w-nodev> | ||
|
|
||
| <p id="application-x-www-form-urlencoded-encoding-algorithm">The <dfn><code | ||
| data-x="">application/x-www-form-urlencoded</code> encoding algorithm</dfn>, given a <var>form | ||
| data set</var> and <var>encoding</var>, is as follows:</p> | ||
|
|
||
| <ol> | ||
|
|
||
| <li><p>Let <var>serialized</var> be the result of running the | ||
| <span><code>application/x-www-form-urlencoded</code> serializer</span> given <var>form data | ||
| set</var> and <var>encoding</var>.</p></li> | ||
|
|
||
| <li><p>Return the result of <span data-x="utf-8 encode">encoding</span> | ||
| <var>serialized</var>.</p></li> | ||
| </ol> | ||
|
|
||
| </div> | ||
| <p id="application-x-www-form-urlencoded-encoding-algorithm"><span | ||
| id="application/x-www-form-urlencoded-encoding-algorithm"></span>See the WHATWG URL standard for | ||
| details on <code>application/x-www-form-urlencoded</code>. <ref spec=URL></p> | ||
|
|
||
|
|
||
| <h5>Multipart form data</h5> | ||
|
|
@@ -55132,8 +55120,7 @@ fur | |
|
|
||
| </li> | ||
|
|
||
| <li><p>Return the result of <span data-x="encode">encoding</span> <var>result</var> using | ||
| <var>encoding</var>.</p></li> | ||
| <li><p>Return <var>result</var>.</p></li> | ||
|
|
||
| </ol> | ||
|
|
||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this just an unused variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The combination of e2d80d9 and 69ea9df landing made it redundant, yes.