Skip to content

Commit

Permalink
implementing (some of) @garyburd's suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
johnrichardrinehart committed Jul 10, 2017
1 parent 1d375d5 commit f4f69d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
12 changes: 5 additions & 7 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
//
// Overview
//
// The Conn type represents a WebSocket connection. Within the context of an
// HTTP request handler, a server application calls the Upgrade method of an
// Upgrader instance obtaining a pointer to a Conn:
// The Conn type represents a WebSocket connection. A server application calls
// the Upgrader.Upgrade method from an HTTP request handler to get a *Conn:
//
// var upgrader = websocket.Upgrader{
// ReadBufferSize: 1024,
Expand Down Expand Up @@ -152,10 +151,9 @@
// origin policy checking using the CheckOrigin field associated with the
// Upgrader instance.
//
// By contrast, the deprecated package-level Upgrade function
// does not perform origin checking. In this case is the application's
// responsibility to manually check the Origin header before calling the
// package-level Upgrade function.
// The deprecated package-level Upgrade function does not perform origin
// checking. The application is responsible for checking the Origin header
// before calling the Upgrade function.
//
// Compression EXPERIMENTAL
//
Expand Down
9 changes: 4 additions & 5 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,13 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
return c, nil
}

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

0 comments on commit f4f69d2

Please sign in to comment.