From 8e3008acf48b0288acfc482622bcd8ebd5fa7beb Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Sat, 28 Jul 2012 22:14:35 -0400 Subject: [PATCH] websocket: fix typos Fixes golang/go#3880. R=golang-dev, iant CC=golang-dev https://golang.org/cl/6446061 --- websocket/hixie.go | 4 ++-- websocket/hybi.go | 6 +++--- websocket/server.go | 2 +- websocket/websocket.go | 4 ++-- websocket/websocket_test.go | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/websocket/hixie.go b/websocket/hixie.go index 6d215b94..51c753e5 100644 --- a/websocket/hixie.go +++ b/websocket/hixie.go @@ -22,7 +22,7 @@ import ( "strings" ) -// An aray of characters to be randomly inserted to construct Sec-WebSocket-Key +// An array of characters to be randomly inserted to construct Sec-WebSocket-Key // value. It holds characters from ranges U+0021 to U+002F and U+003A to U+007E. // See Step 21 in Section 4.1 Opening handshake. // http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-00#page-22 @@ -332,7 +332,7 @@ func generateKey3() (key []byte) { return } -// Cilent handhake described in (soon obsolete) +// Cilent handshake described in (soon obsolete) // draft-ietf-hybi-thewebsocket-protocol-00 // (draft-hixie-thewebsocket-protocol-76) func hixie76ClientHandshake(config *Config, br *bufio.Reader, bw *bufio.Writer) (err error) { diff --git a/websocket/hybi.go b/websocket/hybi.go index ab18ffc5..f9e891d8 100644 --- a/websocket/hybi.go +++ b/websocket/hybi.go @@ -104,7 +104,7 @@ type hybiFrameReaderFactory struct { } // NewFrameReader reads a frame header from the connection, and creates new reader for the frame. -// See Section 5.2 Base Frameing protocol for detail. +// See Section 5.2 Base Framing protocol for detail. // http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17#section-5.2 func (buf hybiFrameReaderFactory) NewFrameReader() (frame frameReader, err error) { hybiFrame := new(hybiFrameReader) @@ -348,7 +348,7 @@ func generateMaskingKey() (maskingKey []byte, err error) { return } -// genetateNonce geneates a nonce consisting of a randomly selected 16-byte +// generateNonce generates a nonce consisting of a randomly selected 16-byte // value that has been base64-encoded. func generateNonce() (nonce []byte) { key := make([]byte, 16) @@ -384,7 +384,7 @@ func isHybiVersion(version int) bool { return false } -// Client handhake described in draft-ietf-hybi-thewebsocket-protocol-17 +// Client handshake described in draft-ietf-hybi-thewebsocket-protocol-17 func hybiClientHandshake(config *Config, br *bufio.Reader, bw *bufio.Writer) (err error) { if !isHybiVersion(config.Version) { panic("wrong protocol version.") diff --git a/websocket/server.go b/websocket/server.go index 63f48e25..d1c2cc36 100644 --- a/websocket/server.go +++ b/websocket/server.go @@ -96,7 +96,7 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } if conn == nil { - panic("unepxected nil conn") + panic("unexpected nil conn") } h(conn) } diff --git a/websocket/websocket.go b/websocket/websocket.go index b296c3bf..68bef481 100644 --- a/websocket/websocket.go +++ b/websocket/websocket.go @@ -38,7 +38,7 @@ const ( UnknownFrame = 255 ) -// WebSocket protocol errors. +// ProtocolError represents WebSocket protocol errors. type ProtocolError struct { ErrorString string } @@ -393,7 +393,7 @@ func jsonUnmarshal(msg []byte, payloadType byte, v interface{}) (err error) { /* JSON is a codec to send/receive JSON data in a frame from a WebSocket connection. -Trival usage: +Trivial usage: import "websocket" diff --git a/websocket/websocket_test.go b/websocket/websocket_test.go index 27c58a07..40c147f9 100644 --- a/websocket/websocket_test.go +++ b/websocket/websocket_test.go @@ -200,7 +200,7 @@ func TestHTTP(t *testing.T) { once.Do(startServer) // If the client did not send a handshake that matches the protocol - // specification, the server MUST return an HTTP respose with an + // specification, the server MUST return an HTTP response with an // appropriate error code (such as 400 Bad Request) resp, err := http.Get(fmt.Sprintf("http://%s/echo", serverAddr)) if err != nil {