Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 11 additions & 76 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2296,7 +2296,6 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn id="ascii-letters" data-x-href="https://infra.spec.whatwg.org/#ascii-alpha">ASCII alpha</dfn></li>
<li><dfn id="alphanumeric-ascii-characters" data-x-href="https://infra.spec.whatwg.org/#ascii-alphanumeric">ASCII alphanumeric</dfn></li>
<li><dfn data-x-href="https://infra.spec.whatwg.org/#isomorphic-decode">isomorphic decode</dfn></li>
<li><dfn data-x-href="https://infra.spec.whatwg.org/#isomorphic-encode">isomorphic encode</dfn></li>
<li><dfn data-x="converted to ASCII lowercase" data-x-href="https://infra.spec.whatwg.org/#ascii-lowercase">ASCII lowercase</dfn></li>
<li><dfn data-x="converted to ASCII uppercase" data-x-href="https://infra.spec.whatwg.org/#ascii-uppercase">ASCII uppercase</dfn></li>
<li><dfn data-x-href="https://infra.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</dfn></li>
Expand Down Expand Up @@ -2670,6 +2669,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x="concept-header-list" data-x-href="https://fetch.spec.whatwg.org/#concept-header-list">header list</dfn></li>
<li><dfn data-x="concept-header-list-set" data-x-href="https://fetch.spec.whatwg.org/#concept-header-list-set">set</dfn></li>
<li><dfn data-x="concept-header-list-get-decode-split" data-x-href="https://fetch.spec.whatwg.org/#concept-header-list-get-decode-split">get, decode, and split</dfn></li>
<li>the <dfn data-x-href="https://fetch.spec.whatwg.org/#multipart-form-data-chunk-serializer"><code>multipart/form-data</code> chunk serializer</dfn></li>
<li><dfn data-x="fetch-controller-abort" data-x-href="https://fetch.spec.whatwg.org/#fetch-controller-abort">abort</dfn></li>
<li><dfn data-x-href="https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check">cross-origin resource policy check</dfn></li>
<li>the <dfn data-x-href="https://fetch.spec.whatwg.org/#requestcredentials"><code>RequestCredentials</code></dfn> enumeration</li>
Expand Down Expand Up @@ -64741,15 +64741,15 @@ fur
<dt><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>entry list</var>
<p>Let (<var>boundary</var>, <var>chunks</var>) be the result of running the <span><code
data-x="">multipart/form-data</code> chunk serializer</span> with <var>entry list</var>
and <var>encoding</var>.</p>

<p>Let <var>mimeType</var> be the <span data-x="isomorphic encode">isomorphic
encoding</span> of the concatenation of "<code
data-x="">multipart/form-data; 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>
<p>Let <var>body</var> be the concatenation of <var>chunks</var>, with each
<code>File</code> object in <var>chunks</var> replaced by the bytes it represents.</p>

<p>Let <var>mimeType</var> be `<code data-x="">multipart/form-data; boundary=</code>`,
followed by <var>boundary</var>.</p>
</dd>

<dt><code data-x="attr-fs-enctype-text">text/plain</code></dt>
Expand Down Expand Up @@ -65184,74 +65184,9 @@ fur

<h5>Multipart form data</h5>

<div w-nodev>

<!-- https://hixie.ch/tests/adhoc/html/forms/submission/multipart_form-data/ -->

<!-- NOTE: This algorithm is also used by
https://fetch.spec.whatwg.org/#concept-bodyinit-extract -->

<div algorithm>
<p>The <dfn export><code>multipart/form-data</code> encoding algorithm</dfn>, given an <span>entry
list</span> <var>entry list</var> and an <span>encoding</span> <var>encoding</var>, is as
follows:</p>

<ol>
<li>
<p><span data-x="list iterate">For each</span> <var>entry</var> of <var>entry list</var>:</p>

<ol>
<li><p>Replace every occurrence of U+000D (CR) not followed by U+000A (LF), and every
occurrence of U+000A (LF) not preceded by U+000D (CR), in <var>entry</var>'s <span data-x="form
entry name">name</span>, by a string consisting of a U+000D (CR) and U+000A (LF).</p></li>

<li><p>If <var>entry</var>'s <span data-x="form entry value">value</span> is not a
<code>File</code> object, then replace every occurrence of U+000D (CR) not followed by U+000A
(LF), and every occurrence of U+000A (LF) not preceded by U+000D (CR), in <var>entry</var>'s
<span data-x="form entry value">value</span>, by a string consisting of a U+000D (CR) and
U+000A (LF).</p></li>
</ol>
</li>

<li>
<p>Return the byte sequence resulting from encoding the <var>entry list</var> using the rules
described by RFC 7578, <cite>Returning Values from Forms: <code
data-x="">multipart/form-data</code></cite>, given the following conditions:
<ref>RFC7578</ref></p>

<ul>
<li><p>Each <span data-x="form entry">entry</span> in <var>entry list</var> is a <i>field</i>,
the <span data-x="form entry name">name</span> of the entry is the <i>field name</i> and the
<span data-x="form entry value">value</span> of the entry is the <i>field value</i>.</p></li>

<li><p>The order of parts must be the same as the order of fields in <var>entry list</var>.
Multiple entries with the same name must be treated as distinct fields.</p></li>

<li><p>Field names, field values for non-file fields, and filenames 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.</p></li>

<li><p>For field names and filenames 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>

<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>

<li><p>The boundary used by the user agent in generating the return value of this algorithm is
the <dfn export><code>multipart/form-data</code> boundary string</dfn>. (This value is used to
generate the MIME type of the form submission payload generated by this algorithm.)</p></li>
</ul>
</li>
</ol>
</div>

</div>

<p>For details on how to interpret <code>multipart/form-data</code> payloads, see RFC 7578.
<ref>RFC7578</ref></p>
<p id="multipart/form-data-encoding-algorithm"><span
id="multipart/form-data-boundary-string"></span>See <cite>Fetch</cite> for details on
<code>multipart/form-data</code>. <ref>FETCH</ref></p>


<h5>Plain text form data</h5>
Expand Down
Loading