transport isolated, imagefetcher introduced (#1465)

This commit is contained in:
Victor Sokolov
2025-07-25 12:26:21 +02:00
committed by GitHub
parent 0e0714b5a1
commit dd3b430f87
17 changed files with 578 additions and 361 deletions

View File

@@ -20,6 +20,7 @@ import (
"github.com/imgproxy/imgproxy/v3/etag"
"github.com/imgproxy/imgproxy/v3/ierrors"
"github.com/imgproxy/imgproxy/v3/imagedata"
"github.com/imgproxy/imgproxy/v3/imagefetcher"
"github.com/imgproxy/imgproxy/v3/imagetype"
"github.com/imgproxy/imgproxy/v3/imath"
"github.com/imgproxy/imgproxy/v3/metrics"
@@ -348,7 +349,7 @@ func handleProcessing(reqID string, rw http.ResponseWriter, r *http.Request) {
return imagedata.Download(ctx, imageURL, "source image", downloadOpts, po.SecurityOptions)
}()
var nmErr imagedata.NotModifiedError
var nmErr imagefetcher.NotModifiedError
switch {
case err == nil:
@@ -358,7 +359,13 @@ func handleProcessing(reqID string, rw http.ResponseWriter, r *http.Request) {
if config.ETagEnabled && len(etagHandler.ImageEtagExpected()) != 0 {
rw.Header().Set("ETag", etagHandler.GenerateExpectedETag())
}
respondWithNotModified(reqID, r, rw, po, imageURL, nmErr.Headers())
h := make(map[string]string)
for k := range nmErr.Headers() {
h[k] = nmErr.Headers().Get(k)
}
respondWithNotModified(reqID, r, rw, po, imageURL, h)
return
default: