The JSON decoder returns io.EOF when a message is empty or all
whitespace. Convert io.EOF return values from the JSON decoder to
io.ErrUnexpectedEOF so that applications can distinguish between an
error reading the JSON value and the connection closing.
Update the error messages for missing 'Connection: upgrade' and
'Upgrade: websocket' tokens to indicate that the header might not be
present. The previous error message implied that the header is present,
but has the wrong value. This leads to some confusion for those
debugging connection problems.
- Use new closeError type for reporting close frames to the application.
- Use closeError with code 1006 when the peer closes connection without
sending a close frame. The error io.ErrUnexpectedEOF was used
previously. This change helps developers distinguish abnormal closure
and an unexpected EOF in the JSON parser.
Autobahn test suite configuration fuzzingclient.json refers to 'clients' folder, but README.md refers to server. I changed README.md to clients, although I can't figure a good way to choose between changing README.md for 'clients' or fuzzingclient.json for servers. both seems legit to me, depending on what side you see things. Feel free to dismiss/decline my PR if you think the former makes more sense in this context.
- Modify data message reader to return io.ErrUnexpectedEOF if a close
message is received before the final frame of the message.
- Modify NextReader to return io.ErrUnexpectedEOF if underlying
connection returns io.EOF before a close message.
Update the default origin test to treat no origin specified as OK. If
the client can create a request without the origin set, then the client
can also create a request with an arbitrary origin.
- Use io.ReadFull instead of similar function in package.
- Return from Read with partial data. Don't attempt to fill buffer.
- Do not return net.Error with Temporary() == true
- Revert back to using Subprotocols []string. The protocol negotiation
using Subprotocols should meet the needs of most applications.
Applications are not locked into using this negotiation. An
application can pick a protocol some other way and specify the
protocol using the Sec-Websocket-Protocol response header.
- Parse the origin using url.Parse. This is the correct function to use
when parsing a full URL.
- Improve comments.