From ade0fc90f793c97554d26478432e779a7fa873b6 Mon Sep 17 00:00:00 2001 From: Eric Urban Date: Sun, 10 Aug 2014 20:42:52 -0500 Subject: [PATCH 1/3] Correct documentation, the "ReadJSON" function depends on "Unmarshal", not "Marshal" --- json.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json.go b/json.go index ce8f00c..e0668f2 100644 --- a/json.go +++ b/json.go @@ -38,7 +38,7 @@ func ReadJSON(c *Conn, v interface{}) error { // ReadJSON reads the next JSON-encoded message from the connection and stores // it in the value pointed to by v. // -// See the documentation for the encoding/json Marshal function for details +// See the documentation for the encoding/json Unmarshal function for details // about the conversion of JSON to a Go value. func (c *Conn) ReadJSON(v interface{}) error { _, r, err := c.NextReader() From 4292df70df546334d4174bcd77271253c9b7835c Mon Sep 17 00:00:00 2001 From: Gary Burd Date: Fri, 15 Aug 2014 20:25:38 -0700 Subject: [PATCH 2/3] Check and handle error return from hijack. --- server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server.go b/server.go index 4de5bb0..c24c410 100644 --- a/server.go +++ b/server.go @@ -137,6 +137,9 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade } var rw *bufio.ReadWriter netConn, rw, err = h.Hijack() + if err != nil { + return u.returnError(w, r, http.StatusInternalServerError, err.Error()) + } br = rw.Reader if br.Buffered() > 0 { From 0a52d61198038fcb795e39acd8712f71d56eacca Mon Sep 17 00:00:00 2001 From: Christian Stefanescu Date: Thu, 11 Sep 2014 08:36:21 +0200 Subject: [PATCH 3/3] fixed typo in comment --- examples/chat/conn.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chat/conn.go b/examples/chat/conn.go index 916bada..7cc0496 100644 --- a/examples/chat/conn.go +++ b/examples/chat/conn.go @@ -88,7 +88,7 @@ func (c *connection) writePump() { } } -// serverWs handles webocket requests from the peer. +// serverWs handles websocket requests from the peer. func serveWs(w http.ResponseWriter, r *http.Request) { if r.Method != "GET" { http.Error(w, "Method not allowed", 405)