Skip to content
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

Define the Content-Type header parser #831

Merged
merged 17 commits into from Nov 27, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 30 additions & 7 deletions fetch.bs
Expand Up @@ -2751,14 +2751,16 @@ from a <a for=/>header list</a> <var>headers</var>, run these steps:
<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>
<li><p>Let <var>temporaryMimeType</var> be the result of <a lt="parse a MIME type">parsing</a>
<var>value</var>.
annevk marked this conversation as resolved.
Show resolved Hide resolved

<li><p>If <var>mimeType</var> is failure, then <a for=iteration>continue</a>.
<li><p>If <var>temporaryMimeType</var> is failure or its <a for="MIME type">essence</a> is
"<code>*/*</code>", then <a for=iteration>continue</a>.

<li><p>Set <var>mimeType</var> to <var>temporaryMimeType</var>.

<li>
<p>If <var>mimeType</var>'s <a for="MIME type">essence</a> is not "<code>*/*</code>" or
<var>essence</var>, then:
<p>If <var>mimeType</var>'s <a for="MIME type">essence</a> is not <var>essence</var>, then:

<ol>
<li><p>Set <var>charset</var> to null.
Expand All @@ -2770,12 +2772,14 @@ from a <a for=/>header list</a> <var>headers</var>, run these steps:
<li><p>Set <var>essence</var> to <var>mimeType</var>'s <a for="MIME type">essence</a>.
</ol>

<li><p>Otherwise, if <var>mimeType</var>'s <a for="MIME type">essence</a> is <var>essence</var>,
<var>mimeType</var>'s <a for="MIME type">parameters</a>["<code>charset</code>"] does not
<a for=map>exist</a>, and <var>charset</var> is non-null, set <var>mimeType</var>'s
<li><p>Otherwise, if <var>mimeType</var>'s
<a for="MIME type">parameters</a>["<code>charset</code>"] does not <a for=map>exist</a>, and
<var>charset</var> is non-null, set <var>mimeType</var>'s
<a for="MIME type">parameters</a>["<code>charset</code>"] to <var>charset</var>.
</ol>

<li><p>If <var>mimeType</var> is null, then return failure.

<li><p>Return <var>mimeType</var>.
</ol>
annevk marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -2818,6 +2822,25 @@ Content-Type: x/x
Content-Type: text/html;x=y
</code></pre>
<td><code>text/html;x=y</code>
<tr>
<td>
<pre><code>
Content-Type: text/html
Content-Type: cannot-parse
</code></pre>
<td rowspan=3><code>text/html</code>
<tr>
<td>
<pre><code>
Content-Type: text/html
Content-Type: */*
</code></pre>
<tr>
<td>
<pre><code>
Content-Type: text/html
Content-Type:
</code></pre>
</table>
</div>

Expand Down