From 78004bcd3972c3f8dae7fd0a42b45b016c00ed3c Mon Sep 17 00:00:00 2001 From: MoonFruit Date: Wed, 23 May 2018 16:03:22 +0800 Subject: [PATCH] =?UTF-8?q?HTTP=20Basic=20=E8=AE=A4=E8=AF=81=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E8=BF=94=E5=9B=9E=E7=9A=84=20WWW-Authenticate=20?= =?UTF-8?q?=E6=9B=B4=E6=AD=A3=E4=B8=BA=20Proxy-Authenticate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/structs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/structs.go b/utils/structs.go index 95977fb..66aed3f 100644 --- a/utils/structs.go +++ b/utils/structs.go @@ -427,7 +427,7 @@ func (req *HTTPRequest) GetAuthDataStr() (basicInfo string, err error) { authorization = strings.Trim(authorization, " \r\n\t") if authorization == "" { - fmt.Fprintf((*req.conn), "HTTP/1.1 %s Unauthorized\r\nWWW-Authenticate: Basic realm=\"\"\r\n\r\nUnauthorized", "407") + fmt.Fprintf((*req.conn), "HTTP/1.1 %s Proxy Authentication Required\r\nProxy-Authenticate: Basic realm=\"\"\r\n\r\nProxy Authentication Required", "407") CloseConn(req.conn) err = errors.New("require auth header data") return @@ -463,7 +463,7 @@ func (req *HTTPRequest) BasicAuth() (err error) { authOk := (*req.basicAuth).Check(string(user), addr[0], URL) //log.Printf("auth %s,%v", string(user), authOk) if !authOk { - fmt.Fprintf((*req.conn), "HTTP/1.1 %s Unauthorized\r\n\r\nUnauthorized", "407") + fmt.Fprintf((*req.conn), "HTTP/1.1 %s Proxy Authentication Required\r\n\r\nProxy Authentication Required", "407") CloseConn(req.conn) err = fmt.Errorf("basic auth fail") return