mirror of https://github.com/gorilla/websocket.git
Merge branch 'master' of https://github.com/gorilla/websocket
This commit is contained in:
commit
078e38de3b
|
@ -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)
|
||||
|
|
2
json.go
2
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()
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue