mirror of https://github.com/gorilla/websocket.git
Forgot an error check.
I was trying to use ServeHTTP to directly negotiate a websocket connection without having to use an actual network connection (i.e., using a `httptest.ResponseRecorder`). Doing so, I managed to trigger an error here but it wasn't checked which resulted in a panic later.
This commit is contained in:
parent
365b7a442d
commit
5f5eb14fde
|
@ -137,6 +137,9 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
|
||||||
}
|
}
|
||||||
var rw *bufio.ReadWriter
|
var rw *bufio.ReadWriter
|
||||||
netConn, rw, err = h.Hijack()
|
netConn, rw, err = h.Hijack()
|
||||||
|
if (err!=nil) {
|
||||||
|
return nil, err;
|
||||||
|
}
|
||||||
br = rw.Reader
|
br = rw.Reader
|
||||||
|
|
||||||
if br.Buffered() > 0 {
|
if br.Buffered() > 0 {
|
||||||
|
|
Loading…
Reference in New Issue