fix http connect handling

This commit is contained in:
Darien Raymond 2017-04-18 13:30:26 +02:00
parent c9eacc534a
commit 72d5d68443
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 2 additions and 13 deletions

View File

@ -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 {
response := &http.Response{
Status: "200 OK",
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 {
_, err := writer.Write([]byte("HTTP/1.1 200 Connection established\n\n"))
if err != nil {
return newError("failed to write back OK response").Base(err)
}