Check and handle error return from hijack.

This commit is contained in:
Gary Burd 2014-08-15 20:25:38 -07:00
parent 365b7a442d
commit 4292df70df
1 changed files with 3 additions and 0 deletions

View File

@ -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 u.returnError(w, r, http.StatusInternalServerError, err.Error())
}
br = rw.Reader br = rw.Reader
if br.Buffered() > 0 { if br.Buffered() > 0 {