1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-12-09 09:56:01 +02:00
Commit Graph

8 Commits

Author SHA1 Message Date
Ewan Higgs
4944dfab30
Support Last-Modified response header and support If-Modified-Since request header. (#1147)
* Always return Last-Modified and support If-Modified-Since.

* IMGPROXY_USE_LAST_MODIFIED config setting.

IMGPROXY_USE_LAST_MODIFIED  (default false) when enabled will return the
Last-Modified time of the upstream image and also allow the support of
the If-Modified-Since request header (returning a 304 if the image
hasn't been modified).

If-Modified-Since allows If-None-Match to take precedence.

* Fixes based on DarthSim's feedback.

1. Don't worry about nil maps.
2. Fix a test now that we use the config.LastModifiedEnabled (and move
   it's location it he test file to a more sane place).
3. Update GCS transport code based on the refactoring of DarthSim.

In this iteration, we pull the Updated time from the GCS object attributes
and format them as a string. We then parse it in the notmodified module.
Seems a bit silly to do it this way. If we agree on the approach here,
then AWS and Azure can follow.

* Support azure, fs, s3, and swift.

* Grab the headers for If-Modified-Since and Last-Modified before parsing them.

* Add tests for last-modified for fs.

* Support Last-Modified being passed when streaming an upstream file.

* Tests for Last-Modified for GCS and Azure

* Support s3 and swift tests. Sadly fakes3 doesn't support Last-Modified

* Test against forked gofakes3
2023-05-03 21:21:46 +06:00
DarthSim
24f4d43a0f use "clean" HTTP transport; Use context for downloading timeout control 2023-03-21 20:58:16 +03:00
DarthSim
70d657113e Set Content-Security-Policy tag when the raw option is used 2023-02-25 18:59:28 +03:00
DarthSim
50d04d585e Make the expires option set Expires and Cache-Control headers 2023-02-24 19:44:03 +03:00
DarthSim
784e3c08e8 Better Content-Disposition crafting for streaming 2022-10-03 16:01:17 +06:00
DarthSim
12f17a56bc Log response even if raw streaming failed 2022-09-07 18:03:12 +06:00
DarthSim
913cfb22ca Add ranged requests suport to transports 2022-09-07 18:03:12 +06:00
DarthSim
0f7281e56e raw processing option 2022-09-07 18:03:12 +06:00