Skip to content

Commit a69d9f6

Browse files
committed
Merge branch 'updoc'
2 parents 462d5c5 + 92f772e commit a69d9f6

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

doc.go

Lines changed: 5 additions & 6 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. A server application uses
10-
// the Upgrade function from an Upgrader object with a HTTP request handler
11-
// to get 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,
@@ -147,9 +146,9 @@
147146
// CheckOrigin: func(r *http.Request) bool { return true },
148147
// }
149148
//
150-
// The deprecated Upgrade function does not enforce an origin policy. It's the
151-
// application's responsibility to check the Origin header before calling
152-
// Upgrade.
149+
// The deprecated package-level Upgrade function does not perform origin
150+
// checking. The application is responsible for checking the Origin header
151+
// before calling the Upgrade function.
153152
//
154153
// Compression EXPERIMENTAL
155154
//

json.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ import (
99
"io"
1010
)
1111

12-
// WriteJSON is deprecated, use c.WriteJSON instead.
12+
// WriteJSON writes the JSON encoding of v as a message.
13+
//
14+
// Deprecated: Use c.WriteJSON instead.
1315
func WriteJSON(c *Conn, v interface{}) error {
1416
return c.WriteJSON(v)
1517
}
1618

17-
// WriteJSON writes the JSON encoding of v to the connection.
19+
// WriteJSON writes the JSON encoding of v as a message.
1820
//
1921
// See the documentation for encoding/json Marshal for details about the
2022
// conversion of Go values to JSON.
@@ -31,7 +33,10 @@ func (c *Conn) WriteJSON(v interface{}) error {
3133
return err2
3234
}
3335

34-
// ReadJSON is deprecated, use c.ReadJSON instead.
36+
// ReadJSON reads the next JSON-encoded message from the connection and stores
37+
// it in the value pointed to by v.
38+
//
39+
// Deprecated: Use c.ReadJSON instead.
3540
func ReadJSON(c *Conn, v interface{}) error {
3641
return c.ReadJSON(v)
3742
}

server.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,11 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
230230

231231
// Upgrade upgrades the HTTP server connection to the WebSocket protocol.
232232
//
233-
// This function is deprecated, use websocket.Upgrader instead.
233+
// Deprecated: Use websocket.Upgrader instead.
234234
//
235-
// The application is responsible for checking the request origin before
236-
// calling Upgrade. An example implementation of the same origin policy 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:
237238
//
238239
// if req.Header.Get("Origin") != "http://"+req.Host {
239240
// http.Error(w, "Origin not allowed", 403)

util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ func nextTokenOrQuoted(s string) (value string, rest string) {
111111
case escape:
112112
escape = false
113113
p[j] = b
114-
j += 1
114+
j++
115115
case b == '\\':
116116
escape = true
117117
case b == '"':
118118
return string(p[:j]), s[i+1:]
119119
default:
120120
p[j] = b
121-
j += 1
121+
j++
122122
}
123123
}
124124
return "", ""

0 commit comments

Comments
 (0)