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

Make get, decode, and split handle edge cases correctly #1769

Merged
merged 2 commits into from
Aug 30, 2024
Merged
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
54 changes: 29 additions & 25 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,19 @@ A: nosniff
B: sniff
A:
</code></pre>
<tr>
<td>
<pre><code class=lang-http>
A:
B: sniff
</code></pre>
<td>« "" »
<tr>
<td>
<pre><code class=lang-http>
B: sniff
</code></pre>
<td>null
<tr>
<td>
<pre><code class=lang-http>A: text/html;", x/x</code></pre>
Expand Down Expand Up @@ -763,12 +776,12 @@ a <a for=/>header value</a> <var>value</var>, run these steps. They return a <a
<li><p>Let <var>position</var> be a <a for=string>position variable</a> for <var>input</var>,
initially pointing at the start of <var>input</var>.

<li><p>Let <var>values</var> be a <a for=/>list</a> of <a for=/>strings</a>, initially empty.
<li><p>Let <var>values</var> be a <a for=/>list</a> of <a for=/>strings</a>, initially « ».

<li><p>Let <var>temporaryValue</var> be the empty string.

<li>
<p>While <var>position</var> is not past the end of <var>input</var>:
<p>While true:

<ol>
<li>
Expand All @@ -778,40 +791,30 @@ a <a for=/>header value</a> <var>value</var>, run these steps. They return a <a
<p class=note>The result might be the empty string.

<li>
<p>If <var>position</var> is not past the end of <var>input</var>, then:
<p>If <var>position</var> is not past the end of <var>input</var> and the
<a for=/>code point</a> at <var>position</var> within <var>input</var> is U+0022 ("):

<ol>
<li>
<p>If the <a for=/>code point</a> at <var>position</var> within <var>input</var> is
U+0022 ("), then:

<ol>
<li><p>Append the result of <a>collecting an HTTP quoted string</a> from <var>input</var>,
given <var>position</var>, to <var>temporaryValue</var>.
<li><p>Append the result of <a>collecting an HTTP quoted string</a> from <var>input</var>,
given <var>position</var>, to <var>temporaryValue</var>.

<li>If <var>position</var> is not past the end of <var>input</var>, then
<a for=iteration>continue</a>.
</ol>

<li>
<p>Otherwise:

<ol>
<li><p>Assert: the <a for=/>code point</a> at <var>position</var> within <var>input</var> is
U+002C (,).

<li><p>Advance <var>position</var> by 1.
</ol>
<li>If <var>position</var> is not past the end of <var>input</var>, then
<a for=iteration>continue</a>.
</ol>

<li><p>Remove all <a>HTTP tab or space</a> from the start and end of <var>temporaryValue</var>.

<li><p><a for=list>Append</a> <var>temporaryValue</var> to <var>values</var>.

<li><p>Set <var>temporaryValue</var> to the empty string.
</ol>

<li><p>Return <var>values</var>.
<li><p>If <var>position</var> is past the end of <var>input</var>, then return <var>values</var>.

<li><p><a for=/>Assert</a>: the <a for=/>code point</a> at <var>position</var> within
<var>input</var> is U+002C (,).

<li><p>Advance <var>position</var> by 1.
</ol>
</ol>

<p class=note>Except for blessed call sites, the algorithm directly above is not to be invoked
Expand Down Expand Up @@ -9040,6 +9043,7 @@ Brad Porter,
Bryan Smith,
Caitlin Potter,
Cameron McCormack,
Carlo Cannas,
白丞祐 (Cheng-You Bai)<!-- CYBAI; GitHub -->,
Chirag S Kumar<!-- fictionistique; GitHub -->,
Chris Needham,
Expand Down
Loading