Merge branch 'master' into mew-catch-all-v2

This commit is contained in:
Bo-Yi Wu 2017-08-26 05:09:13 -05:00 committed by GitHub
commit cb7fde2f86
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ func BasicAuthForRealm(accounts Accounts, realm string) HandlerFunc {
pairs := processAccounts(accounts) pairs := processAccounts(accounts)
return func(c *Context) { return func(c *Context) {
// Search user in the slice of allowed credentials // Search user in the slice of allowed credentials
user, found := pairs.searchCredential(c.Request.Header.Get("Authorization")) user, found := pairs.searchCredential(c.requestHeader("Authorization"))
if !found { if !found {
// Credentials doesn't match, we return 401 and abort handlers chain. // Credentials doesn't match, we return 401 and abort handlers chain.
c.Header("WWW-Authenticate", realm) c.Header("WWW-Authenticate", realm)

View File

@ -509,7 +509,7 @@ func (c *Context) ClientIP() string {
} }
if c.engine.AppEngine { if c.engine.AppEngine {
if addr := c.Request.Header.Get("X-Appengine-Remote-Addr"); addr != "" { if addr := c.requestHeader("X-Appengine-Remote-Addr"); addr != "" {
return addr return addr
} }
} }