Bug 31214 - mod_include doesn't fixup PATH_INFO in environment of sub-includes
Summary: mod_include doesn't fixup PATH_INFO in environment of sub-includes
Alias: None
Product: Apache httpd-1.3
Classification: Unclassified
Component: mod_include (show other bugs)
Version: 1.3.31
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2004-09-14 10:58 UTC by Carl Johnstone
Modified: 2007-08-02 12:41 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Carl Johnstone 2004-09-14 10:58:16 UTC
---- test.html ----
<!--#echo var="PATH_INFO" -->
<!--#echo var="QUERY_STRING" -->

---- test2.html -----
<!--#include virtual="test.html/path?query" -->

Requesting http://site/test.html/path?query gives me:

       path query

Requesting http://site/test2.html gives me:

       (none) query

They should match. From investigation, I think it's because the PATH_INFO isn't 
setup in the environment of the subrequest.

Digging around in src/modules/standard/mod_include.c - around line 2181 
QUERY_STRING is fixed up, however PATH_INFO isn't. If I add this in:

  if (r->path_info) {
       ap_table_setn(r->subprocess_env, "PATH_INFO", r->path_info);

Then it seems to then work fine for my simple test case.
Comment 1 André Malo 2004-09-14 11:03:45 UTC
I could imagine, that this is intentional.

Anyway, changing that would break backwards compat, so wontfix.
Comment 2 Carl Johnstone 2004-09-14 11:14:03 UTC
Why would fixing the bug break backwards compatibility?

If you want to check for PATH_INFO, or the value of the PATH_INFO then it 
doesn't work. If you want to check for a lack of PATH_INFO it doesn't work.

Anybody who is currently trying to check PATH_INFO within a sub-include will 
not be getting proper results - therefore they cannot be depending on this 

My diagnosis and/or fix of the problem may be wrong - but the bug is fixable.
Comment 3 André Malo 2004-09-14 11:19:47 UTC
You should get the PATH_INFO of the caller. That behaviour won't be changed. If
you think, another behaviour is betterm just make a featrue request for 2.1.
Comment 4 Carl Johnstone 2004-09-14 11:32:43 UTC
The PATH_INFO of the caller is a different value and may not even exist. Did 
you even bother *reading* my bug report and looking at the test case?
Comment 5 André Malo 2004-09-14 11:39:49 UTC
Sure. echoing a NULL pointer gives (none).