[whatwg] WebSocket opening handshake, when to bail out

The establish a WebSocket connection algorithm is very specific about when  
to bail out. This is annoying. It means we have to reimplement header  
parsing just for WebSockets, when we already have very well tested header  
parsing in place. We'd like to be able to bail out or wait for more data  
as we see fit for the opening handshake. It does not seem to be  
interop-sensitive whether one browser bails out a few bytes earlier than  
another browser for an invalid handshake. The difference is only  
observable in carefully crafted cases where the server sleeps half-way  
through the handshake.

For instance, the algorithm says to wait for an 0x0A byte and only then  
check the status code. We want to check the status code earlier,  
byte-for-byte.

For the fields, the algorithm says to do some processing while parsing  
each field, and then do further processing when they're all received. We'd  
like to wait with processing them until we have them all.

(This feedback makes the earlier feedback about moving processing of  
fields with empty name moot.)

-- 
Simon Pieters
Opera Software

Received on Friday, 23 April 2010 04:05:50 UTC