Skip to content

Fix lighttpd PATH_INFO extraction with MAPSERVER_BASE_PATH#1373

Open
Copilot wants to merge 1 commit intomasterfrom
copilot/add-test-case-for-issue-1108
Open

Fix lighttpd PATH_INFO extraction with MAPSERVER_BASE_PATH#1373
Copilot wants to merge 1 commit intomasterfrom
copilot/add-test-case-for-issue-1108

Conversation

Copy link

Copilot AI commented Mar 6, 2026

path_info.lua used Lua's gsub with a pattern built from MAPSERVER_BASE_PATH, which fails to correctly set request.path-info in lighttpd's mod_magnet environment — breaking mapfile alias resolution and ows_onlineresource construction in WMS GetCapabilities when the mapfile is specified as a path component.

Changes

  • runtime/etc/lighttpd/path_info.lua: Replace gsub-based extraction with plain-text find, as suggested in the upstream report:

    -- Before (broken)
    local result = path:gsub("^" .. base_path, "")
    lighty.r.req_attr["request.path-info"] = result
    
    -- After
    local base_i = path:find(base_path, 1, true)
    local base_l = base_path:len()
    if base_i == 1 and path:len() > base_l then
        lighty.r.req_attr["request.path-info"] = path:sub(base_l + 1)
    end

    find(..., 1, true) uses plain-text matching (no pattern interpretation), correctly stripping the base path and leaving the mapfile component as PATH_INFO.

  • acceptance_tests/test_wms.py: Add test_lighttpd_capabilities_url — verifies that GetMap operation URLs in the WMS GetCapabilities response start with BASE_URL_LIGHTTPD (i.e., include the correct base path + mapfile path), catching the PATH_INFO regression described in the issue.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add test case for issue 1108 comment Fix lighttpd PATH_INFO extraction with MAPSERVER_BASE_PATH Mar 6, 2026
@sbrunner sbrunner added the backport 8.6-gdal3.12 Add this label to backport the pull request to the '8.6-gdal3.12' branch label Mar 6, 2026
@sbrunner sbrunner marked this pull request as ready for review March 6, 2026 12:22
@sbrunner
Copy link
Member

sbrunner commented Mar 6, 2026

@johannes Does it looks good to you?

@johannes
Copy link

johannes commented Mar 6, 2026

I wouldn't use variable names base_i and base_l (i index, l length?)

But I am not the person you were looking for :)

Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
@sbrunner sbrunner force-pushed the copilot/add-test-case-for-issue-1108 branch from 7e4d0e8 to 86a478c Compare March 6, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 8.6-gdal3.12 Add this label to backport the pull request to the '8.6-gdal3.12' branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants