Open igor-ramazanov opened 5 years ago
The problem was solved when I chose a different HTTP port, so it might be just something with my local machine; however, this issue is about inconvenient handling of protocol deviations.
I'm not a web socket expert, but I think we should do the following:
ProtocolException
s, send a close with code 1002.recoverWith
in Http4sWSStage#handleRead
.Any volunteers?
Unfortunately, I don't know how exactly to reproduce this error.
The problem is that when I ran a local WebSocket server it was closing all incoming connections and printing the next stack trace:
Seems that it doesn't properly handle deviations from the protocol and throws an error in case if a received opcode doesn't match to the expected valid set of opcodes.
I've checked the WebSockets RFC and it says that a server must close a connection and return 400 in case of an handshake error - https://tools.ietf.org/html/rfc6455#section-4.2.1
Also, it says that opcodes from 3 to 7 are reserved for the future usage and I didn't find information on how they should be handled exactly. However, there is a sentence:
If an unknown opcode is received, the receiving endpoint MUST _Fail the WebSocket Connection_.
, though not sure if it's applicable to them - https://tools.ietf.org/html/rfc6455#section-5.2Probably at least server could handle such opcodes and print something less scary and more understandable for users.