mirror of
https://github.com/nadoo/glider.git
synced 2025-02-24 01:45:39 +08:00
http: fix #127
This commit is contained in:
parent
ca88797df4
commit
393a334705
@ -55,6 +55,8 @@ func parseRequest(r *bufio.Reader) (*request, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.F("req header: %v", header)
|
||||||
|
|
||||||
auth := header.Get("Proxy-Authorization")
|
auth := header.Get("Proxy-Authorization")
|
||||||
|
|
||||||
cleanHeaders(header)
|
cleanHeaders(header)
|
||||||
|
@ -73,7 +73,7 @@ func (s *HTTP) servRequest(req *request, c *conn.Conn) {
|
|||||||
// Auth
|
// Auth
|
||||||
if s.user != "" && s.password != "" {
|
if s.user != "" && s.password != "" {
|
||||||
if user, pass, ok := extractUserPass(req.auth); !ok || user != s.user || pass != 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)
|
log.F("[http] auth failed from %s, auth info: %s:%s", c.RemoteAddr(), user, pass)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user