This commit is contained in:
nadoo 2019-10-21 15:44:50 +08:00
parent ca88797df4
commit 393a334705
2 changed files with 3 additions and 1 deletions

View File

@ -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)

View File

@ -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
}