Skip to content

Commit f4f69d2

Browse files
implementing (some of) @garyburd's suggestions
1 parent 1d375d5 commit f4f69d2

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

doc.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
//
77
// Overview
88
//
9-
// The Conn type represents a WebSocket connection. Within the context of an
10-
// HTTP request handler, a server application calls the Upgrade method of an
11-
// Upgrader instance obtaining a pointer to a Conn:
9+
// The Conn type represents a WebSocket connection. A server application calls
10+
// the Upgrader.Upgrade method from an HTTP request handler to get a *Conn:
1211
//
1312
// var upgrader = websocket.Upgrader{
1413
// ReadBufferSize: 1024,
@@ -152,10 +151,9 @@
152151
// origin policy checking using the CheckOrigin field associated with the
153152
// Upgrader instance.
154153
//
155-
// By contrast, the deprecated package-level Upgrade function
156-
// does not perform origin checking. In this case is the application's
157-
// responsibility to manually check the Origin header before calling the
158-
// package-level Upgrade function.
154+
// The deprecated package-level Upgrade function does not perform origin
155+
// checking. The application is responsible for checking the Origin header
156+
// before calling the Upgrade function.
159157
//
160158
// Compression EXPERIMENTAL
161159
//

server.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,13 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
228228
return c, nil
229229
}
230230

231-
// DEPRECATED - use websocket.Upgrader instead.
231+
// Deprecated: Use websocket.Upgrader instead.
232232
//
233233
// Upgrade upgrades the HTTP server connection to the WebSocket protocol.
234234
//
235-
// Note that the application is responsible for checking the request origin
236-
// before calling Upgrade. This is not done automatically as with the use of the
237-
// Upgrader.Upgrade method. An example implementation of the same origin policy
238-
// check is:
235+
// Upgrade does not perform origin checking. The application is responsible for
236+
// checking the Origin header before calling Upgrade. An example implementation
237+
// of the same origin policy check is:
239238
//
240239
// if req.Header.Get("Origin") != "http://"+req.Host {
241240
// http.Error(w, "Origin not allowed", 403)

0 commit comments

Comments
 (0)