Disable closeNotify when method GET for http pipelining
This commit is contained in:
parent
f35d574759
commit
2387010556
7 changed files with 94 additions and 45 deletions
19
vendor/github.com/vulcand/oxy/forward/fwd.go
generated
vendored
19
vendor/github.com/vulcand/oxy/forward/fwd.go
generated
vendored
|
@ -221,7 +221,9 @@ func New(setters ...optSetter) (*Forwarder, error) {
|
|||
}
|
||||
|
||||
if f.tlsClientConfig == nil {
|
||||
f.tlsClientConfig = f.httpForwarder.roundTripper.(*http.Transport).TLSClientConfig
|
||||
if ht, ok := f.httpForwarder.roundTripper.(*http.Transport); ok {
|
||||
f.tlsClientConfig = ht.TLSClientConfig
|
||||
}
|
||||
}
|
||||
|
||||
f.httpForwarder.roundTripper = ErrorHandlingRoundTripper{
|
||||
|
@ -444,9 +446,16 @@ func (f *httpForwarder) serveHTTP(w http.ResponseWriter, inReq *http.Request, ct
|
|||
defer logEntry.Debug("vulcand/oxy/forward/http: completed ServeHttp on request")
|
||||
}
|
||||
|
||||
pw := &utils.ProxyWriter{
|
||||
W: w,
|
||||
var pw utils.ProxyWriter
|
||||
|
||||
// Disable closeNotify when method GET for http pipelining
|
||||
// Waiting for https://github.com/golang/go/issues/23921
|
||||
if inReq.Method == http.MethodGet {
|
||||
pw = utils.NewProxyWriterWithoutCloseNotify(w)
|
||||
} else {
|
||||
pw = utils.NewSimpleProxyWriter(w)
|
||||
}
|
||||
|
||||
start := time.Now().UTC()
|
||||
|
||||
outReq := new(http.Request)
|
||||
|
@ -464,14 +473,14 @@ func (f *httpForwarder) serveHTTP(w http.ResponseWriter, inReq *http.Request, ct
|
|||
|
||||
if inReq.TLS != nil {
|
||||
f.log.Debugf("vulcand/oxy/forward/http: Round trip: %v, code: %v, Length: %v, duration: %v tls:version: %x, tls:resume:%t, tls:csuite:%x, tls:server:%v",
|
||||
inReq.URL, pw.Code, pw.Length, time.Now().UTC().Sub(start),
|
||||
inReq.URL, pw.StatusCode(), pw.GetLength(), time.Now().UTC().Sub(start),
|
||||
inReq.TLS.Version,
|
||||
inReq.TLS.DidResume,
|
||||
inReq.TLS.CipherSuite,
|
||||
inReq.TLS.ServerName)
|
||||
} else {
|
||||
f.log.Debugf("vulcand/oxy/forward/http: Round trip: %v, code: %v, Length: %v, duration: %v",
|
||||
inReq.URL, pw.Code, pw.Length, time.Now().UTC().Sub(start))
|
||||
inReq.URL, pw.StatusCode(), pw.GetLength(), time.Now().UTC().Sub(start))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue