[whatwg] some comments on establish a WebSocket connection

Simon Pieters simonp at opera.com
Thu Apr 1 02:04:51 PDT 2010

The establish a WebSocket connection algorithm says:

35. ...

↪If the byte is 0x20 (ASCII space)
Ignore the byte and move on to the next step.

Treat the byte as described by the list in the next step, then move on to  
that next step for real.

Note: This skips past a space character after the colon, if necessary.

36. Read a byte from the server.

If the connection closes before this byte is received, then fail the  
WebSocket connection and abort these steps.

Otherwise, handle the byte as described in the appropriate entry below:

↪If the byte is 0x0D (ASCII CR)
Move on to the next step.

Consider the case when the server gives a colon followed by CR. My reading  
is that step 36 will be run twice:

Upon receiving the CR in step 35, "Treat the byte as described by the list  
in the next step" which is "Move on to the next step." (i.e. step 37),  
"then move on to that next step for real." (i.e. step 36).

Step 41 says:

If the entry's name is "set-cookie" or "set-cookie2" or another  
cookie-related field name

If the relevant specification is supported by the user agent, handle the  
cookie as defined by the appropriate specification, with the resource  
being the one with the host host, the port port, the path (and possibly  
query parameters) resource name, and the scheme http if secure is false  
and https if secure is true. [COOKIES]

What should be done if the relevant specification is not supported?

Simon Pieters
Opera Software

More information about the whatwg mailing list