mirror of
https://github.com/gospider007/requests.git
synced 2025-12-24 13:57:52 +08:00
sync
This commit is contained in:
2
http.go
2
http.go
@@ -40,7 +40,7 @@ type clientConn struct {
|
|||||||
cnl context.CancelCauseFunc
|
cnl context.CancelCauseFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
func newClientConn(con net.Conn, closeFunc func(error)) *clientConn {
|
func NewClientConn(con net.Conn, closeFunc func(error)) *clientConn {
|
||||||
ctx, cnl := context.WithCancelCause(context.TODO())
|
ctx, cnl := context.WithCancelCause(context.TODO())
|
||||||
reader, writer := io.Pipe()
|
reader, writer := io.Pipe()
|
||||||
c := &clientConn{
|
c := &clientConn{
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ func (obj *roundTripper) dialConnecotr(ctx *Response, conne *connecotr, h2 bool)
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
conne.Conn = newClientConn(conne.c, func(err error) {
|
conne.Conn = NewClientConn(conne.c, func(err error) {
|
||||||
conne.forceCnl(tools.WrapError(err, "http1 client close"))
|
conne.forceCnl(tools.WrapError(err, "http1 client close"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user