mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-07 04:38:19 +08:00
fix(context): return empty string for invalid remote IP in ClientIP method
fix(gin): unmap address before checking if it is IPv4 in prepareTrustedCIDRs
This commit is contained in:
parent
6f54838d7f
commit
9ef3ade402
@ -1022,6 +1022,9 @@ func (c *Context) ClientIP() string {
|
||||
}
|
||||
}
|
||||
}
|
||||
if !remoteIP.IsValid() {
|
||||
return ""
|
||||
}
|
||||
return remoteIP.String()
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user