MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / Execute

Method Execute

handlers/processing/handler.go:67–94  ·  view source on GitHub ↗

Execute handles the image processing request

(
	reqID string,
	rw server.ResponseWriter,
	req *http.Request,
)

Source from the content-addressed store, hash-verified

65
66// Execute handles the image processing request
67func (h *Handler) Execute(
68 reqID string,
69 rw server.ResponseWriter,
70 req *http.Request,
71) *server.Error {
72 // Increment the number of requests in progress
73 h.Monitoring().Stats().IncRequestsInProgress()
74 defer h.Monitoring().Stats().DecRequestsInProgress()
75
76 // Verify URL signature and extract image url and processing options
77 r, err := h.newRequest(req)
78 if err != nil {
79 return err
80 }
81
82 // if processing options indicate raw image streaming, stream it and return
83 if r.opts.GetBool(keys.Raw, false) {
84 return h.stream.Execute(req, r.imageURL, reqID, r.opts, rw)
85 }
86
87 r.reqID = reqID
88 r.req = req
89 r.rw = rw
90 r.config = h.config
91 r.ch = h.ConditionalHeaders().NewRequest(r.req)
92
93 return r.execute()
94}
95
96// newRequest extracts image url and processing options from request URL and verifies them
97func (h *Handler) newRequest(req *http.Request) (*request, *server.Error) {

Callers

nothing calls this directly

Calls 9

newRequestMethod · 0.95
IncRequestsInProgressMethod · 0.80
StatsMethod · 0.80
DecRequestsInProgressMethod · 0.80
GetBoolMethod · 0.80
NewRequestMethod · 0.80
MonitoringMethod · 0.65
ConditionalHeadersMethod · 0.65
executeMethod · 0.45

Tested by

no test coverage detected