Subject: [hybi] Mismatch in Sec-WebSocket-Protocol in -03 specification

From: Micheil Smith <[email-masked]>
Date: Wed, 20 Oct 2010 12:03:29 +1100

I've just noticed that there seems to be a mismatch between what the W3C's WebSocket 
interface and the draft-03 document define. The W3C mandates that the protocols must 
not contain the space character or any characters that are not printable ASCII characters. 

However, the -03 specification says that say characters are okay.

From http://dev.w3.org/html5/websockets/ 
	
	The WebSocket(url, protocols) constructor takes one or two arguments. The first 
	argument, url, specifies the URL to which to connect. The second, protocols, if 
	present, is either a string or an array of strings. If it is a string, it is equivalent to an 
	array consisting of just that string; if it is omitted, it is equivalent to the empty array. 
	Each string in the array is a subprotocol name. The connection will only be established 
	if the server reports that it has selected one of these subprotocols. The subprotocol 
	names must all be non-empty ASCII strings with no control characters and no spaces 
	in them (i.e. only characters in the range U+0021 to U+007E).

However, in draft-03, we see:

	Otherwise, generate the acceptable protocol string by joining	
	each protocol in /protocols/ using a U+0020 SPACE character.	
        Add the string consisting of the concatenation of the string	
 	"Sec-WebSocket-Protocol:", a U+0020 SPACE character, and the	
 	acceptable protocol string generated above, to /fields/.

If I'm reading this correctly, the two specifications don't match up on how 
Sec-WebSocket-Protocol should be handled.

Yours,
Micheil Smith
--
BrandedCode.com

---

From: Fumitoshi Ukai (鵜飼文敏) <[email-masked]>
Date: Wed, 20 Oct 2010 10:30:07 +0900

> Sec-WebSocket-Protocol should be handled.

A client passes protocols as an array, each element in which is non-empty
ASCII strings with no control characters and no spaces.
In Sec-WebSocket-Protocol:, we'll use a string joining elements in the array
with spaces, so we'll split the string by space to get protocols array back.
For example, for "WebSocket(url, "abc")" will emit "Sec-WebSocket-Protocol:
abc", and "WebSocket(url, ["abc", "def"])" will emit
"Sec-WebSocket-Protocol: abc def".  We can't use "WebSocket(url, "abc
def")", so if we see "Sec-WebSocket-Protocl: abc def", we can know the
client uses ["abc", "def"] as protocols.

Regards,
ukai

>
> Yours,
> Micheil Smith
> --
> BrandedCode.com
>
> _______________________________________________
> hybi mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/hybi
>