From 3835ab437bf2a24e0bbf0938ff2886119862a8c2 Mon Sep 17 00:00:00 2001 From: "rui.zheng" Date: Sat, 9 Jan 2016 16:20:53 +0800 Subject: [PATCH] fix bug #20 --- http.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/http.go b/http.go index 66462e5..8e7c55a 100644 --- a/http.go +++ b/http.go @@ -28,7 +28,6 @@ func handleHttpRequest(req *http.Request, conn net.Conn, arg Args) { u, p, _ := basicAuth(req.Header.Get("Proxy-Authorization")) req.Header.Del("Proxy-Authorization") - if (username != "" && u != username) || (password != "" && p != password) { resp := "HTTP/1.1 407 Proxy Authentication Required\r\n" + "Proxy-Authenticate: Basic realm=\"gost\"\r\n" + @@ -65,12 +64,10 @@ func handleHttpRequest(req *http.Request, conn net.Conn, arg Args) { return } } else { - if len(forwardArgs) > 0 { - err = req.WriteProxy(c) - } else { - err = req.Write(c) - } - if err != nil { + req.Header.Del("Proxy-Connection") + req.Header.Set("Connection", "Keep-Alive") + + if err = req.Write(c); err != nil { glog.V(LWARNING).Infoln(err) return }