Repository navigation
mod_proxy_fcgi: Fix SCRIPT_NAME with %-escapes and proxy-fcgi-pathinfo - #1053
Open
arturobernalg wants to merge 1 commit into
Open
arturobernalg wants to merge 1 commit into
arturobernalg wants to merge 1 commit into
Conversation
With proxy-fcgi-pathinfo set to keep the URL path as is (any value but first-dot, last-dot, full or unescape), r->path_info is %-encoded while r->uri is decoded. ap_add_cgi_vars() then fails to find where PATH_INFO starts in r->uri as soon as the path has an escape, and SCRIPT_NAME gets the whole path. Set SCRIPT_NAME again from the decoded PATH_INFO in that case, except for an SSI include where core sets it to the whole URI. PATH_INFO itself is sent unchanged. PR 66608.
arturobernalg
force-pushed
the
fix/bz66608-fcgi-script-name-escapes
branch
from
November 18, 2026 09:28
0773639 to
1fac837
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66608
With
proxy-fcgi-pathinfoset to keep the URL path as is (e.g.SetEnvIf Request_URI . proxy-fcgi-pathinfo=1), a request like/rt5/a%20b/cbehindProxyPass /rt5/ fcgi://...gets SCRIPT_NAME/rt5/a b/cinstead of/rt5.In that mode r->path_info is %-encoded while r->uri is decoded, so ap_add_cgi_vars() cannot find where PATH_INFO starts in r->uri once the path has an escape. SCRIPT_NAME is now set again from the decoded PATH_INFO, with the same handling of encoded slashes as r->uri. PATH_INFO itself is sent unchanged, as documented. RFC 3875 4.1.13: no PATH_INFO segment is included in SCRIPT_NAME.
Test: test/modules/proxy/test_12_fcgi_script_name.py, with a small FastCGI backend (fcgi_echo.py) that echoes the CGI variables. The two escaped cases fail on trunk and pass with the fix; the plain and
unescapecases pass on both. The proxy suite passes (64).(see
SECURITY.mdandhttps://www.apache.org/security/#reporting-a-vulnerability).
APLOGNO()tag;numbers are assigned by a committer at merge time (see
docs/log-message-tags/README).changes-entries/*.txtfile is included,following the template in
README.CHANGES(not needed otherwise).test/modules/xxxdirectory matching themodules/xxxmodule source,or
test/modules/corefor core server changes. On Unix, verify thesepass locally with e.g.
make check-pytest PYTEST_DIRS=test/modules/xxx.