Przeglądaj źródła

fix http connect handling

Darien Raymond 8 lat temu
rodzic
commit
72d5d68443
1 zmienionych plików z 2 dodań i 13 usunięć
  1. 2 13
      proxy/http/server.go

+ 2 - 13
proxy/http/server.go

@@ -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)
 	}