1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-03-27 20:30:27 +02:00

Fix debug header

This commit is contained in:
DarthSim 2021-04-05 19:47:29 +06:00
parent aa6edd13f6
commit 1df1a9eaa8

View File

@ -98,6 +98,11 @@ func respondWithImage(ctx context.Context, reqID string, r *http.Request, rw htt
rw.Header().Set("Vary", headerVaryValue)
}
if conf.EnableDebugHeaders {
imgdata := getImageData(ctx)
rw.Header().Set("X-Origin-Content-Length", strconv.Itoa(len(imgdata.Data)))
}
if conf.GZipCompression > 0 && strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
buf := responseGzipBufPool.Get(0)
defer responseGzipBufPool.Put(buf)
@ -119,11 +124,6 @@ func respondWithImage(ctx context.Context, reqID string, r *http.Request, rw htt
rw.Write(data)
}
if conf.EnableDebugHeaders {
imgdata := getImageData(ctx)
rw.Header().Set("X-Origin-Content-Length", strconv.Itoa(len(imgdata.Data)))
}
imageURL := getImageURL(ctx)
logResponse(reqID, r, 200, nil, &imageURL, po)