- From: Timothy Gu <notifications@github.com>
- Date: Mon, 14 Aug 2017 17:04:11 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/pull/579/review/56121208@github.com>
TimothyGu commented on this pull request. > @@ -5630,6 +5621,81 @@ if the script checks that the URL has the right hostname. +<h2 id=data-urls><code>data:</code> URLs</h2> + +<p>For an informative description of <code>data:</code> URLs see RFC 2397. This section replaces its +normative processing requirements. [[!RFC2397]] Informative link instead of normative? > + + <li> + <p>If <var>mimeType</var> contains an <a>ASCII case-insensitive</a> match for + "<code>;base64;</code>" or ends with an <a>ASCII case-insensitive</a> match for + "<code>;base64</code>", then: + + <ol> + <li><p>Set <var>body</var> to the <span class=XXX>web base64 decoding</span> of <var>body</var>. + <!-- web base64 currently takes string input (see window.atob, which defines it for now). I guess + we can convert body to a string first by straightforward mapping, but maybe it would make + more sense if web base64 decoding operated on bytes? Or was polymorphic? --> + + <li><p>If <var>body</var> is failure, then return failure. + + <li><p>Remove the code point sequence that is an <a>ASCII case-insensitive</a> match for + "<code>;base64</code>" from <var>mimeType</var>. Or `;base64;` > + "<code>;base64</code>", then: + + <ol> + <li><p>Set <var>body</var> to the <span class=XXX>web base64 decoding</span> of <var>body</var>. + <!-- web base64 currently takes string input (see window.atob, which defines it for now). I guess + we can convert body to a string first by straightforward mapping, but maybe it would make + more sense if web base64 decoding operated on bytes? Or was polymorphic? --> + + <li><p>If <var>body</var> is failure, then return failure. + + <li><p>Remove the code point sequence that is an <a>ASCII case-insensitive</a> match for + "<code>;base64</code>" from <var>mimeType</var>. + </ol> + + <li><p>If <var>mimeType</var> starts with an <a>ASCII case-insensitive</a> match for + "<code>charset;</code>", then prepend "<code>text/plain</code>" to <var>mimeType</var>. `;charset`? The "starts with" part would also break URLs like `data:;myownprop=abc;charset=UTF-8,%E4%B8%AD%E6%96%87` and `data:;myownprop=abc,stuff`. The latter is technically invalid according to the RFC but works in Chrome and Firefox. > + <li><p>Remove the code point sequence that is an <a>ASCII case-insensitive</a> match for + "<code>;base64</code>" from <var>mimeType</var>. + </ol> + + <li><p>If <var>mimeType</var> starts with an <a>ASCII case-insensitive</a> match for + "<code>charset;</code>", then prepend "<code>text/plain</code>" to <var>mimeType</var>. + + <li><p>If <var>mimeType</var> is the empty string or is not a + <span class=XXX>valid MIME type</span>, then set <var>mimeType</var> to + "<code>text/plain;charset=US-ASCII</code>". + + <li><p>Set <var>mimeTypeBytes</var> to <var>mimeType</var> with each code point mapped to a byte of + equal value. + <!-- See above about a dedicated function. --> + + <li><p>Return <var>mimeTypeBytes</var> and <var>body</var>. Why not return *mimeType* instead? -- 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-56121208
Received on Tuesday, 15 August 2017 00:04:32 UTC