mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
close connection when content length unknown
This commit is contained in:
parent
18904e9adb
commit
9db86e871e
@ -221,6 +221,8 @@ func (s *Server) handlePlainHTTP(ctx context.Context, request *http.Request, rea
|
||||
output := ray.InboundOutput()
|
||||
defer input.Close()
|
||||
|
||||
var result error = errWaitAnother
|
||||
|
||||
requestDone := signal.ExecuteAsync(func() error {
|
||||
request.Header.Set("Connection", "close")
|
||||
|
||||
@ -241,6 +243,9 @@ func (s *Server) handlePlainHTTP(ctx context.Context, request *http.Request, rea
|
||||
response.Header.Set("Connection", "keep-alive")
|
||||
response.Header.Set("Keep-Alive", "timeout=4")
|
||||
response.Close = false
|
||||
} else {
|
||||
response.Close = true
|
||||
result = nil
|
||||
}
|
||||
} else {
|
||||
log.Trace(newError("failed to read response from ", request.Host).Base(err).AtWarning())
|
||||
@ -270,7 +275,7 @@ func (s *Server) handlePlainHTTP(ctx context.Context, request *http.Request, rea
|
||||
return newError("connection ends").Base(err)
|
||||
}
|
||||
|
||||
return errWaitAnother
|
||||
return result
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
Loading…
Reference in New Issue
Block a user