Documentation
¶
Overview ¶
Package crosshost names the request headers that must not survive a redirect to a host other than the one they were sent to.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SensitiveHeaders = []string{ fasthttp.HeaderAuthorization, fasthttp.HeaderProxyAuthorization, fasthttp.HeaderProxyAuthenticate, fasthttp.HeaderWWWAuthenticate, fasthttp.HeaderCookie, "Cookie2", }
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.
Functions ¶
func Strip ¶ added in v3.7.0
func Strip(h fieldname.Deleter, extra HeaderNames)
Strip removes SensitiveHeaders and extra from h, whatever case they are stored under.
func StripWithin ¶ added in v3.7.0
func StripWithin(h fieldname.Deleter, extra HeaderNames, spare int) bool
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 ¶ added in v3.7.0
type HeaderNames struct {
// contains filtered or unexported fields
}
HeaderNames holds header names without stray whitespace; only NewHeaderNames builds one.
func NewHeaderNames ¶ added in v3.7.0
func NewHeaderNames(names []string) HeaderNames
NewHeaderNames trims names and drops empty ones, in a fresh list.
func (HeaderNames) Join ¶ added in v3.7.0
func (n HeaderNames) Join(other HeaderNames) HeaderNames
Join returns n's names followed by other's, in a fresh list.
func (HeaderNames) List ¶ added in v3.7.0
func (n HeaderNames) List() []string
List returns a copy of the names.