Skip to content

Dispatch /dims3/ on the handler - #122

Merged
beetlebugorg merged 1 commit into
mainfrom
feat/toggle-legacy-endpoints
Sep 1, 2026
Merged

Dispatch /dims3/ on the handler#122
beetlebugorg merged 1 commit into
mainfrom
feat/toggle-legacy-endpoints

Conversation

@beetlebugorg

@beetlebugorg beetlebugorg commented Sep 1, 2026

Copy link
Copy Markdown
Owner

What

dims_handler dispatches /dims3/ on the handler name. The container image sets each legacy handler from the environment: DIMS_ENABLE_DIMS3 defaults to off, DIMS_ENABLE_DIMS4 defaults to on.

Why

The dispatch matched the URI as well as the handler name:

(r->uri && strncmp(r->uri, "/dims3/", 7) == 0)

That test ran before any handler check, so the module responded to a /dims3/ request on any server that loaded it. I removed the <Location /dims3/> block from the running image and requested the path: the module responded with 500 from its own allowlist check. SetHandler None gave the same result. An operator had no way to stop serving /dims3/ short of unloading the module.

/dims4/, /dims5/, and dims-status dispatch on the handler name. /dims3/ now does the same.

Verify

make -C test test
make -C test sanitize
make -C test test-update

281 cases pass, 105 sanitizer cases report no finding, and every golden file reproduces. TestDims3HandlerRemoved and TestDims4HandlerRemoved request both paths on a server that sets SetHandler None, and expect 404. TestLegacyEndpointsServedWhereConfigured requests them on the default server and expects a status other than 404.

Against the built image:

docker run -d -p 8000:8000 mod-dims:ci
curl -o /dev/null -w '%{http_code}\n' \
  'http://127.0.0.1:8000/dims3/development/resize/100x100/?url=http://example.com/a.png'

I measured 404 with the image defaults and 500 with -e DIMS_ENABLE_DIMS3=on. The same run with -e DIMS_ENABLE_DIMS4=off returned 404 for /dims4/.

Breaking

A server that loads the module and has no <Location /dims3/> block stops serving /dims3/. A server whose configuration sets the handler is unaffected.

The image stops serving /dims3/ unless DIMS_ENABLE_DIMS3 is on. A deployment that uses /dims3/ through the image sets it.

dims_handler matched the /dims3/ URI as well as the handler name, so the
module served the path on any server that loaded it. Removing the
<Location /dims3/> block left the endpoint serving, and so did SetHandler
None.

The URI test is gone. Both legacy endpoints now dispatch on the handler
name, as /dims5/ and dims-status already do.

The container image drives each SetHandler from the environment.
DIMS_ENABLE_DIMS3 defaults to off and DIMS_ENABLE_DIMS4 defaults to on.
@beetlebugorg
beetlebugorg force-pushed the feat/toggle-legacy-endpoints branch from 97de3cf to 98336c0 Compare September 1, 2026 11:13
@beetlebugorg beetlebugorg changed the title Add DimsEnableDims3 and DimsEnableDims4 Dispatch /dims3/ on the handler Sep 1, 2026
@beetlebugorg
beetlebugorg merged commit 2c69660 into main Sep 1, 2026
6 checks passed
@beetlebugorg
beetlebugorg deleted the feat/toggle-legacy-endpoints branch September 1, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant