ctx: make Secure() also report whether a secure connection was established to a trusted proxy (#2215)

We had a discussion about this in https://github.com/gofiber/helmet/pull/74.
pull/2222/head
leonklingele 2022-11-14 08:22:35 +01:00 committed by GitHub
parent a0645af1ed
commit b288a9f54e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

4
ctx.go
View File

@ -1496,9 +1496,9 @@ func (c *Ctx) SaveFileToStorage(fileheader *multipart.FileHeader, path string, s
return storage.Set(path, content, 0)
}
// Secure returns a boolean property, that is true, if a TLS connection is established.
// Secure returns whether a secure connection was established.
func (c *Ctx) Secure() bool {
return c.fasthttp.IsTLS()
return c.Protocol() == "https"
}
// Send sets the HTTP response body without copying it.