Explorar o código

add Proxy-Authirization on basic auth

刘河 %!s(int64=5) %!d(string=hai) anos
pai
achega
29ec73c80b
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      lib/common/util.go

+ 4 - 1
lib/common/util.go

@@ -51,7 +51,10 @@ func DomainCheck(domain string) bool {
 func CheckAuth(r *http.Request, user, passwd string) bool {
 	s := strings.SplitN(r.Header.Get("Authorization"), " ", 2)
 	if len(s) != 2 {
-		return false
+		s = strings.SplitN(r.Header.Get("Proxy-Authorization"), " ", 2)
+		if len(s) != 2 {
+			return false
+		}
 	}
 
 	b, err := base64.StdEncoding.DecodeString(s[1])