Navigation Menu

Skip to content

Commit

Permalink
[] (0) Make the Web Socket Protocol handshake more unique. (Re: webso…
Browse files Browse the repository at this point in the history
…cket HTTP response parsing) (credit: pt, jr)

git-svn-id: http://svn.whatwg.org/webapps@1849 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jul 7, 2008
1 parent 6168f23 commit 41b1f18
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
34 changes: 18 additions & 16 deletions index
Expand Up @@ -25,7 +25,7 @@

<h1 id=html-5>HTML 5</h1>

<h2 class="no-num no-toc" id=draft>Draft Recommendation &mdash; 6 July
<h2 class="no-num no-toc" id=draft>Draft Recommendation &mdash; 7 July
2008</h2>

<p>You can take part in this work. <a
Expand Down Expand Up @@ -41618,21 +41618,22 @@ Proxy-authorization: Basic ZWRuYW1vZGU6bm9jYXBlcyE=</pre>
<p class=note>Just a CRLF (a blank line).</p>

<li>
<p>Read the first 75 bytes from the server. If the connection closes
before 75 bytes are received, or if the first 75 bytes aren't exactly
<p>Read the first 85 bytes from the server. If the connection closes
before 85 bytes are received, or if the first 85 bytes aren't exactly
equal to the following bytes, then <a href="#fail-the">fail the Web
Socket connection</a> and abort these steps.</p>

<pre>48 54 54 50 2f 31 2e 31 20 31 30 31 20 53 77 69
74 63 68 69 6e 67 20 50 72 6f 74 6f 63 6f 6c 73
0d 0a 55 70 67 72 61 64 65 3a 20 57 65 62 53 6f
63 6b 65 74 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e
3a 20 55 70 67 72 61 64 65 0d 0a</pre>
<pre>48 54 54 50 2f 31 2e 31 20 31 30 31 20 57 65 62
20 53 6f 63 6b 65 74 20 50 72 6f 74 6f 63 6f 6c
20 48 61 6e 64 73 68 61 6b 65 0d 0a 55 70 67 72
61 64 65 3a 20 57 65 62 53 6f 63 6b 65 74 0d 0a
43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 55 70 67 72
61 64 65 0d 0a</pre>

<p class=note>The string
"HTTP/1.1&nbsp;101&nbsp;Switching&nbsp;Protocols", CRLF, the string
"Upgrade:&nbsp;WebSocket", CRLF, the string "Connection:&nbsp;Upgrade",
CRLF.</p>
"HTTP/1.1&nbsp;101&nbsp;Web&nbsp;Socket&nbsp;Protocol&nbsp;Handshake",
CRLF, the string "Upgrade:&nbsp;WebSocket", CRLF, the string
"Connection:&nbsp;Upgrade", CRLF.</p>

<p class=big-issue>What if the response is a 401 asking for credentials?</p>

Expand Down Expand Up @@ -41956,11 +41957,12 @@ Proxy-authorization: Basic ZWRuYW1vZGU6bm9jYXBlcyE=</pre>
<p>Listen on a port for TCP/IP. Upon receiving a connection request, open a
connection and send the following bytes back to the client:

<pre>48 54 54 50 2f 31 2e 31 20 31 30 31 20 53 77 69
74 63 68 69 6e 67 20 50 72 6f 74 6f 63 6f 6c 73
0d 0a 55 70 67 72 61 64 65 3a 20 57 65 62 53 6f
63 6b 65 74 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e
3a 20 55 70 67 72 61 64 65 0d 0a</pre>
<pre>48 54 54 50 2f 31 2e 31 20 31 30 31 20 57 65 62
20 53 6f 63 6b 65 74 20 50 72 6f 74 6f 63 6f 6c
20 48 61 6e 64 73 68 61 6b 65 0d 0a 55 70 67 72
61 64 65 3a 20 57 65 62 53 6f 63 6b 65 74 0d 0a
43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 55 70 67 72
61 64 65 0d 0a</pre>

<p>Send the string "<code title="">WebSocket-Origin</code>" followed by a
U+003A COLON (":") followed by the <a href="#ascii" title="ASCII
Expand Down
28 changes: 15 additions & 13 deletions source
Expand Up @@ -39200,19 +39200,20 @@ Proxy-authorization: Basic ZWRuYW1vZGU6bm9jYXBlcyE=</pre>

<li>

<p>Read the first 75 bytes from the server. If the connection
closes before 75 bytes are received, or if the first 75 bytes
<p>Read the first 85 bytes from the server. If the connection
closes before 85 bytes are received, or if the first 85 bytes
aren't exactly equal to the following bytes, then <span>fail the
Web Socket connection</span> and abort these steps.</p>

<pre>48 54 54 50 2f 31 2e 31 20 31 30 31 20 53 77 69
74 63 68 69 6e 67 20 50 72 6f 74 6f 63 6f 6c 73
0d 0a 55 70 67 72 61 64 65 3a 20 57 65 62 53 6f
63 6b 65 74 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e
3a 20 55 70 67 72 61 64 65 0d 0a</pre>
<pre>48 54 54 50 2f 31 2e 31 20 31 30 31 20 57 65 62
20 53 6f 63 6b 65 74 20 50 72 6f 74 6f 63 6f 6c
20 48 61 6e 64 73 68 61 6b 65 0d 0a 55 70 67 72
61 64 65 3a 20 57 65 62 53 6f 63 6b 65 74 0d 0a
43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 55 70 67 72
61 64 65 0d 0a</pre>

<p class="note">The string
"HTTP/1.1&nbsp;101&nbsp;Switching&nbsp;Protocols", CRLF, the
"HTTP/1.1&nbsp;101&nbsp;Web&nbsp;Socket&nbsp;Protocol&nbsp;Handshake", CRLF, the
string "Upgrade:&nbsp;WebSocket", CRLF, the string
"Connection:&nbsp;Upgrade", CRLF.</p>

Expand Down Expand Up @@ -39609,11 +39610,12 @@ Proxy-authorization: Basic ZWRuYW1vZGU6bm9jYXBlcyE=</pre>
open a connection and send the following bytes back to the
client:</p>

<pre>48 54 54 50 2f 31 2e 31 20 31 30 31 20 53 77 69
74 63 68 69 6e 67 20 50 72 6f 74 6f 63 6f 6c 73
0d 0a 55 70 67 72 61 64 65 3a 20 57 65 62 53 6f
63 6b 65 74 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e
3a 20 55 70 67 72 61 64 65 0d 0a</pre>
<pre>48 54 54 50 2f 31 2e 31 20 31 30 31 20 57 65 62
20 53 6f 63 6b 65 74 20 50 72 6f 74 6f 63 6f 6c
20 48 61 6e 64 73 68 61 6b 65 0d 0a 55 70 67 72
61 64 65 3a 20 57 65 62 53 6f 63 6b 65 74 0d 0a
43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 55 70 67 72
61 64 65 0d 0a</pre>

<p>Send the string "<code title="">WebSocket-Origin</code>" followed
by a U+003A COLON (":") followed by the <span title="ASCII
Expand Down

0 comments on commit 41b1f18

Please sign in to comment.