2 ms·
> I remember being a little surprised websockets could violate the same origin policy. It was only a matter of time before that was going to be abused. WebSock
by TazeTSchnitzel 6y ago
> I remember being a little surprised websockets could violate the same origin policy. It was only a matter of time before that was going to be abused.
WebSockets don't have the Same Origin Policy like XMLHttpRequest does, yes, but they are required to tell the server they connect to what origin they came from, so the server can enforce whatever restrictions it likes.
WebSockets were also designed with preventing abuse in mind: note the protocol obfuscation and weird headers, which I think are there so you can't confuse non-WebSocket-aware servers and non-HTTP protocols.
However, as with XMLHttpRequest and other ways to do an HTTP request, it's not possible for the browser to know if a destination server speaks HTTP without trying to connect to it, and I guess that's why port scanning is possible.