@@ -76,12 +76,12 @@ func verifyClientRequest(w http.ResponseWriter, r *http.Request) error {
7676}
7777
7878// Accept accepts a WebSocket handshake from a client and upgrades the
79- // the connection to WebSocket.
79+ // the connection to a WebSocket.
8080//
8181// Accept will reject the handshake if the Origin domain is not the same as the Host unless
8282// the InsecureSkipVerify option is set.
8383//
84- // The returned connection will be bound by r.Context(). Use c .Context() to change
84+ // The returned connection will be bound by r.Context(). Use conn .Context() to change
8585// the bounding context.
8686func Accept (w http.ResponseWriter , r * http.Request , opts AcceptOptions ) (* Conn , error ) {
8787 c , err := accept (w , r , opts )
@@ -107,15 +107,15 @@ func accept(w http.ResponseWriter, r *http.Request, opts AcceptOptions) (*Conn,
107107
108108 hj , ok := w .(http.Hijacker )
109109 if ! ok {
110- err = xerrors .New ("response writer must implement http.Hijacker" )
110+ err = xerrors .New ("passed ResponseWriter does not implement http.Hijacker" )
111111 http .Error (w , http .StatusText (http .StatusInternalServerError ), http .StatusInternalServerError )
112112 return nil , err
113113 }
114114
115115 w .Header ().Set ("Upgrade" , "websocket" )
116116 w .Header ().Set ("Connection" , "Upgrade" )
117117
118- handleKey (w , r )
118+ handleSecWebSocketKey (w , r )
119119
120120 subproto := selectSubprotocol (r , opts .Subprotocols )
121121 if subproto != "" {
@@ -163,7 +163,7 @@ func selectSubprotocol(r *http.Request, subprotocols []string) string {
163163
164164var keyGUID = []byte ("258EAFA5-E914-47DA-95CA-C5AB0DC85B11" )
165165
166- func handleKey (w http.ResponseWriter , r * http.Request ) {
166+ func handleSecWebSocketKey (w http.ResponseWriter , r * http.Request ) {
167167 key := r .Header .Get ("Sec-WebSocket-Key" )
168168 h := sha1 .New ()
169169 h .Write ([]byte (key ))
@@ -185,5 +185,5 @@ func authenticateOrigin(r *http.Request) error {
185185 if strings .EqualFold (u .Host , r .Host ) {
186186 return nil
187187 }
188- return xerrors .Errorf ("request origin %q is not authorized for host %q" , origin , r .Host )
188+ return xerrors .Errorf ("request Origin %q is not authorized for Host %q" , origin , r .Host )
189189}
0 commit comments