Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ContextHeaderFilter is a header filter for WebSession.Context.additionalHeaders ContextHeaderFilter = util.Must(ParseHeaderWhitelist(websession.Context_headerWhitelist)) // ResponseHeaderFilter is a header filter for WebSession.Response.additionalHeaders ResponseHeaderFilter = util.Must(ParseHeaderWhitelist(websession.Response_headerWhitelist)) )
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
Session websession.WebSession
}
A Handler implements http.Handler on top of a WebSession. NOTE: this is work in progress; some of the methods documented in web-session.capnp are not implemented and will return HTTP 405 "Method Not Allowed" responses.
type HeaderFilter ¶
type HeaderFilter struct {
// contains filtered or unexported fields
}
A HeaderFilter filters headers based on an allow list.
func NewHeaderFilter ¶
func NewHeaderFilter() HeaderFilter
NewHeaderFilter a new empty header filter (i.e. one that drops all headers).
func ParseHeaderWhitelist ¶
func ParseHeaderWhitelist(l capnp.TextList) (HeaderFilter, error)
ParseHeaderWhiteList parses the `headerWhitelist` fields defined in web-session.capnp, and returns a corresponding HeaderFilter.
func (*HeaderFilter) AddAllow ¶
func (hf *HeaderFilter) AddAllow(rule string)
AddAllow adds an allow rule to the filter. If the rule ends in '*' it is a prefix, otherwise it is an exact value.
func (HeaderFilter) Allows ¶
func (hf HeaderFilter) Allows(name string) bool
Allows returns true iff the header filter allows the named header.
func (HeaderFilter) Copy ¶
func (hf HeaderFilter) Copy(dst, src http.Header)
Copy copies all headers allowed by the filter