x/net/websocket: Read() doesn't read the whole frame #27967
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
The documentation for
websocket.(*Conn).Read()
states:I interpret this as meaning that if msg is large enough, then the whole frame will be read (exceptio probat regulam in casibus non exceptis, the exception proves the rule).
However, in case of large frames (larger than bufio defaultBufSize) the read will always be short. Either the documentation or the implementation is wrong.
websocket.Message.Receive()
does read the whole frame.What version of Go are you using (
go version
)?go1.11
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?Reproduced on:
What did you do?
I connected an
x/net/websocket
client and server, and had the server write a 5000 byte long frame usingwebsocket.(*Conn).Write()
and the client read it usingwebsocket.(*Conn).Read()
.Client: https://play.golang.org/p/BYtr4kSJUfu
Server: https://play.golang.org/p/LHWv9YfqsjB
What did you expect to see?
I expected
websocket.(*Conn).Read()
to read the whole 5000 byte long frame.What did you see instead?
websocket.(*Conn).Read()
read only 4092 bytes of the 5000 byte long frame.The text was updated successfully, but these errors were encountered: