Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(962)

Issue 1743053: code review 1743053: Websocket: fix authentication mistake caused by misuse ... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 7 months ago by tarm
Modified:
13 years, 8 months ago
Reviewers:
CC:
ukai, rsc, golang-dev
Visibility:
Public.

Description

Websocket: 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 ... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+48 lines, -49 lines) Patch
M src/pkg/websocket/client.go View 1 2 3 4 3 chunks +1 line, -29 lines 0 comments Download
M src/pkg/websocket/server.go View 1 2 3 2 chunks +2 lines, -19 lines 0 comments Download
M src/pkg/websocket/websocket.go View 7 8 3 chunks +26 lines, -1 line 0 comments Download
M src/pkg/websocket/websocket_test.go View 1 chunk +19 lines, -0 lines 0 comments Download

Messages

Total messages: 17
tarm
Hello golang-dev@googlegroups.com (cc: fumitoshi ukai <ukai@google.com>, golang-dev@googlegroups.com), I'd like you to review this change.
14 years, 7 months ago (2010-08-01 20:53:56 UTC) #1
ukai
LGTM. Thanks for fixing!
14 years, 7 months ago (2010-08-02 04:14:31 UTC) #2
rsc1
Looks pretty good. A few small things. Please fix and re-run hg mail. Also, please ...
14 years, 7 months ago (2010-08-02 23:21:04 UTC) #3
tarm
Hello ukai, rsc (cc: golang-dev@googlegroups.com), Please take another look.
14 years, 7 months ago (2010-08-03 04:04:58 UTC) #4
ukai
http://codereview.appspot.com/1743053/diff/12001/13001 File src/pkg/websocket/client.go (right): http://codereview.appspot.com/1743053/diff/12001/13001#newcode165 src/pkg/websocket/client.go:165: func getChallengeResponse(number1, number2 uint32, key3 []byte) (expected []byte, err ...
14 years, 7 months ago (2010-08-03 04:11:42 UTC) #5
tarm
Hello ukai, rsc (cc: golang-dev@googlegroups.com), Please take another look.
14 years, 7 months ago (2010-08-03 04:23:16 UTC) #6
ukai
On 2010/08/03 04:23:16, tarm wrote: > Hello ukai, rsc (cc: mailto:golang-dev@googlegroups.com), > > Please take ...
14 years, 7 months ago (2010-08-03 04:24:40 UTC) #7
tarm
Hello ukai, rsc (cc: golang-dev@googlegroups.com), Please take another look.
14 years, 7 months ago (2010-08-03 04:26:35 UTC) #8
tarm
Sorry, how do I do that? I tried "hg add" and then "hg mail" but ...
14 years, 7 months ago (2010-08-03 04:29:59 UTC) #9
rsc
On Mon, Aug 2, 2010 at 21:29, Tarmigan Casebolt <tarmigan@gmail.com> wrote: > Sorry, how do ...
14 years, 7 months ago (2010-08-03 05:28:40 UTC) #10
tarm
Hello ukai, rsc (cc: golang-dev@googlegroups.com), Please take another look.
14 years, 7 months ago (2010-08-03 05:51:49 UTC) #11
ukai
LGTM Thanks! http://codereview.appspot.com/1743053/diff/28001/29003 File src/pkg/websocket/websocket.go (right): http://codereview.appspot.com/1743053/diff/28001/29003#newcode13 src/pkg/websocket/websocket.go:13: "encoding/binary" sort alphabetically? bufio, crypto/md5, encoding/binary, ..
14 years, 7 months ago (2010-08-03 05:55:08 UTC) #12
tarm
Hello ukai, rsc (cc: golang-dev@googlegroups.com), Please take another look.
14 years, 7 months ago (2010-08-03 06:05:39 UTC) #13
rsc1
http://codereview.appspot.com/1743053/diff/33001/34003 File src/pkg/websocket/websocket.go (right): http://codereview.appspot.com/1743053/diff/33001/34003#newcode141 src/pkg/websocket/websocket.go:141: // SeWritetTimeout sets the connection's network write timeout in ...
14 years, 7 months ago (2010-08-03 20:00:31 UTC) #14
tarm
Hello ukai, rsc (cc: golang-dev@googlegroups.com), Please take another look.
14 years, 7 months ago (2010-08-03 21:30:29 UTC) #15
rsc
LGTM thanks again
14 years, 7 months ago (2010-08-03 21:33:47 UTC) #16
rsc
14 years, 7 months ago (2010-08-03 21:34:47 UTC) #17
*** Submitted as http://code.google.com/p/go/source/detail?r=f4aca2fe9865 ***

websocket: correct challenge response

Tested against latest Chrome.

R=ukai, rsc
CC=golang-dev
http://codereview.appspot.com/1743053

Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b