Merge 8b3e41da2987f0ea224513eb3bdeeb8e7f7906c7 into 5260de6a83283abb87e827130accd495ad543cf3

This commit is contained in:
Owen Gong 2026-02-18 20:29:29 -08:00 committed by GitHub
commit e62cab2160
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1032,6 +1032,15 @@ func (c *Context) RemoteIP() string {
return ip
}
// FromTrustProxy check if the request is from a trusted proxy server
func (c *Context) FromTrustProxy() bool {
remoteIP := net.ParseIP(c.RemoteIP())
if remoteIP == nil {
return false
}
return c.engine.isTrustedProxy(remoteIP)
}
// ContentType returns the Content-Type header of the request.
func (c *Context) ContentType() string {
return filterFlags(c.requestHeader("Content-Type"))