Skip to content

Commit

Permalink
[] (0) Add a protocol flag to WebSocket(), which, if set, must be ech…
Browse files Browse the repository at this point in the history
…oed by the server.

git-svn-id: http://svn.whatwg.org/webapps@2977 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Apr 24, 2009
1 parent e405e08 commit 7a943f8
Showing 1 changed file with 55 additions and 11 deletions.
66 changes: 55 additions & 11 deletions source
Expand Up @@ -61627,7 +61627,7 @@ data:&nbsp;test</pre>

<h4>The <code>WebSocket</code> interface</h4>

<pre class="idl">[<span title="dom-WebSocket">Constructor</span>(in DOMString url)]
<pre class="idl">[<span title="dom-WebSocket">Constructor</span>(in DOMString url, [Optional] in DOMString protocol)]
interface <dfn>WebSocket</dfn> {
readonly attribute DOMString <span title="dom-WebSocket-URL">URL</span>;

Expand All @@ -61650,10 +61650,13 @@ interface <dfn>WebSocket</dfn> {
href="#refsDOM3EVENTS">[DOM3EVENTS]</a>

<p>The <dfn title="dom-WebSocket"><code>WebSocket(<var
title="">url</var>)</code></dfn> constructor takes one argument,
<var title="">url</var>, which specifies the <span>URL</span> to
which to connect. When the <code>WebSocket()</code> constructor is
invoked, the UA must run these steps:</p>
title="">url</var>, <var title="">protocol</var>)</code></dfn>
constructor takes one or two arguments. The first argument, <var
title="">url</var>, specifies the <span>URL</span> to which to
connect. The second, <var title="">protocol</var>, if present,
specifies a sub-protocol that the server must support for the
connection to be successful. When the <code>WebSocket()</code>
constructor is invoked, the UA must run these steps:</p>

<ol>

Expand All @@ -61667,6 +61670,11 @@ interface <dfn>WebSocket</dfn> {
case-insensitive</span> manner, then throw a
<code>SYNTAX_ERR</code> exception.</p></li>

<li><p>If <var title="">protocol</var> is specified but is either
the empty string or contains characters that are not in the range
U+0021 .. U+007E, then throw a <code>SYNTAX_ERR</code>
exception.</p></li>

<li><p>Return a new <code>WebSocket</code> object, and continue
these steps in the background (without blocking scripts).</p></li>

Expand Down Expand Up @@ -61708,8 +61716,9 @@ interface <dfn>WebSocket</dfn> {
<li><p><span>Establish a Web Socket connection</span> to a host
<var title="">host</var>, on port <var title="">port</var> (if one
was specified), from <var title="">origin</var>, with the flag <var
title="">secure</var>, and with <var title="">resource name</var>
as the resource name.</p></li>
title="">secure</var>, with <var title="">resource name</var> as
the resource name, and with <var title="">protocol</var> as the
protocol (if it is present).</p></li>

</ol>

Expand Down Expand Up @@ -61889,9 +61898,10 @@ interface <dfn>WebSocket</dfn> {
<p>When the user agent is to <dfn>establish a Web Socket
connection</dfn> to a host <var title="">host</var>, optionally on
port <var title="">port</var>, from an origin <var
title="">origin</var>, with a flag <var title="">secure</var>, and
with a particular <var title="">resource name</var>, it must run the
following steps.</p>
title="">origin</var>, with a flag <var title="">secure</var>, with
a particular <var title="">resource name</var>, and optionally with
a particular <var title="">protocol</var>, it must run the following
steps.</p>

<p class="note">The <var title="">host</var> and <var
title="">origin</var> strings will be all-lowercase when this
Expand Down Expand Up @@ -62006,6 +62016,27 @@ Proxy-authorization: Basic ZWRuYW1vZGU6bm9jYXBlcyE=</pre>

</li>

<li>

<p>If there is no <var title="">protocol</var>, then skip this step.</p>

<p>Othewrise, send the following bytes:</p>

<pre>57 65 62 53 6f 63 6b 65 74 2d 50 72 6f 74 6f 63
6f 6c 3a 20</pre>

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

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

<pre>0d 0a</pre>

<p class="note">The string "WebSocket-Protocol:&nbsp;", the
protocol, and CRLF.</p>

</li>

<li>

<p>If the client has any authentication information or cookies
Expand Down Expand Up @@ -62237,7 +62268,10 @@ Proxy-authorization: Basic ZWRuYW1vZGU6bm9jYXBlcyE=</pre>
in the <var title="">headers</var> list whose name is "<code
title="">websocket-origin</code>", or if there is not exactly one
entry in the <var title="">headers</var> list whose name is "<code
title="">websocket-location</code>", or if there are any entries
title="">websocket-location</code>", or if the <var
title="">protocol</var> was specified but there is not exactly one
entry in the <var title="">headers</var> list whose name is "<code
title="">websocket-protocol</code>", or if there are any entries
in the <var title="">headers</var> list whose names are the empty
string, then <span>fail the Web Socket connection</span> and abort
these steps.</p>
Expand Down Expand Up @@ -62306,6 +62340,16 @@ Proxy-authorization: Basic ZWRuYW1vZGU6bm9jYXBlcyE=</pre>
</dd>


<dt>If the entry's name is "<code
title="">websocket-protocol</code>"</dt>

<dd><p>If there was a <var title="">protocol</var> specified, and
the value is not exactly equal to <var title="">protocol</var>,
then <span>fail the Web Socket connection</span> and abort these
steps. (If no <var title="">protocol</var> was specified, the
header is ignored.)</p></dd>


<dt>If the entry's name is "<code title="">set-cookie</code>" or
"<code title="">set-cookie2</code>" or another cookie-related
header name</dt>
Expand Down

0 comments on commit 7a943f8

Please sign in to comment.