Re: [whatwg/fetch] Define the Content-Type header parser (#831)

annevk commented on this pull request.



> +  <p><a for=list>For each</a> <var>value</var> of <var>values</var>:
+
+  <ol>
+   <li><p>Set <var>mimeType</var> to the result of <a lt="parse a MIME type">parsing</a>
+   <var>value</var>.
+
+   <li><p>If <var>mimeType</var> is failure, then <a for=iteration>continue</a>.
+
+   <li>
+    <p>If <var>mimeType</var>'s <a for="MIME type">essence</a> is not "<code>*/*</code>" or
+    <var>essence</var>, then:
+
+    <ol>
+     <li><p>Set <var>charset</var> to null.
+
+     <li><p>If <var>mimeType</var>'s <a for="MIME type">parameters</a>["<code>charset</code>"]

To be specific, the `Content-Type` parser defined at https://whatpr.org/fetch/831.html#cors-safelisted-request-header for use on requests fails on `text/plain,application/json` as it doesn't split. (And this is intentional for security reasons.)

Anyway, it would indeed be a rather big simplification if we'd simply use the first value as that would also remove the need for `charset` moving and such. I'm rather skeptical this'll work out, but if you want to try it I guess I'm not opposed.

-- 
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/831#discussion_r235466341

Received on Wednesday, 21 November 2018 16:51:41 UTC