Subject: Re: [hybi] Client offers invalid WS protocols, what must the server do? 101???

From: Iñaki Baz Castillo <[email-masked]>
Date: Thu, 1 Sep 2011 09:15:17 +0200

2011/9/1 Brian <[email-masked]>:
> As far as I'm concerned, the server shouldn't be able to specify a
> subprotocol if the client didn't request one.  If the client didn't request
> a given subprotocol, it doesn't know how to speak it.  That's a failure
> case, plain and simple.

> The only "I don't care" exception that is acceptable is when the client
> requests no subprotocol, and the server specifies no subprotocol in
> response.

Right, and that is exactly what the spec says (at least in draft-12).
If the client specifies no subprotocol, then the server must not
specify a subprotocol, and both are assumet to speak an "implicit"
subprotocol (which will be very common in cases where the webpage and
JavaScript code is owned by the same developer which does not be
worried about defining a subprotocol at all).

-- 
Iñaki Baz Castillo
<[email-masked]>

---

From: Iñaki Baz Castillo <[email-masked]>
Date: Thu, 1 Sep 2011 09:20:21 +0200

2011/8/31 Brian <[email-masked]>:
> there's no
> acceptable use case for the server to accept the connection with a
> subprotocol not contained in the list of subprotocols requested by the
> client.  If the client requests a list of subprotocols, that is to be taken
> as the canonical list of the only subprotocols it knows how to speak.
>  Anything else will fail.  It should respond with a 4xx HTTP error code.

And such 4xx code should be good enough and specified for this case.
In this way, the WS client could warn the user (the humar user) in
some way in case the server rejects the connection with that 4xx code
("the version of your software is not updated" or whatever).

-- 
Iñaki Baz Castillo
<[email-masked]>