Re:A WebSocket Primer
by general_failure on Monday December 16, 2013 @07:39PM
(#6918944)
Does anyone know the purpose of Sec-WebSocket-Key and the associated Accept? I know the hashing stuff (https://en.wikipedia.org/wiki/WebSocket) but I don't understand why it exists.
[ Parent
| on HN ]
It's there to help guarantee that the server the browser is connecting to actually understands websockets and isn't being "tricked" into opening a connection through clever request formulation. With that guarantee in place, browsers can trust servers to properly check for and limit cross-domain requests and the like and not need to use something like CORS to negotiate that stuff.
Re:A WebSocket Primer
by general_failure on Tuesday December 17, 2013 @10:38AM
(#6921653)
Why not skip all the hashing stuff? Why not just have Sec-Key: 'secret' and expect a reply with Sec-Accept: 'secret'. (where secret is hardcoded constant)