9 Commits

Author SHA1 Message Date
DarthSim
ac03563506 NewDefaultConfig returns value, not pointer; Nested configs are defined as value 2025-09-06 01:56:53 +03:00
Victor Sokolov
caffdcd72b IMG-49: Instance requires transport.Config (#1513)
* transport.Config

* Removed redaundant LocalEnaled
2025-09-05 13:52:27 +02:00
DarthSim
e31b24931d Update linter and fix linting errors 2024-04-18 21:16:32 +03:00
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
Joe Cai
6f292443ea Respond with 404 when the source image can not be found in OpenStack Swift (#903) 2022-06-24 16:50:08 +06:00
DarthSim
3a79a48d6f Tests and minor fixes for transports 2022-04-07 23:32:51 +06:00
DarthSim
b614b41723 Use require instead of assert in swift tests 2022-04-07 15:40:54 +06:00
DarthSim
8887008d5a Stabilize swift tests 2022-04-07 14:11:31 +06:00
Joe Cai
7a2296aee8 Support OpenStack Swift Object Storage (#837)
* Add OpenStack Swift support

* Fix linting errors

* Update CHANGELOG

* Update swift documentation

* Fix linting error

* Swift transport: pass req.Context down, fix parseObjectURL() implementation

* Make swift transport test a test suite

* Use swift://{container}/{object_path} as the source image URL format

* Cleanup

* Swift transport: only close object when returning 304
2022-04-06 17:00:19 +06:00