internal/crosshost
import "github.com/gofiber/fiber/v3/internal/crosshost"
Package crosshost names the request headers that must not survive a redirect to a host other than the one they were sent to.
Variables
SensitiveHeaders lists the headers carrying credentials scoped to one origin. A redirect off it must drop every one, or the client's secret reaches a host it never addressed — and the responding server chooses where that goes.
net/http's set, which fasthttp also implements. Shared because the client's redirect loop and the proxy's had already drifted: the proxy was missing Cookie2 and both Authenticate headers.
Source: internal/crosshost/crosshost.go:21
var SensitiveHeaders = []string{
fasthttp.HeaderAuthorization,
fasthttp.HeaderProxyAuthorization,
fasthttp.HeaderProxyAuthenticate,
fasthttp.HeaderWWWAuthenticate,
fasthttp.HeaderCookie,
"Cookie2",
}Functions
func NewHeaderNames(names []string) HeaderNames
Source: internal/crosshost/crosshost.go:35
NewHeaderNames trims names and drops empty ones, in a fresh list.
func Strip(h fieldname.Deleter, extra HeaderNames)
Source: internal/crosshost/crosshost.go:56
Strip removes SensitiveHeaders and extra from h, whatever case they are stored under.
func StripWithin(h fieldname.Deleter, extra HeaderNames, spare int) bool
Source: internal/crosshost/crosshost.go:62
StripWithin is Strip bounded as fieldname.DelSetWithin is: it removes none and reports false when h spells the names in more than spare further ways.
Types
type HeaderNames
Source: internal/crosshost/crosshost.go:32
HeaderNames holds header names without stray whitespace; only NewHeaderNames builds one.
type HeaderNames struct {
// contains filtered or unexported fields
}func (n HeaderNames) Join(other HeaderNames) HeaderNames
Source: internal/crosshost/crosshost.go:51
Join returns n's names followed by other's, in a fresh list.
func (n HeaderNames) List() []string
Source: internal/crosshost/crosshost.go:46
List returns a copy of the names.