mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 19:56:51 +08:00
Fix: don't close connection on status 100 Continue
and header Proxy-Connection: Keep-Alive
(#294)
This commit is contained in:
parent
60fdd82e2b
commit
112b3e5a6c
|
@ -37,7 +37,16 @@ func (t *Tunnel) handleHTTP(request *adapters.HTTPAdapter, outbound net.Conn) {
|
|||
break
|
||||
}
|
||||
adapters.RemoveHopByHopHeaders(resp.Header)
|
||||
if resp.ContentLength >= 0 {
|
||||
|
||||
if resp.StatusCode == http.StatusContinue {
|
||||
err = resp.Write(request)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
goto handleResponse
|
||||
}
|
||||
|
||||
if keepAlive || resp.ContentLength >= 0 {
|
||||
resp.Header.Set("Proxy-Connection", "keep-alive")
|
||||
resp.Header.Set("Connection", "keep-alive")
|
||||
resp.Header.Set("Keep-Alive", "timeout=4")
|
||||
|
@ -50,14 +59,6 @@ func (t *Tunnel) handleHTTP(request *adapters.HTTPAdapter, outbound net.Conn) {
|
|||
break
|
||||
}
|
||||
|
||||
if !keepAlive {
|
||||
break
|
||||
}
|
||||
|
||||
if resp.StatusCode == http.StatusContinue {
|
||||
goto handleResponse
|
||||
}
|
||||
|
||||
req, err = http.ReadRequest(inboundReeder)
|
||||
if err != nil {
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue
Block a user