1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #34275 from tiborvass/fix-hijack

Fix panic in hijack
This commit is contained in:
Sebastiaan van Stijn 2017-07-27 08:59:55 +02:00 committed by GitHub
commit 67e79319a0

View file

@ -177,6 +177,7 @@ func (cli *Client) setupHijackConn(req *http.Request, proto string) (net.Conn, e
// Server hijacks the connection, error 'connection closed' expected // Server hijacks the connection, error 'connection closed' expected
resp, err := clientconn.Do(req) resp, err := clientconn.Do(req)
if err != httputil.ErrPersistEOF {
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -184,6 +185,7 @@ func (cli *Client) setupHijackConn(req *http.Request, proto string) (net.Conn, e
resp.Body.Close() resp.Body.Close()
return nil, fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode) return nil, fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode)
} }
}
c, br := clientconn.Hijack() c, br := clientconn.Hijack()
if br.Buffered() > 0 { if br.Buffered() > 0 {