Browse Source

Optimized connection close implementation

Toby Chui 2 months ago
parent
commit
c0439d3c05
1 changed files with 2 additions and 0 deletions
  1. 2 0
      mod/dynamicproxy/Server.go

+ 2 - 0
mod/dynamicproxy/Server.go

@@ -222,10 +222,12 @@ func (h *ProxyHandler) handleRootRouting(w http.ResponseWriter, r *http.Request)
 		h.Parent.logRequest(r, false, 444, "root-noresponse", domainOnly)
 		hijacker, ok := w.(http.Hijacker)
 		if !ok {
+			w.Header().Set("Connection", "close")
 			return
 		}
 		conn, _, err := hijacker.Hijack()
 		if err != nil {
+			w.Header().Set("Connection", "close")
 			return
 		}
 		conn.Close()