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

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

Issue 4607052: code review 4607052: os.Error API: don't export os.ErrorString, use os.NewEr... (Closed)
Left Patch Set: diff -r e3c9fecaef4e https://go.googlecode.com/hg/ Created 13 years, 9 months ago
Right Patch Set: diff -r 6e3e06fb2dc3 https://go.googlecode.com/hg/ Created 13 years, 9 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/time/tick.go ('k') | src/pkg/xml/read.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 "bufio" 8 "bufio"
9 "bytes" 9 "bytes"
10 "container/vector" 10 "container/vector"
11 "crypto/tls" 11 "crypto/tls"
12 "fmt" 12 "fmt"
13 "http" 13 "http"
14 "io" 14 "io"
15 "net" 15 "net"
16 "os" 16 "os"
17 "rand" 17 "rand"
18 "strings" 18 "strings"
19 ) 19 )
20 20
21 type ProtocolError struct { 21 type ProtocolError struct {
22 ErrorString string 22 ErrorString string
23 } 23 }
24 24
25 func (err ProtocolError) String() string { return string(err.ErrorString) } 25 func (err *ProtocolError) String() string { return string(err.ErrorString) }
26 26
27 var ( 27 var (
28 ErrBadScheme = &ProtocolError{"bad scheme"} 28 ErrBadScheme = &ProtocolError{"bad scheme"}
29 ErrBadStatus = &ProtocolError{"bad status"} 29 ErrBadStatus = &ProtocolError{"bad status"}
30 ErrBadUpgrade = &ProtocolError{"missing or bad upgrade"} 30 ErrBadUpgrade = &ProtocolError{"missing or bad upgrade"}
31 ErrBadWebSocketOrigin = &ProtocolError{"missing or bad WebSocket-Origi n"} 31 ErrBadWebSocketOrigin = &ProtocolError{"missing or bad WebSocket-Origi n"}
32 ErrBadWebSocketLocation = &ProtocolError{"missing or bad WebSocket-Locat ion"} 32 ErrBadWebSocketLocation = &ProtocolError{"missing or bad WebSocket-Locat ion"}
33 ErrBadWebSocketProtocol = &ProtocolError{"missing or bad WebSocket-Proto col"} 33 ErrBadWebSocketProtocol = &ProtocolError{"missing or bad WebSocket-Proto col"}
34 ErrChallengeResponse = &ProtocolError{"mismatch challenge/response"} 34 ErrChallengeResponse = &ProtocolError{"mismatch challenge/response"}
35 secKeyRandomChars [0x30 - 0x21 + 0x7F - 0x3A]byte 35 secKeyRandomChars [0x30 - 0x21 + 0x7F - 0x3A]byte
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 return ErrBadWebSocketOrigin 314 return ErrBadWebSocketOrigin
315 } 315 }
316 if resp.Header.Get("Websocket-Location") != location { 316 if resp.Header.Get("Websocket-Location") != location {
317 return ErrBadWebSocketLocation 317 return ErrBadWebSocketLocation
318 } 318 }
319 if protocol != "" && resp.Header.Get("Websocket-Protocol") != protocol { 319 if protocol != "" && resp.Header.Get("Websocket-Protocol") != protocol {
320 return ErrBadWebSocketProtocol 320 return ErrBadWebSocketProtocol
321 } 321 }
322 return 322 return
323 } 323 }
LEFTRIGHT

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