Skip to content

Commit

Permalink
Merge pull request snail007#89 from moonfruit/dev
Browse files Browse the repository at this point in the history
HTTP Basic 认证失败返回的 WWW-Authenticate 更正为 Proxy-Authenticate
  • Loading branch information
snail007 committed May 24, 2018
2 parents b16decf + 78004bc commit ff96e52
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ff96e52

Please sign in to comment.