DescriptionWebsocket: fix authentication mistake caused by misuse of bytes.Buffer
byteBuffer := bytes.NewBuffer(buf) copies the contents of the buf into
the byteBuffer. Subsequent writes will append to byteBuffer, not
overwrite data from buf. The websocket code was trying to initialize
byteBuffer with the array from buf, not write buf into byteBuffer.
This mistake was not caught because both the server and client code
made the identical mistake so the tests did not catch it. Also at the
time this code was committed, Chrome did not support draft-76 so there
was little external verification.
The latest Chrome does support draft-76 and this change will allow
websockets to work with the latest Chrome from the dev channel.
Without this change, the md5 sum returned by websocket/server.go will
be incorrect (according to the spec) and the browser will close the
websocket.
Patch Set 1 #Patch Set 2 : code review 1743053: Websocket: fix authentication mistake caused by misuse ... #
Total comments: 2
Patch Set 3 : code review 1743053: Websocket: fix authentication mistake caused by misuse ... #Patch Set 4 : code review 1743053: Websocket: fix authentication mistake caused by misuse ... #
Total comments: 1
Patch Set 5 : code review 1743053: Websocket: fix authentication mistake caused by misuse ... #Patch Set 6 : code review 1743053: Websocket: fix authentication mistake caused by misuse ... #Patch Set 7 : code review 1743053: Websocket: fix authentication mistake caused by misuse ... #
Total comments: 1
Patch Set 8 : code review 1743053: Websocket: fix authentication mistake caused by misuse ... #
Total comments: 2
Patch Set 9 : code review 1743053: Websocket: fix authentication mistake caused by misuse ... #
MessagesTotal messages: 17
|