[html5] r5185 - [giow] (1) Fail if there are unexpected 0x0Ds in the first line of the handshake [...]

whatwg at whatwg.org whatwg at whatwg.org
Thu Jul 22 12:22:40 PDT 2010


Author: ianh
Date: 2010-07-22 12:22:39 -0700 (Thu, 22 Jul 2010)
New Revision: 5185

Modified:
   complete.html
   source
Log:
[giow] (1) Fail if there are unexpected 0x0Ds in the first line of the handshake. Also, remove some unnecessary references to ASCII in favour of just referencing UTF-8.

Modified: complete.html
===================================================================
--- complete.html	2010-07-22 19:09:44 UTC (rev 5184)
+++ complete.html	2010-07-22 19:22:39 UTC (rev 5185)
@@ -72489,7 +72489,7 @@
 
   <p>The third piece of information is given after the fields, in the
   last eight bytes of the handshake, expressed here as they would be
-  seen if interpreted as ASCII:</p>
+  seen if interpreted as UTF-8:</p>
 
   <pre>Tm[K T2u</pre>
 
@@ -72542,7 +72542,7 @@
   <em>set</em> cookies, as in HTTP.</p>
 
   <p>After the fields, the server sends the aforementioned MD5 sum, a
-  16 byte (128 bit) value, shown here as if interpreted as ASCII:</p>
+  16 byte (128 bit) value, shown here as if interpreted as UTF-8:</p>
 
   <pre>fQJ,fN/4F4!~K~MH</pre>
 
@@ -72842,13 +72842,14 @@
   connection</dfn> to a host <var title="">host</var>, on a port <var title="">port</var>, from an origin whose <a href=#ascii-serialization-of-an-origin title="ASCII
   serialization of an origin">ASCII serialization</a> is <var title="">origin</var>, with a flag <var title="">secure</var>, with
   a string giving a <var title="">resource name</var>, and with a
-  (possibly empty) list of strings giving the <var title="">protocols</var>, it must run the following steps. The <var title="">host</var> must be ASCII-only (i.e. it must have been
-  punycode-encoded already if necessary). The <var title="">origin</var> must not contain characters in the range
+  (possibly empty) list of strings giving the <var title="">protocols</var>, it must run the following steps. The <var title="">host</var> must have been punycode-encoded already if
+  necessary (i.e. it does not contain characters above U+007E). The
+  <var title="">origin</var> must not contain characters in the range
   U+0041 to U+005A (i.e. LATIN CAPITAL LETTER A to LATIN CAPITAL
   LETTER Z). The <var title="">resource name</var> string must be a
-  non-empty string of ASCII characters in the range U+0021 to U+007E
-  that starts with a U+002F SOLIDUS character (/). The various strings
-  in <var title="">protocols</var> must all be non-empty strings with
+  non-empty string of characters in the range U+0021 to U+007E that
+  starts with a U+002F SOLIDUS character (/). The various strings in
+  <var title="">protocols</var> must all be non-empty strings with
   characters in the range U+0021 to U+007E, and must all be unique. <a href=#refsORIGIN>[ORIGIN]</a></p>
 
   <ol><li>
@@ -73242,8 +73243,10 @@
 
     <p>If <var title="">field</var> is not at least seven bytes long,
     or if the last two bytes aren't 0x0D and 0x0A respectively, or if
-    it does not contain at least two 0x20 bytes, then <a href=#fail-the-websocket-connection>fail the
-    WebSocket connection</a> and abort these steps.</p>
+    <var title="">field</var> contains any 0x0D bytes other than the
+    penultimate byte, or if <var title="">field</var> does not contain
+    at least two 0x20 bytes, then <a href=#fail-the-websocket-connection>fail the WebSocket
+    connection</a> and abort these steps.</p>
 
     <p>User agents may apply a timeout to this step, <a href=#fail-the-websocket-connection title="fail
     the WebSocket connection">failing the WebSocket
@@ -73321,7 +73324,7 @@
     <p>Otherwise, handle the byte as described in the appropriate
     entry below:</p>
 
-    <dl class=switch><dt>If the byte is 0x0D (ASCII CR)</dt>
+    <dl class=switch><dt>If the byte is 0x0D (UTF-8 CR)</dt>
 
      <dd>If the <var title="">name</var> byte array is empty, then
      jump to the <a href=#ws-ua-fields-processing>fields
@@ -73329,18 +73332,18 @@
      connection</a> and abort these steps.</dd>
 
 
-     <dt>If the byte is 0x0A (ASCII LF)</dt>
+     <dt>If the byte is 0x0A (UTF-8 LF)</dt>
 
      <dd><a href=#fail-the-websocket-connection>Fail the WebSocket connection</a> and abort these
      steps.</dd>
 
 
-     <dt>If the byte is 0x3A (ASCII :)</dt>
+     <dt>If the byte is 0x3A (UTF-8 :)</dt>
 
      <dd>Move on to the next step.</dd>
 
 
-     <dt>If the byte is in the range 0x41 to 0x5A (ASCII A-Z)</dt>
+     <dt>If the byte is in the range 0x41 to 0x5A (UTF-8 A-Z)</dt>
 
      <dd>Append a byte whose value is the byte's value plus 0x20 to
      the <var title="">name</var> byte array and redo this step for
@@ -73353,8 +73356,8 @@
      array and redo this step for the next byte.</dd>
 
     </dl><p class=note>This reads a field name, terminated by a colon,
-    converting upper-case ASCII letters to lowercase, and aborting if
-    a stray CR or LF is found.</p>
+    converting upper-case letters in the range A-Z to lowercase, and
+    aborting if a stray CR or LF is found.</p>
 
    </li>
 
@@ -73378,17 +73381,17 @@
     <p>Otherwise, handle the byte as described in the appropriate
     entry below:</p>
 
-    <dl class=switch><dt>If the byte is 0x20 (ASCII space) and <var title="">count</var> equals 1</dt>
+    <dl class=switch><dt>If the byte is 0x20 (UTF-8 space) and <var title="">count</var> equals 1</dt>
 
      <dd>Ignore the byte and redo this step for the next byte.</dd>
 
 
-     <dt>If the byte is 0x0D (ASCII CR)</dt>
+     <dt>If the byte is 0x0D (UTF-8 CR)</dt>
 
      <dd>Move on to the next step.</dd>
 
 
-     <dt>If the byte is 0x0A (ASCII LF)</dt>
+     <dt>If the byte is 0x0A (UTF-8 LF)</dt>
 
      <dd><a href=#fail-the-websocket-connection>Fail the WebSocket connection</a> and abort these
      steps.</dd>
@@ -73409,7 +73412,8 @@
     <p>Read a byte from the server.</p>
 
     <p>If the connection closes before this byte is received, or if
-    the byte is not a 0x0A byte (ASCII LF), then <a href=#fail-the-websocket-connection>fail the WebSocket connection</a> and abort these steps.</p>
+    the byte is not a 0x0A byte (UTF-8 LF), then <a href=#fail-the-websocket-connection>fail the
+    WebSocket connection</a> and abort these steps.</p>
 
     <p class=note>This skips past the LF byte of the CRLF after the
     field.</p>
@@ -73436,7 +73440,8 @@
     <p><i>Fields processing</i>: Read a byte from the server.</p>
 
     <p>If the connection closes before this byte is received, or if
-    the byte is not a 0x0A byte (ASCII LF), then <a href=#fail-the-websocket-connection>fail the WebSocket connection</a> and abort these steps.</p>
+    the byte is not a 0x0A byte (UTF-8 LF), then <a href=#fail-the-websocket-connection>fail the
+    WebSocket connection</a> and abort these steps.</p>
 
     <p class=note>This skips past the LF byte of the CRLF after the
     blank line after the fields.</p>
@@ -73653,7 +73658,7 @@
 
     <p class=example>Using the examples given earlier, this leads to
     the 16 bytes 0x30 0x73 0x74 0x33 0x52 0x6C 0x26 0x71 0x2D 0x32
-    0x5A 0x55 0x5E 0x77 0x65 0x75. In ASCII, these bytes correspond to
+    0x5A 0x55 0x5E 0x77 0x65 0x75. In UTF-8, these bytes correspond to
     the string "0st3Rl&q-2ZU^weu".</p>
 
    </li>
@@ -74323,7 +74328,7 @@
 
     <p class=example>In the example above, this would be the 16
     bytes 0x6E 0x60 0x39 0x65 0x42 0x6B 0x39 0x7A 0x24 0x52 0x38 0x70
-    0x4F 0x74 0x56 0x62, or "n`9eBk9z$R8pOtVb" in ASCII.
+    0x4F 0x74 0x56 0x62, or "n`9eBk9z$R8pOtVb" in UTF-8.
 
    </li>
 
@@ -74392,7 +74397,7 @@
 
    <li>
 
-    <p>Send two bytes 0x0D 0x0A (ASCII CRLF).</p>
+    <p>Send two bytes 0x0D 0x0A (UTF-8 CRLF).</p>
 
    </li>
 

Modified: source
===================================================================
--- source	2010-07-22 19:09:44 UTC (rev 5184)
+++ source	2010-07-22 19:22:39 UTC (rev 5185)
@@ -81565,7 +81565,7 @@
 
   <p>The third piece of information is given after the fields, in the
   last eight bytes of the handshake, expressed here as they would be
-  seen if interpreted as ASCII:</p>
+  seen if interpreted as UTF-8:</p>
 
   <pre>Tm[K T2u</pre>
 
@@ -81622,7 +81622,7 @@
   <em>set</em> cookies, as in HTTP.</p>
 
   <p>After the fields, the server sends the aforementioned MD5 sum, a
-  16 byte (128 bit) value, shown here as if interpreted as ASCII:</p>
+  16 byte (128 bit) value, shown here as if interpreted as UTF-8:</p>
 
   <pre>fQJ,fN/4F4!~K~MH</pre>
 
@@ -81982,14 +81982,14 @@
   a string giving a <var title="">resource name</var>, and with a
   (possibly empty) list of strings giving the <var
   title="">protocols</var>, it must run the following steps. The <var
-  title="">host</var> must be ASCII-only (i.e. it must have been
-  punycode-encoded already if necessary). The <var
-  title="">origin</var> must not contain characters in the range
+  title="">host</var> must have been punycode-encoded already if
+  necessary (i.e. it does not contain characters above U+007E). The
+  <var title="">origin</var> must not contain characters in the range
   U+0041 to U+005A (i.e. LATIN CAPITAL LETTER A to LATIN CAPITAL
   LETTER Z). The <var title="">resource name</var> string must be a
-  non-empty string of ASCII characters in the range U+0021 to U+007E
-  that starts with a U+002F SOLIDUS character (/). The various strings
-  in <var title="">protocols</var> must all be non-empty strings with
+  non-empty string of characters in the range U+0021 to U+007E that
+  starts with a U+002F SOLIDUS character (/). The various strings in
+  <var title="">protocols</var> must all be non-empty strings with
   characters in the range U+0021 to U+007E, and must all be unique. <a
   href="#refsORIGIN">[ORIGIN]</a></p>
 
@@ -82422,8 +82422,10 @@
 
     <p>If <var title="">field</var> is not at least seven bytes long,
     or if the last two bytes aren't 0x0D and 0x0A respectively, or if
-    it does not contain at least two 0x20 bytes, then <span>fail the
-    WebSocket connection</span> and abort these steps.</p>
+    <var title="">field</var> contains any 0x0D bytes other than the
+    penultimate byte, or if <var title="">field</var> does not contain
+    at least two 0x20 bytes, then <span>fail the WebSocket
+    connection</span> and abort these steps.</p>
 
     <p>User agents may apply a timeout to this step, <span title="fail
     the WebSocket connection">failing the WebSocket
@@ -82507,7 +82509,7 @@
 
     <dl class="switch">
 
-     <dt>If the byte is 0x0D (ASCII CR)</dt>
+     <dt>If the byte is 0x0D (UTF-8 CR)</dt>
 
      <dd>If the <var title="">name</var> byte array is empty, then
      jump to the <a href="#ws-ua-fields-processing">fields
@@ -82515,18 +82517,18 @@
      connection</span> and abort these steps.</dd>
 
 
-     <dt>If the byte is 0x0A (ASCII LF)</dt>
+     <dt>If the byte is 0x0A (UTF-8 LF)</dt>
 
      <dd><span>Fail the WebSocket connection</span> and abort these
      steps.</dd>
 
 
-     <dt>If the byte is 0x3A (ASCII :)</dt>
+     <dt>If the byte is 0x3A (UTF-8 :)</dt>
 
      <dd>Move on to the next step.</dd>
 
 
-     <dt>If the byte is in the range 0x41 to 0x5A (ASCII A-Z)</dt>
+     <dt>If the byte is in the range 0x41 to 0x5A (UTF-8 A-Z)</dt>
 
      <dd>Append a byte whose value is the byte's value plus 0x20 to
      the <var title="">name</var> byte array and redo this step for
@@ -82541,8 +82543,8 @@
     </dl>
 
     <p class="note">This reads a field name, terminated by a colon,
-    converting upper-case ASCII letters to lowercase, and aborting if
-    a stray CR or LF is found.</p>
+    converting upper-case letters in the range A-Z to lowercase, and
+    aborting if a stray CR or LF is found.</p>
 
    </li>
 
@@ -82569,17 +82571,17 @@
 
     <dl class="switch">
 
-     <dt>If the byte is 0x20 (ASCII space) and <var title="">count</var> equals 1</dt>
+     <dt>If the byte is 0x20 (UTF-8 space) and <var title="">count</var> equals 1</dt>
 
      <dd>Ignore the byte and redo this step for the next byte.</dd>
 
 
-     <dt>If the byte is 0x0D (ASCII CR)</dt>
+     <dt>If the byte is 0x0D (UTF-8 CR)</dt>
 
      <dd>Move on to the next step.</dd>
 
 
-     <dt>If the byte is 0x0A (ASCII LF)</dt>
+     <dt>If the byte is 0x0A (UTF-8 LF)</dt>
 
      <dd><span>Fail the WebSocket connection</span> and abort these
      steps.</dd>
@@ -82602,7 +82604,8 @@
     <p>Read a byte from the server.</p>
 
     <p>If the connection closes before this byte is received, or if
-    the byte is not a 0x0A byte (ASCII LF), then <span>fail the WebSocket connection</span> and abort these steps.</p>
+    the byte is not a 0x0A byte (UTF-8 LF), then <span>fail the
+    WebSocket connection</span> and abort these steps.</p>
 
     <p class="note">This skips past the LF byte of the CRLF after the
     field.</p>
@@ -82631,7 +82634,8 @@
     <p><i>Fields processing</i>: Read a byte from the server.</p>
 
     <p>If the connection closes before this byte is received, or if
-    the byte is not a 0x0A byte (ASCII LF), then <span>fail the WebSocket connection</span> and abort these steps.</p>
+    the byte is not a 0x0A byte (UTF-8 LF), then <span>fail the
+    WebSocket connection</span> and abort these steps.</p>
 
     <p class="note">This skips past the LF byte of the CRLF after the
     blank line after the fields.</p>
@@ -82891,7 +82895,7 @@
 
     <p class="example">Using the examples given earlier, this leads to
     the 16 bytes 0x30 0x73 0x74 0x33 0x52 0x6C 0x26 0x71 0x2D 0x32
-    0x5A 0x55 0x5E 0x77 0x65 0x75. In ASCII, these bytes correspond to
+    0x5A 0x55 0x5E 0x77 0x65 0x75. In UTF-8, these bytes correspond to
     the string "0st3Rl&q-2ZU^weu".</p>
 
    </li>
@@ -83644,7 +83648,7 @@
 
     <p class="example">In the example above, this would be the 16
     bytes 0x6E 0x60 0x39 0x65 0x42 0x6B 0x39 0x7A 0x24 0x52 0x38 0x70
-    0x4F 0x74 0x56 0x62, or "n`9eBk9z$R8pOtVb" in ASCII.
+    0x4F 0x74 0x56 0x62, or "n`9eBk9z$R8pOtVb" in UTF-8.
 
    </li>
 
@@ -83724,7 +83728,7 @@
 
    <li>
 
-    <p>Send two bytes 0x0D 0x0A (ASCII CRLF).</p>
+    <p>Send two bytes 0x0D 0x0A (UTF-8 CRLF).</p>
 
    </li>
 




More information about the Commit-Watchers mailing list