Documentation
¶
Index ¶
- func HandleDimsStatus(config core.Config, w http.ResponseWriter, r *http.Request)
- func Handler(request RequestContext) error
- func LegacyValues(u *url.URL) []string
- func SignedQuery(u *url.URL) string
- type Headers
- type Request
- func (r *Request) Commands() []commands.Command
- func (r *Request) Config() core.Config
- func (r *Request) FetchImage(timeout time.Duration) (*core.Image, error)
- func (r *Request) LoadImage(sourceImage *core.Image) (*vips.ImageRef, error)
- func (r *Request) ProcessImage(image *vips.ImageRef, errorImage bool) (string, []byte, error)
- type RequestContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleDimsStatus ¶
func Handler ¶
func Handler(request RequestContext) error
func LegacyValues ¶
LegacyValues returns the values named by _keys, in the order _keys lists them. This is the mod_dims rule. It covers only the parameters a caller opts in, so every other parameter stays open to tampering.
func SignedQuery ¶
SignedQuery returns the canonical form of every query parameter that takes part in the signature: each one written as name=value, percent-encoded and ordered by name. url.Values.Encode does both.
The name is part of the string, so moving a character from one parameter to the next changes it. The values alone do not: "ab" then "c" reads the same as "a" then "bc". Percent-encoding keeps a value from carrying a separator of its own.
Types ¶
type Request ¶
type Request struct {
URL *url.URL // The URL of the http.
ImageUrl string // The image URL that is being manipulated.
SendContentDisposition bool // Whether to send a Content-Disposition header.
Download bool // Whether the caller asked for a download rather than inline.
RawCommands string // The commands ('resize/100x100', 'strip/true/format/png', etc).
Signature string // The signature of the request.
SignedQuery string // Every signed query parameter, canonically encoded.
LegacyParams []string // Values named by _keys, in _keys order. Legacy mode only.
SourceImage core.Image // The source image.
// contains filtered or unexported fields
}
func NewRequest ¶ added in v0.5.0
func (*Request) Commands ¶
Commands returns the parsed command list. The result is kept, since this is called once while loading the image and again while processing it.
func (*Request) FetchImage ¶
type RequestContext ¶ added in v0.5.0
type RequestContext interface {
Headers
Config() core.Config
Validate() bool
FetchImage(timeout time.Duration) (*core.Image, error)
NotModified() bool
SendNotModified() error
LoadImage(image *core.Image) (*vips.ImageRef, error)
ProcessImage(img *vips.ImageRef, strip bool) (string, []byte, error)
SendImage(status int, imageFormat string, imageBlob []byte) error
}