mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-15 12:58:45 +00:00
Trim spaces from elements of split XFF string (#459)
* Trim spaces from elements of split XFF string * Adds test to verify that spaces in original XFF header are handled
This commit is contained in:
committed by
GitHub
parent
1c6c07939a
commit
7f0f691ba5
@@ -134,6 +134,9 @@ func computeXFFHeader(remoteAddr string, origXFFHeader string, pref XFFComputePr
|
||||
origForwardedList := make([]string, 0, 4)
|
||||
if origXFFHeader != "" {
|
||||
origForwardedList = strings.Split(origXFFHeader, ",")
|
||||
for i := range origForwardedList {
|
||||
origForwardedList[i] = strings.TrimSpace(origForwardedList[i])
|
||||
}
|
||||
}
|
||||
origForwardedList = append(origForwardedList, parsedRemoteIP.String())
|
||||
forwardedList := make([]string, 0, len(origForwardedList))
|
||||
|
||||
Reference in New Issue
Block a user