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

Delta Between Two Patch Sets: src/pkg/websocket/server.go

Issue 1743053: code review 1743053: Websocket: fix authentication mistake caused by misuse ... (Closed)
Left Patch Set: code review 1743053: Websocket: fix authentication mistake caused by misuse ... Created 14 years, 7 months ago
Right Patch Set: code review 1743053: Websocket: fix authentication mistake caused by misuse ... Created 14 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/websocket/client.go ('k') | src/pkg/websocket/websocket.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package websocket 5 package websocket
6 6
7 import ( 7 import (
8 "http" 8 "http"
9 "io" 9 "io"
10 "strings" 10 "strings"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if keyNumber1%space1 != 0 || keyNumber2%space2 != 0 { 114 if keyNumber1%space1 != 0 || keyNumber2%space2 != 0 {
115 return 115 return
116 } 116 }
117 117
118 // Step 7. let part be key number divided by spaces. 118 // Step 7. let part be key number divided by spaces.
119 part1 := keyNumber1 / space1 119 part1 := keyNumber1 / space1
120 part2 := keyNumber2 / space2 120 part2 := keyNumber2 / space2
121 121
122 // Step 8. let challenge to be concatination of part1, part2 and key3. 122 // Step 8. let challenge to be concatination of part1, part2 and key3.
123 // Step 9. get MD5 fingerprint of challenge. 123 // Step 9. get MD5 fingerprint of challenge.
124 » response, err := getChallengeResponse(part1, part2, key3); 124 » response, err := getChallengeResponse(part1, part2, key3)
125 if err != nil { 125 if err != nil {
126 return 126 return
127 } 127 }
128 128
129 // Step 10. send response status line. 129 // Step 10. send response status line.
130 buf.WriteString("HTTP/1.1 101 WebSocket Protocol Handshake\r\n") 130 buf.WriteString("HTTP/1.1 101 WebSocket Protocol Handshake\r\n")
131 // Step 11. send response headers. 131 // Step 11. send response headers.
132 buf.WriteString("Upgrade: WebSocket\r\n") 132 buf.WriteString("Upgrade: WebSocket\r\n")
133 buf.WriteString("Connection: Upgrade\r\n") 133 buf.WriteString("Connection: Upgrade\r\n")
134 buf.WriteString("Sec-WebSocket-Location: " + location + "\r\n") 134 buf.WriteString("Sec-WebSocket-Location: " + location + "\r\n")
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 if found { 199 if found {
200 buf.WriteString("WebSocket-Protocol: " + protocol + "\r\n") 200 buf.WriteString("WebSocket-Protocol: " + protocol + "\r\n")
201 } 201 }
202 buf.WriteString("\r\n") 202 buf.WriteString("\r\n")
203 if err := buf.Flush(); err != nil { 203 if err := buf.Flush(); err != nil {
204 return 204 return
205 } 205 }
206 ws := newConn(origin, location, protocol, buf, rwc) 206 ws := newConn(origin, location, protocol, buf, rwc)
207 f(ws) 207 f(ws)
208 } 208 }
LEFTRIGHT

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