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:
commit
67e79319a0
1 changed files with 8 additions and 6 deletions
|
@ -177,12 +177,14 @@ 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 != nil {
|
if err != httputil.ErrPersistEOF {
|
||||||
return nil, err
|
if err != nil {
|
||||||
}
|
return nil, err
|
||||||
if resp.StatusCode != http.StatusSwitchingProtocols {
|
}
|
||||||
resp.Body.Close()
|
if resp.StatusCode != http.StatusSwitchingProtocols {
|
||||||
return nil, fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode)
|
resp.Body.Close()
|
||||||
|
return nil, fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c, br := clientconn.Hijack()
|
c, br := clientconn.Hijack()
|
||||||
|
|
Loading…
Add table
Reference in a new issue