Skip to content

Commit

Permalink
remove client port from logging options
Browse files Browse the repository at this point in the history
  • Loading branch information
TwistedHardware committed Nov 16, 2022
1 parent 6863e24 commit 840860f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions check_csrf.go
Expand Up @@ -56,9 +56,9 @@ func CheckCSRF(r *http.Request) bool {
if user == nil {
user = &User{}
}
ip := r.RemoteAddr
ip := GetRemoteIP(r)
if ip, _, err = net.SplitHostPort(ip); err != nil {
ip = r.RemoteAddr
ip = GetRemoteIP(r)
}

Trail(CRITICAL, "Request failed Anti-CSRF protection from user:%s IP:%s", user.Username, ip)
Expand Down
1 change: 0 additions & 1 deletion global.go
Expand Up @@ -310,7 +310,6 @@ var LogHTTPRequests = true
/*
HTTPLogFormat is the format used to log HTTP access
%a: Client IP address
%{remote}p: Client port
%A: Server hostname/IP
%{local}p: Server port
%U: Path
Expand Down
4 changes: 2 additions & 2 deletions log.go
Expand Up @@ -159,7 +159,7 @@ func (l *Log) SignIn(user string, action Action, r *http.Request) (err error) {
loginStatus = r.Context().Value(CKey("login-status")).(string)
}
jsonifyValue := map[string]string{
"IP": r.RemoteAddr,
"IP": GetRemoteIP(r),
"Login-Status": loginStatus,
}
for k, v := range r.Header {
Expand All @@ -178,7 +178,7 @@ func (l *Log) PasswordReset(user string, action Action, r *http.Request) (err er
l.Username = user
l.Action = action
jsonifyValue := map[string]string{
"IP": r.RemoteAddr,
"IP": GetRemoteIP(r),
"Reset-Status": r.FormValue("reset-status"),
}
for k, v := range r.Header {
Expand Down

0 comments on commit 840860f

Please sign in to comment.