Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBadFramingModifier ¶
func NewBadFramingModifier() martian.RequestModifier
NewBadFramingModifier makes a best effort to fix inconsistencies in the request such as multiple Content-Lengths or the lack of Content-Length and improper Transfer-Encoding. If it is unable to determine a proper resolution it returns an error.
http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-14#section-3.3
func NewForwardedModifier ¶
func NewForwardedModifier() martian.RequestModifier
NewForwardedModifier sets the X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-Url headers.
If X-Forwarded-For is already present, the client IP is appended to the existing value. X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-Url are preserved if already present.
TODO: Support "Forwarded" header. see: http://tools.ietf.org/html/rfc7239
func NewHopByHopModifier ¶
func NewHopByHopModifier() martian.RequestResponseModifier
NewHopByHopModifier removes Hop-By-Hop headers from requests and responses.
Types ¶
type ViaModifier ¶
type ViaModifier struct {
// contains filtered or unexported fields
}
ViaModifier is a header modifier that checks for proxy redirect loops.
func NewViaModifier ¶
func NewViaModifier(requestedBy string) *ViaModifier
NewViaModifier returns a new Via modifier.
func (*ViaModifier) ModifyRequest ¶
func (m *ViaModifier) ModifyRequest(req *http.Request) error
ModifyRequest sets the Via header and provides loop-detection. If Via is already present, it will be appended to the existing value. If a loop is detected an error is added to the context and the request round trip is skipped.
http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-14#section-9.9
func (*ViaModifier) SetBoundary ¶
func (m *ViaModifier) SetBoundary(boundary string)
SetBoundary sets the boundary string (random 10 character by default) used to disabiguate Martians that are chained together with identical requestedBy values. This should only be used for testing.