Re: [whatwg/fetch] Define data: URLs (#579)

foolip commented on this pull request.



> +
+<p>For an informative description of <code>data:</code> URLs, see RFC 2397. This section replaces
+that RFC's normative processing requirements to be compatible with deployed content. [[RFC2397]]
+
+<p>A <dfn><code>data:</code> URL struct</dfn> is a <a>struct</a> that consists of a
+<dfn for="data: URL struct">MIME type</dfn> (a <a for=/>MIME type</a>) and a
+<dfn for="data: URL struct">body</dfn> (a <a>byte sequence</a>).
+
+<p>The <dfn export><code>data:</code> URL processor</dfn> takes a <a for=/>URL</a>
+<var>dataURL</var> and then runs these steps:
+
+<ol>
+ <li><p>Assert: <var>dataURL</var>'s <a for=url>scheme</a> is "<code>data</code>".
+
+ <li><p>Let <var>input</var> be the result of running the <a>URL serializer</a> on
+ <var>dataURL</var> with the <i>exclude fragment flag</i> set.

Cool, so this is the step that will explain https://wpt.fyi/url/data-uri-fragment.html. @stephenmcgruer FYI in case you want to update the spec link later. (Not necessary, really.)

> + <li><p>Let <var>mimeType</var> be the result of <a>collecting a sequence of code points</a> that
+ are not equal to U+002C (,), given <var>position</var>.
+
+ <li><p><a>Strip leading and trailing ASCII whitespace</a> from <var>mimeType</var>.
+
+ <li><p>If <var>position</var> is past the end of <var>input</var>, then return failure.
+
+ <li><p>Advance <var>position</var> by 1.
+
+ <li><p>Let <var>encodedBody</var> be the remainder of <var>input</var>.
+
+ <li><p>Let <var>body</var> be the <a>string percent decoding</a> of <var>encodedBody</var>.
+
+ <li>
+  <p>If <var>mimeType</var> ends with an <a>ASCII case-insensitive</a> match for
+  "<code>;base64</code>", then:

Can you add a note about what this means for whitespace before and after the `;`?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/579#pullrequestreview-86586883

Received on Thursday, 4 January 2018 12:03:29 UTC