From b64e5901b652ea27117bf28bb221399893ec3370 Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Wed, 30 Jul 2025 21:40:31 +0800 Subject: [PATCH] http: fix response for connect request --- handler/http/handler.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/handler/http/handler.go b/handler/http/handler.go index 4a86395d..62cabd7a 100644 --- a/handler/http/handler.go +++ b/handler/http/handler.go @@ -362,14 +362,13 @@ func (h *httpHandler) handleRequest(ctx context.Context, conn net.Conn, req *htt ro.Src = cc.LocalAddr().String() ro.Dst = cc.RemoteAddr().String() - resp.StatusCode = http.StatusOK - resp.Status = "200 Connection established" + b := []byte("HTTP/1.1 200 Connection established\r\n" + + "Proxy-Agent: " + h.md.proxyAgent + "\r\n\r\n") if log.IsLevelEnabled(logger.TraceLevel) { - dump, _ := httputil.DumpResponse(resp, false) - log.Trace(string(dump)) + log.Trace(string(b)) } - if err = resp.Write(conn); err != nil { + if _, err = conn.Write(b); err != nil { log.Error(err) return err }