http: fix response for connect request

This commit is contained in:
ginuerzh
2025-07-30 21:40:31 +08:00
parent 87e454a6f1
commit b64e5901b6
+4 -5
View File
@@ -362,14 +362,13 @@ func (h *httpHandler) handleRequest(ctx context.Context, conn net.Conn, req *htt
ro.Src = cc.LocalAddr().String() ro.Src = cc.LocalAddr().String()
ro.Dst = cc.RemoteAddr().String() ro.Dst = cc.RemoteAddr().String()
resp.StatusCode = http.StatusOK b := []byte("HTTP/1.1 200 Connection established\r\n" +
resp.Status = "200 Connection established" "Proxy-Agent: " + h.md.proxyAgent + "\r\n\r\n")
if log.IsLevelEnabled(logger.TraceLevel) { if log.IsLevelEnabled(logger.TraceLevel) {
dump, _ := httputil.DumpResponse(resp, false) log.Trace(string(b))
log.Trace(string(dump))
} }
if err = resp.Write(conn); err != nil { if _, err = conn.Write(b); err != nil {
log.Error(err) log.Error(err)
return err return err
} }