mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-27 23:03:37 -05:00
Proxy: Fix transport defn; cleanup connection.
This commit is contained in:
parent
d534a2139f
commit
f4cdf53761
1 changed files with 2 additions and 3 deletions
|
@ -212,7 +212,7 @@ func newConnHijackerTransport(base http.RoundTripper) *connHijackerTransport {
|
||||||
KeepAlive: 30 * time.Second,
|
KeepAlive: 30 * time.Second,
|
||||||
}).Dial,
|
}).Dial,
|
||||||
TLSHandshakeTimeout: 10 * time.Second,
|
TLSHandshakeTimeout: 10 * time.Second,
|
||||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
DisableKeepAlives: true,
|
||||||
}
|
}
|
||||||
if base != nil {
|
if base != nil {
|
||||||
if baseTransport, ok := base.(*http.Transport); ok {
|
if baseTransport, ok := base.(*http.Transport); ok {
|
||||||
|
@ -299,10 +299,9 @@ func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, outreq *http.Request, r
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer backendConn.Close()
|
|
||||||
|
|
||||||
outreq.Write(backendConn)
|
outreq.Write(backendConn)
|
||||||
}
|
}
|
||||||
|
defer backendConn.Close()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
io.Copy(backendConn, conn) // write tcp stream to backend.
|
io.Copy(backendConn, conn) // write tcp stream to backend.
|
||||||
|
|
Loading…
Add table
Reference in a new issue