Commit aebe387f authored by Ning Xie's avatar Ning Xie Committed by Matt Holt

basicauth: remove magic number (#1760)

parent 09850246
...@@ -91,8 +91,9 @@ func basicAuthParse(c *caddy.Controller) ([]Rule, error) { ...@@ -91,8 +91,9 @@ func basicAuthParse(c *caddy.Controller) ([]Rule, error) {
} }
func passwordMatcher(username, passw, siteRoot string) (PasswordMatcher, error) { func passwordMatcher(username, passw, siteRoot string) (PasswordMatcher, error) {
if !strings.HasPrefix(passw, "htpasswd=") { htpasswdPrefix := "htpasswd="
if !strings.HasPrefix(passw, htpasswdPrefix) {
return PlainMatcher(passw), nil return PlainMatcher(passw), nil
} }
return GetHtpasswdMatcher(passw[9:], username, siteRoot) return GetHtpasswdMatcher(passw[len(htpasswdPrefix):], username, siteRoot)
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment