mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-07 04:38:19 +08:00
fix(engine): improve error handling for invalid trusted proxy CIDR
This commit is contained in:
parent
b89ff58d27
commit
6f54838d7f
2
gin.go
2
gin.go
@ -426,7 +426,7 @@ func (engine *Engine) prepareTrustedCIDRs() ([]netip.Prefix, error) {
|
|||||||
}
|
}
|
||||||
prefix, err := netip.ParsePrefix(trustedProxy)
|
prefix, err := netip.ParsePrefix(trustedProxy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cidrs, err
|
return cidrs, &net.ParseError{Type: "CIDR address", Text: trustedProxy}
|
||||||
}
|
}
|
||||||
cidrs = append(cidrs, prefix.Masked())
|
cidrs = append(cidrs, prefix.Masked())
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user