Skip to content

Commit

Permalink
[e] (0) WSP: Clarify server-side encoding requirements.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@4399 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Dec 3, 2009
1 parent b22fa61 commit fdfba9b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 20 deletions.
36 changes: 25 additions & 11 deletions complete.html
Expand Up @@ -950,7 +950,8 @@ <h2 class="no-num no-toc" id=status>Status of this document</h2>
<ol>
<li><a href="#reading-the-client's-handshake"><span class=secno>10.3.4.4.1 </span>Reading the client's handshake</a></li>
<li><a href="#sending-the-server's-handshake"><span class=secno>10.3.4.4.2 </span>Sending the server's handshake</a></li>
<li><a href=#ws-sd-framing><span class=secno>10.3.4.4.3 </span>Data framing</a></ol></li>
<li><a href=#ws-sd-framing><span class=secno>10.3.4.4.3 </span>Data framing</a></li>
<li><a href=#handling-errors-in-utf-8-0><span class=secno>10.3.4.4.4 </span>Handling errors in UTF-8</a></ol></li>
<li><a href=#closing-the-connection-0><span class=secno>10.3.4.5 </span>Closing the connection</a></li>
<li><a href=#security-considerations><span class=secno>10.3.4.6 </span>Security considerations</a></li>
<li><a href=#iana-considerations-0><span class=secno>10.3.4.7 </span>IANA considerations</a>
Expand Down Expand Up @@ -65870,7 +65871,7 @@ <h6 id=handshake><span class=secno>10.3.4.3.1 </span>Handshake</h6>
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="">resource name</var> and <var title="">protocol</var>
strings must be US-ASCII and must not contain U+000A LINE FEED (LF)
strings must be ASCII and must not contain U+000A LINE FEED (LF)
or U+000D CARRIAGE RETURN (CR) characters. The <var title="">resource name</var> string must start with a U+002F SOLIDUS
character (/) and must not contain a U+0020 SPACE character. <a href=#refsORIGIN>[ORIGIN]</a></p>

Expand Down Expand Up @@ -65959,7 +65960,7 @@ <h6 id=handshake><span class=secno>10.3.4.3.1 </span>Handshake</h6>
<pre>47 45 54 20</pre>

<p>Send the <var title="">resource name</var> value, encoded as
US-ASCII.</p>
ASCII.</p>

<p>Send the following bytes:</p>

Expand All @@ -65981,12 +65982,12 @@ <h6 id=handshake><span class=secno>10.3.4.3.1 </span>Handshake</h6>
<pre>48 6F 73 74 3A 20</pre>

<p>Send the <var title="">host</var> value, <a href=#converted-to-ascii-lowercase>converted to
ASCII lowercase</a>, and encoded as US-ASCII.</p>
ASCII lowercase</a>, and encoded as ASCII.</p>

<p>If <var title="">secure</var> is false, and <var title="">port</var> is not 80, or if <var title="">secure</var> is
true, and <var title="">port</var> is not 443, then send an 0x3A
byte (ASCII :) followed by the value of <var title="">port</var>,
expressed as a base-ten integer, encoded as US-ASCII.</p>
expressed as a base-ten integer, encoded as ASCII.</p>

<p>Send the following bytes:</p>

Expand All @@ -66003,7 +66004,7 @@ <h6 id=handshake><span class=secno>10.3.4.3.1 </span>Handshake</h6>
<pre>4F 72 69 67 69 6E 3A 20</pre>

<p>Send the <var title="">origin</var> value, <a href=#converted-to-ascii-lowercase>converted to
ASCII lowercase</a>, encoded as US-ASCII. <a href=#refsORIGIN>[ORIGIN]</a></p>
ASCII lowercase</a>, encoded as ASCII. <a href=#refsORIGIN>[ORIGIN]</a></p>

<p class=note>The <var title="">origin</var> value is a string
that was passed to this algorithm.</p>
Expand All @@ -66026,7 +66027,7 @@ <h6 id=handshake><span class=secno>10.3.4.3.1 </span>Handshake</h6>
6F 6C 3A 20</pre>

<p>Send the <var title="">protocol</var> value, encoded as
US-ASCII.</p>
ASCII.</p>

<p>Send the following bytes:</p>

Expand Down Expand Up @@ -66771,15 +66772,15 @@ <h6 id="sending-the-server's-handshake"><span class=secno>10.3.4.4.2 </span>Send

<p>These bytes must be the first bytes sent on the TCP connection by
the server. They must be followed by the <var title="">origin</var>
string, encoded as US-ASCII, followed by the following bytes:</p>
string, encoded as ASCII, followed by the following bytes:</p>

<pre>0D 0A 57 65 62 53 6F 63 6B 65 74 2D 4C 6F 63 61
74 69 6F 6E 3A 20</pre>

<p>The server must then send the string that results from <a href=#construct-a-web-socket-url title="construct a Web Socket URL">constructing a Web Socket
URL</a> from <var title="">host</var>, <var title="">port</var>,
<var title="">resource name</var>, and <var title="">secure
flag</var>, encoded as US-ASCII.</p>
flag</var>, encoded as ASCII.</p>

<p>If the <var title="">subprotocol</var> is not null, then the
server must then send the following bytes:</p>
Expand All @@ -66788,7 +66789,7 @@ <h6 id="sending-the-server's-handshake"><span class=secno>10.3.4.4.2 </span>Send
6F 63 6F 6C 3A 20</pre>

<p>...followed by the <var title="">subprotocol</var> string,
encoded as US-ASCII.</p>
encoded as ASCII.</p>

<p>Finally, the server must end its side of the handshake by sending
the four bytes 0x0D 0x0A 0x0D 0x0A to the client.</p>
Expand Down Expand Up @@ -66863,7 +66864,19 @@ <h6 id=ws-sd-framing><span class=secno>10.3.4.4.3 </span>Data framing</h6>
<li><p>Send a 0xFF byte to the client to indicate the end of the
message.</li>

</ol><h5 id=closing-the-connection-0><span class=secno>10.3.4.5 </span>Closing the connection</h5>
</ol><h6 id=handling-errors-in-utf-8-0><span class=secno>10.3.4.4.4 </span>Handling errors in UTF-8</h6>

<p>When a server is to interpret a byte stream as UTF-8 but finds
that the byte stream is not in fact a valid UTF-8 stream, behaviour
is undefined. A server could close the connection, convert invalid
byte sequences to U+FFFD REPLACEMENT CHARACTERs, store the data
verbatim, or perform application-specific processing. Subprotocols
layered on the Web Socket protocol might define specific behavior
for servers.</p>



<h5 id=closing-the-connection-0><span class=secno>10.3.4.5 </span>Closing the connection</h5>

<p>To <dfn id=close-the-web-socket-connection>close the Web Socket connection</dfn>, either the user
agent or the server closes the TCP/IP connection. There is no
Expand Down Expand Up @@ -86740,6 +86753,7 @@ <h3 class="no-num">Reflecting IDL attributes</h3>
Wolfram Kriesing,
Yi-An Huang,
Yngve Nysaeter Pettersen,
Yuzo Fujishima,
Zhenbin Xu,
Zoltan Herczeg,
and
Expand Down
1 change: 1 addition & 0 deletions index
Expand Up @@ -78604,6 +78604,7 @@ interface <a href=#htmldocument>HTMLDocument</a> {
Wolfram Kriesing,
Yi-An Huang,
Yngve Nysaeter Pettersen,
Yuzo Fujishima,
Zhenbin Xu,
Zoltan Herczeg,
and
Expand Down
31 changes: 22 additions & 9 deletions source
Expand Up @@ -75154,7 +75154,7 @@ Frame type byte &lt;-------------------------------------.
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="">resource name</var> and <var title="">protocol</var>
strings must be US-ASCII and must not contain U+000A LINE FEED (LF)
strings must be ASCII and must not contain U+000A LINE FEED (LF)
or U+000D CARRIAGE RETURN (CR) characters. The <var
title="">resource name</var> string must start with a U+002F SOLIDUS
character (/) and must not contain a U+0020 SPACE character. <a
Expand Down Expand Up @@ -75254,7 +75254,7 @@ Proxy-authorization: Basic ZWRuYW1vZGU6bm9jYXBlcyE=</pre>
<pre>47 45 54 20</pre>

<p>Send the <var title="">resource name</var> value, encoded as
US-ASCII.</p>
ASCII.</p>

<p>Send the following bytes:</p>

Expand All @@ -75276,13 +75276,13 @@ Proxy-authorization: Basic ZWRuYW1vZGU6bm9jYXBlcyE=</pre>
<pre>48 6F 73 74 3A 20</pre>

<p>Send the <var title="">host</var> value, <span>converted to
ASCII lowercase</span>, and encoded as US-ASCII.</p>
ASCII lowercase</span>, and encoded as ASCII.</p>

<p>If <var title="">secure</var> is false, and <var
title="">port</var> is not 80, or if <var title="">secure</var> is
true, and <var title="">port</var> is not 443, then send an 0x3A
byte (ASCII :) followed by the value of <var title="">port</var>,
expressed as a base-ten integer, encoded as US-ASCII.</p>
expressed as a base-ten integer, encoded as ASCII.</p>

<p>Send the following bytes:</p>

Expand All @@ -75299,7 +75299,7 @@ Proxy-authorization: Basic ZWRuYW1vZGU6bm9jYXBlcyE=</pre>
<pre>4F 72 69 67 69 6E 3A 20</pre>

<p>Send the <var title="">origin</var> value, <span>converted to
ASCII lowercase</span>, encoded as US-ASCII. <a
ASCII lowercase</span>, encoded as ASCII. <a
href="#refsORIGIN">[ORIGIN]</a></p>

<p class="note">The <var title="">origin</var> value is a string
Expand All @@ -75323,7 +75323,7 @@ Proxy-authorization: Basic ZWRuYW1vZGU6bm9jYXBlcyE=</pre>
6F 6C 3A 20</pre>

<p>Send the <var title="">protocol</var> value, encoded as
US-ASCII.</p>
ASCII.</p>

<p>Send the following bytes:</p>

Expand Down Expand Up @@ -76165,7 +76165,7 @@ multi-origin semantics described in [ORIGIN] applying. (http-origin)

<p>These bytes must be the first bytes sent on the TCP connection by
the server. They must be followed by the <var title="">origin</var>
string, encoded as US-ASCII, followed by the following bytes:</p>
string, encoded as ASCII, followed by the following bytes:</p>

<pre>0D 0A 57 65 62 53 6F 63 6B 65 74 2D 4C 6F 63 61
74 69 6F 6E 3A 20</pre>
Expand All @@ -76174,7 +76174,7 @@ multi-origin semantics described in [ORIGIN] applying. (http-origin)
title="construct a Web Socket URL">constructing a Web Socket
URL</span> from <var title="">host</var>, <var title="">port</var>,
<var title="">resource name</var>, and <var title="">secure
flag</var>, encoded as US-ASCII.</p>
flag</var>, encoded as ASCII.</p>

<p>If the <var title="">subprotocol</var> is not null, then the
server must then send the following bytes:</p>
Expand All @@ -76183,7 +76183,7 @@ multi-origin semantics described in [ORIGIN] applying. (http-origin)
6F 63 6F 6C 3A 20</pre>

<p>...followed by the <var title="">subprotocol</var> string,
encoded as US-ASCII.</p>
encoded as ASCII.</p>

<p>Finally, the server must end its side of the handshake by sending
the four bytes 0x0D 0x0A 0x0D 0x0A to the client.</p>
Expand Down Expand Up @@ -76285,6 +76285,18 @@ multi-origin semantics described in [ORIGIN] applying. (http-origin)
</ol>


<h6>Handling errors in UTF-8</h6>

<p>When a server is to interpret a byte stream as UTF-8 but finds
that the byte stream is not in fact a valid UTF-8 stream, behaviour
is undefined. A server could close the connection, convert invalid
byte sequences to U+FFFD REPLACEMENT CHARACTERs, store the data
verbatim, or perform application-specific processing. Subprotocols
layered on the Web Socket protocol might define specific behavior
for servers.</p>



<h5>Closing the connection</h5>

<p>To <dfn>close the Web Socket connection</dfn>, either the user
Expand Down Expand Up @@ -97003,6 +97015,7 @@ interface <span>HTMLDocument</span> {
Wolfram Kriesing,
Yi-An Huang,
Yngve Nysaeter Pettersen,
Yuzo Fujishima,
Zhenbin Xu,
Zoltan Herczeg,
and
Expand Down

0 comments on commit fdfba9b

Please sign in to comment.