mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
fix(server): use lower case in error messages (#2151)
Co-authored-by: Amir Zarrinkafsh <nightah@me.com> Co-authored-by: James Elliott <james-d-elliott@users.noreply.github.com>
This commit is contained in:
parent
28991dd71a
commit
4a570489d1
|
@ -15,14 +15,14 @@ func autheliaErrorHandler(ctx *fasthttp.RequestCtx, err error) {
|
||||||
if _, ok := err.(*fasthttp.ErrSmallBuffer); ok {
|
if _, ok := err.(*fasthttp.ErrSmallBuffer); ok {
|
||||||
// Note: Getting X-Forwarded-For or Request URI is impossible for ths error.
|
// Note: Getting X-Forwarded-For or Request URI is impossible for ths error.
|
||||||
logger.Tracef("Request was too large to handle from client %s. Response Code %d.", ctx.RemoteIP().String(), fasthttp.StatusRequestHeaderFieldsTooLarge)
|
logger.Tracef("Request was too large to handle from client %s. Response Code %d.", ctx.RemoteIP().String(), fasthttp.StatusRequestHeaderFieldsTooLarge)
|
||||||
ctx.Error("Request header too large", fasthttp.StatusRequestHeaderFieldsTooLarge)
|
ctx.Error("request header too large", fasthttp.StatusRequestHeaderFieldsTooLarge)
|
||||||
} else if netErr, ok := err.(*net.OpError); ok && netErr.Timeout() {
|
} else if netErr, ok := err.(*net.OpError); ok && netErr.Timeout() {
|
||||||
// TODO: Add X-Forwarded-For Check here.
|
// TODO: Add X-Forwarded-For Check here.
|
||||||
logger.Tracef("Request timeout occurred while handling from client %s: %s. Response Code %d.", ctx.RemoteIP().String(), ctx.RequestURI(), fasthttp.StatusRequestTimeout)
|
logger.Tracef("Request timeout occurred while handling from client %s: %s. Response Code %d.", ctx.RemoteIP().String(), ctx.RequestURI(), fasthttp.StatusRequestTimeout)
|
||||||
ctx.Error("Request timeout", fasthttp.StatusRequestTimeout)
|
ctx.Error("request timeout", fasthttp.StatusRequestTimeout)
|
||||||
} else {
|
} else {
|
||||||
// TODO: Add X-Forwarded-For Check here.
|
// TODO: Add X-Forwarded-For Check here.
|
||||||
logger.Tracef("An unknown error occurred while handling a request from client %s: %s. Response Code %d.", ctx.RemoteIP().String(), ctx.RequestURI(), fasthttp.StatusBadRequest)
|
logger.Tracef("An unknown error occurred while handling a request from client %s: %s. Response Code %d.", ctx.RemoteIP().String(), ctx.RequestURI(), fasthttp.StatusBadRequest)
|
||||||
ctx.Error("Error when parsing request", fasthttp.StatusBadRequest)
|
ctx.Error("error when parsing request", fasthttp.StatusBadRequest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ func ServeTemplatedFile(publicDir, file, base, rememberMe, resetPassword, sessio
|
||||||
|
|
||||||
err := tmpl.Execute(ctx.Response.BodyWriter(), struct{ Base, CSPNonce, RememberMe, ResetPassword, Session, Theme string }{Base: base, CSPNonce: nonce, RememberMe: rememberMe, ResetPassword: resetPassword, Session: session, Theme: theme})
|
err := tmpl.Execute(ctx.Response.BodyWriter(), struct{ Base, CSPNonce, RememberMe, ResetPassword, Session, Theme string }{Base: base, CSPNonce: nonce, RememberMe: rememberMe, ResetPassword: resetPassword, Session: session, Theme: theme})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error("An error occurred", 503)
|
ctx.Error("an error occurred", 503)
|
||||||
logger.Errorf("Unable to execute template: %v", err)
|
logger.Errorf("Unable to execute template: %v", err)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user