mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
parent
19c250de20
commit
52fcfd71e6
@ -239,11 +239,12 @@ func (v *Server) handlePlainHTTP(request *http.Request, session *proxy.SessionIn
|
|||||||
StripHopByHopHeaders(request)
|
StripHopByHopHeaders(request)
|
||||||
|
|
||||||
ray := v.packetDispatcher.DispatchToOutbound(session)
|
ray := v.packetDispatcher.DispatchToOutbound(session)
|
||||||
|
defer ray.InboundInput().Close()
|
||||||
|
defer ray.InboundOutput().Release()
|
||||||
|
|
||||||
var finish sync.WaitGroup
|
var finish sync.WaitGroup
|
||||||
finish.Add(1)
|
finish.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer ray.InboundInput().Close()
|
|
||||||
defer finish.Done()
|
defer finish.Done()
|
||||||
requestWriter := bufio.NewWriter(buf.NewBytesWriter(ray.InboundInput()))
|
requestWriter := bufio.NewWriter(buf.NewBytesWriter(ray.InboundInput()))
|
||||||
err := request.Write(requestWriter)
|
err := request.Write(requestWriter)
|
||||||
@ -256,7 +257,6 @@ func (v *Server) handlePlainHTTP(request *http.Request, session *proxy.SessionIn
|
|||||||
|
|
||||||
finish.Add(1)
|
finish.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer ray.InboundOutput().Release()
|
|
||||||
defer finish.Done()
|
defer finish.Done()
|
||||||
responseReader := bufio.OriginalReader(buf.NewBytesReader(ray.InboundOutput()))
|
responseReader := bufio.OriginalReader(buf.NewBytesReader(ray.InboundOutput()))
|
||||||
response, err := http.ReadResponse(responseReader, request)
|
response, err := http.ReadResponse(responseReader, request)
|
||||||
@ -272,7 +272,6 @@ func (v *Server) handlePlainHTTP(request *http.Request, session *proxy.SessionIn
|
|||||||
}
|
}
|
||||||
responseWriter.Flush()
|
responseWriter.Flush()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
finish.Wait()
|
finish.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user