Преглед изворни кода

websocket: fix typos
Fixes golang/go#3880.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6446061

Shenghou Ma пре 13 година
родитељ
комит
8e3008acf4
5 измењених фајлова са 9 додато и 9 уклоњено
  1. 2 2
      websocket/hixie.go
  2. 3 3
      websocket/hybi.go
  3. 1 1
      websocket/server.go
  4. 2 2
      websocket/websocket.go
  5. 1 1
      websocket/websocket_test.go

+ 2 - 2
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) {

+ 3 - 3
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.")

+ 1 - 1
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)
 }

+ 2 - 2
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"
 

+ 1 - 1
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 {