From 393a33470514514cd267ad752a50c68f7b8c8b2a Mon Sep 17 00:00:00 2001 From: nadoo <287492+nadoo@users.noreply.github.com> Date: Mon, 21 Oct 2019 15:44:50 +0800 Subject: [PATCH] http: fix #127 --- proxy/http/request.go | 2 ++ proxy/http/server.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/proxy/http/request.go b/proxy/http/request.go index cf627bf..0a45985 100644 --- a/proxy/http/request.go +++ b/proxy/http/request.go @@ -55,6 +55,8 @@ func parseRequest(r *bufio.Reader) (*request, error) { return nil, err } + log.F("req header: %v", header) + auth := header.Get("Proxy-Authorization") cleanHeaders(header) diff --git a/proxy/http/server.go b/proxy/http/server.go index 30c2481..dccd7c7 100644 --- a/proxy/http/server.go +++ b/proxy/http/server.go @@ -73,7 +73,7 @@ func (s *HTTP) servRequest(req *request, c *conn.Conn) { // Auth if s.user != "" && s.password != "" { if user, pass, ok := extractUserPass(req.auth); !ok || user != s.user || pass != s.password { - c.Write([]byte("HTTP/1.1 403 Forbidden\r\n\r\n")) + c.Write([]byte("HTTP/1.1 407 Proxy Authentication Required\r\nProxy-Authenticate: Basic\r\n\r\n")) log.F("[http] auth failed from %s, auth info: %s:%s", c.RemoteAddr(), user, pass) return }