Commit Graph

34 Commits

Author SHA1 Message Date
Viktor Sokolov
08ef27c0e5 processing_handler.go -> handlers/processing 2025-09-01 17:06:45 +02:00
Victor Sokolov
c6a95facbb headerwriter in processing_handler.go (#1507)
* headerwriter in processing_handler.go

* Remove not required etag tests

* ETagEnabled, LastModifiedEnabled true by default

* Changed Passthrough signature

* Removed etag package

* Merge writeDebugHeaders*
2025-08-27 15:20:10 +02:00
Victor Sokolov
6c9d26e8f5 IMG-54: NewDefaultConfig(), routes ordering exact/non-exact (#1504)
* NewDefaultConfig() + LoadFromEnv()

* Route order

* Changed route switch

* categoryConfig

* Use Default() in tests
2025-08-25 19:52:29 +02:00
Victor Sokolov
15bd00b221 IMG-51: router -> server ns, handlers ns, added error to handler ret val (#1494)
* Introduced server, handlers, error ret in handlerfn

* Server struct with tests

* replace checkErr with return
2025-08-20 14:31:11 +02:00
DarthSim
a3c633f884 Remove debug Println 2025-08-15 18:40:33 +03:00
Victor Sokolov
af890f8b71 IMG-46: Call finishFn on download finished (metrics) (#1487)
* Skip goes to processing

* Call finishFn on download finished

* defer DownloadFinished in DownloadSync
2025-08-15 12:43:57 +02:00
Victor Sokolov
09a25f8966 IMG-23: Replace imagemeta with imagedetect (#1483)
* Replace imagemeta with imagedetect

* Removed imagemeta package

* 1 page in the check
2025-08-13 11:49:48 +02:00
Victor Sokolov
f7a13c99de IMG-13: separate http.Headers from ImageData (#1475)
* Separate headers from ImageData

* processing.Result
2025-08-06 16:46:35 +02:00
Victor Sokolov
3d14c85de3 IMG-13: http.Header, *ImageData -> ImageData (#1473)
* ImageData.Headers()

* *ImageData -> ImageData

* withmatt -> httpheaders of our own

* .Clone() headers, nil

* NewFromBytesWithFormat -> nil

* svg.go -> do not Clone()
2025-08-01 15:44:21 +02:00
Victor Sokolov
efbea5fde5 New imagedata interface (#1471) 2025-07-31 18:18:13 +02:00
DarthSim
43bd1d73e1 Migrate to golangci-lint v2 2025-03-24 21:01:54 +03:00
DarthSim
528ece8da1 Revised errors for better error reporting 2025-02-17 22:11:40 +03:00
DarthSim
8e5282a415 Fix linter error 2024-12-12 17:59:23 +03:00
DarthSim
d931285ac2 Fix linter warnings 2024-10-02 23:43:24 +03:00
DarthSim
13d311fd1a Reset config at the start of config.Configure() 2024-04-30 17:04:12 +03:00
DarthSim
e31b24931d Update linter and fix linting errors 2024-04-18 21:16:32 +03:00
Frezyy
923b32a1b4 feat: Implement AlwaysRasterizeSvg (#1257)
Implement AlwaysRasterizeSvg
Add sanitize to skip processing
Add tests
Refactoring skipProcessing
2024-03-25 20:53:43 +06:00
DarthSim
04d65a220b Don't set Expires HTTP header 2023-12-04 20:31:05 +03:00
DarthSim
93063787b1 Add svg package tests 2023-07-04 18:34:18 +03:00
Andrei Vydrin
4de9b83899 fix(svg/sanitize): preserve headers from origin data 2023-07-04 18:34:18 +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
DarthSim
1a9768a2c6 Prohibit connecting to loopback, link-local multicast, and link-local unicast IP addresses by default 2023-03-22 20:25:51 +03:00
DarthSim
e719c9d39b Get rid of io/ioutil usage 2022-10-28 21:15:13 +06:00
DarthSim
f5f4fb6487 Borrow buffer from imagedata pool when sanitizing SVG 2022-10-15 19:31:04 +06:00
DarthSim
d610afb48b Use require instead of assert in tests 2022-07-18 19:48:50 +06:00
DarthSim
e1e2277a32 Sanitize SVG 2022-06-10 18:23:55 +06:00
DarthSim
9b5001c219 Disable logs in processhing_handler_test 2022-04-07 14:14:44 +06:00
DarthSim
749d29bf44 Stabilize etag tests 2021-09-30 22:00:28 +06:00
DarthSim
7709b74a5e Bump version 2021-09-30 20:23:30 +06:00
DarthSim
57c314b1f5 Etag passthough 2021-09-29 16:23:54 +06:00
DarthSim
d016e26e2e Merge branch 'master' into version/3 2021-09-07 19:04:33 +06:00
DarthSim
b8ae4640e8 Fix tests compatibility with go < 1.16 2021-05-18 16:06:52 +06:00
DarthSim
0af4720cfa Use imagetype and config in imagemeta 2021-05-13 20:39:13 +06:00
DarthSim
2ea1466d96 Global refactoring 2021-05-07 17:10:21 +06:00