mirror of
https://github.com/caddyserver/caddy.git
synced 2026-06-07 06:25:24 -04:00
proxy: recognize client's cancellation
fix issue #1589 Signed-off-by: Tw <tw19881113@gmail.com>
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"io"
|
||||
"net"
|
||||
@@ -252,14 +251,6 @@ func (rp *ReverseProxy) ServeHTTP(rw http.ResponseWriter, outreq *http.Request,
|
||||
|
||||
rp.Director(outreq)
|
||||
|
||||
// Original incoming server request may be canceled by the
|
||||
// user or by std lib(e.g. too many idle connections).
|
||||
// Now we issue the new outgoing client request which
|
||||
// doesn't depend on the original one. (issue 1345)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
outreq = outreq.WithContext(ctx)
|
||||
|
||||
res, err := transport.RoundTrip(outreq)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user