Skip to content

Commit

Permalink
Use collect an HTTP quoted string
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Nov 14, 2018
1 parent 126286a commit 1389eec
Showing 1 changed file with 8 additions and 39 deletions.
47 changes: 8 additions & 39 deletions mimesniff.bs
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,7 @@ a <a>valid MIME type string</a> that does not contain U+003B (;).

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

<li><p>Advance <var>position</var> to the next <a>code point</a> in <var>input</var>. (This skips
past U+002F (/).)
<li><p>Advance <var>position</var> by 1. (This skips past U+002F (/).)

<li><p>Let <var>subtype</var> be the result of <a>collecting a sequence of code points</a> that are
not U+003B (;) from <var>input</var>, given <var>position</var>.
Expand All @@ -249,8 +248,7 @@ a <a>valid MIME type string</a> that does not contain U+003B (;).
<p>While <var>position</var> is not past the end of <var>input</var>:

<ol>
<li><p>Advance <var>position</var> to the next <a>code point</a> in <var>input</var>. (This skips
past U+003B (;).)
<li><p>Advance <var>position</var> by 1. (This skips past U+003B (;).)

<li>
<p><a>Collect a sequence of code points</a> that are <a>HTTP whitespace</a> from
Expand All @@ -271,55 +269,26 @@ a <a>valid MIME type string</a> that does not contain U+003B (;).
<li><p>If the <a>code point</a> at <var>position</var> within <var>input</var> is U+003B (;),
then <a for=iteration>continue</a>.

<li><p>Advance <var>position</var> to the next <a>code point</a> in <var>input</var>. (This
skips past U+003D (=).)
<li><p>Advance <var>position</var> by 1. (This skips past U+003D (=).)
</ol>

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

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

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

<ol>
<li><p>Advance <var>position</var> to the next <a>code point</a> in <var>input</var>.
<li><p>Let <var>unneeded</var> be null.

<li>
<p>While true:
<p>Set <var>parameterValue</var> and <var>unneeded</var> to the result of
<a>collecting an HTTP quoted string</a> from <var>input</var>, given <var>position</var>.

<ol>
<li><p>Append the result of <a>collecting a sequence of code points</a> that are not
U+0022 (") or U+005C (\) from <var>input</var>, given <var>position</var>, to
<var>parameterValue</var>.

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

<ol>
<li><p>Advance <var>position</var> to the next <a>code point</a> in <var>input</var>.

<li>
<p>If <var>position</var> is not past the end of <var>input</var>, then:

<ol>
<li><p>Append the <a>code point</a> at <var>position</var> within <var>input</var> to
<var>parameterValue</var>.

<li><p>Advance <var>position</var> to the next <a>code point</a> in <var>input</var>.

<li><p><a for=iteration>Continue</a>.
</ol>

<li><p>Otherwise, append U+005C (\) to <var>parameterValue</var> and
<a for=iteration>break</a>.
</ol>

<li><p>Otherwise, <a for=iteration>break</a>.
</ol>
<p class=note><var>unneeded</var> is ignored for the purposes of this algorithm.

<li>
<p><a>Collect a sequence of code points</a> that are not U+003B (;) from <var>input</var>,
Expand Down

0 comments on commit 1389eec

Please sign in to comment.