Documentation
¶
Overview ¶
Package inject gives the ability to copy data and inject a payload before a specified marker. In order to let the user respond to the change in length, the API is split into two parts - Sniff checks whether the marker occurs within a specified number of initial bytes, and Copy sends the data to the destination.
The package tries to avoid double-injecting a payload by checking whether the payload occurs within the first Within + len(Payload) bytes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CopyInject ¶
type CopyInject struct {
// Number of initial bytes within which to search for marker
Within int
// Only inject in responses with this content type
ContentType string
// A marker, BEFORE which the payload is inserted
Marker *regexp.Regexp
// The payload to be inserted
Payload []byte
}
CopyInject copies data, and injects a payload before a specified marker
func (*CopyInject) ServeTemplate ¶
func (ci *CopyInject) ServeTemplate(statuscode int, w http.ResponseWriter, t *template.Template, data interface{}) error
ServeTemplate renders and serves a template to an http.ResponseWriter
Click to show internal directories.
Click to hide internal directories.