mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 17:46:58 -05:00
only keep connection alive when content length is known
This commit is contained in:
parent
72d5d68443
commit
18904e9adb
@ -236,10 +236,12 @@ func (s *Server) handlePlainHTTP(ctx context.Context, request *http.Request, rea
|
|||||||
response, err := http.ReadResponse(responseReader, request)
|
response, err := http.ReadResponse(responseReader, request)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
StripHopByHopHeaders(response.Header)
|
StripHopByHopHeaders(response.Header)
|
||||||
response.Header.Set("Proxy-Connection", "keep-alive")
|
if response.ContentLength >= 0 {
|
||||||
response.Header.Set("Connection", "keep-alive")
|
response.Header.Set("Proxy-Connection", "keep-alive")
|
||||||
response.Header.Set("Keep-Alive", "timeout=4")
|
response.Header.Set("Connection", "keep-alive")
|
||||||
response.Close = false
|
response.Header.Set("Keep-Alive", "timeout=4")
|
||||||
|
response.Close = false
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Trace(newError("failed to read response from ", request.Host).Base(err).AtWarning())
|
log.Trace(newError("failed to read response from ", request.Host).Base(err).AtWarning())
|
||||||
response = &http.Response{
|
response = &http.Response{
|
||||||
|
Loading…
Reference in New Issue
Block a user