mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
fix http connect handling
This commit is contained in:
parent
c9eacc534a
commit
72d5d68443
@ -122,19 +122,8 @@ Start:
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) handleConnect(ctx context.Context, request *http.Request, reader io.Reader, writer io.Writer, dest v2net.Destination, dispatcher dispatcher.Interface) error {
|
func (s *Server) handleConnect(ctx context.Context, request *http.Request, reader io.Reader, writer io.Writer, dest v2net.Destination, dispatcher dispatcher.Interface) error {
|
||||||
response := &http.Response{
|
_, err := writer.Write([]byte("HTTP/1.1 200 Connection established\n\n"))
|
||||||
Status: "200 OK",
|
if err != nil {
|
||||||
StatusCode: 200,
|
|
||||||
Proto: "HTTP/1.1",
|
|
||||||
ProtoMajor: 1,
|
|
||||||
ProtoMinor: 1,
|
|
||||||
Header: http.Header(make(map[string][]string)),
|
|
||||||
Body: nil,
|
|
||||||
ContentLength: -1, // Don't send Content-Length in CONNECT.
|
|
||||||
Close: false,
|
|
||||||
}
|
|
||||||
response.Header.Set("Proxy-Connection", "close")
|
|
||||||
if err := response.Write(writer); err != nil {
|
|
||||||
return newError("failed to write back OK response").Base(err)
|
return newError("failed to write back OK response").Base(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user