From 126286ab2dcf3e2d541349ed93539a88bf394ad5 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 13 Nov 2018 12:11:52 +0100 Subject: [PATCH] Use HTTP whitespace rather than ASCII whitespace Tests: https://github.com/web-platform-tests/wpt/pull/13615. Fixes #89. --- mimesniff.bs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mimesniff.bs b/mimesniff.bs index 5c773c9..cbc1183 100644 --- a/mimesniff.bs +++ b/mimesniff.bs @@ -217,7 +217,7 @@ a valid MIME type string that does not contain U+003B (;).

To parse a MIME type, given a string input, run these steps:

    -
  1. Remove any leading and trailing ASCII whitespace from input. +

  2. Remove any leading and trailing HTTP whitespace from input.

  3. Let position be a position variable for input, initially pointing at the start of input. @@ -236,7 +236,7 @@ a valid MIME type string that does not contain U+003B (;).

  4. Let subtype be the result of collecting a sequence of code points that are not U+003B (;) from input, given position. -

  5. Remove any trailing ASCII whitespace from subtype. +

  6. Remove any trailing HTTP whitespace from subtype.

  7. If subtype is the empty string or does not solely contain HTTP token code points, then return failure. @@ -252,7 +252,12 @@ a valid MIME type string that does not contain U+003B (;).

  8. Advance position to the next code point in input. (This skips past U+003B (;).) -

  9. Skip ASCII whitespace within input given position. +

  10. +

    Collect a sequence of code points that are HTTP whitespace from + input given position. + +

    This is roughly equivalent to skip ASCII whitespace, except that + HTTP whitespace is used rather than ASCII whitespace.

  11. Let parameterName be the result of collecting a sequence of code points that are not U+003B (;) or U+003D (=) from input, given position. @@ -333,7 +338,7 @@ a valid MIME type string that does not contain U+003B (;). collecting a sequence of code points that are not U+003B (;) from input, given position. -

  12. Remove any trailing ASCII whitespace from parameterValue. +

  13. Remove any trailing HTTP whitespace from parameterValue.

  14. If parameterValue is the empty string, then continue.