Mailing List Archive

[no subject]
In apache 0.8.7 and 0.8.8 (and earlier versions), for a parsed html file
containing a <!--#exec cmd -->

PATH_INFO was set, even if NULL.
If PATH_INFO was unset, PATH_TRANSLATED was set to the directory containing
the shtml file.
PATH_TRANSLATED might not contain all the translated path.
e.g. if the URL was /test.shtml/index.html/wibble
then PATH_INFO would be /index.html/wibble
but PATH_TRANSLATED would only be /docroot/index.html
If the URL contains encoded '%' characters then PATH_TRANSLATED might
be incorrect.

Fix: copy the code for setting PATH_INFO and PATH_TRANSLATED from
mod_cgi.c to mod_include.c, replacing the code in include_cmd_child.
This guarantees that the two methods of invoking CGI scripts are
(bug for bug) compatible.

David.

------------------- begin file inc.patch ---------------------------
*** mod_include.c~ Tue Aug 1 01:47:02 1995
--- mod_include.c Mon Aug 7 13:27:59 1995
***************
*** 408,423 ****
#ifdef DEBUG_INCLUDE_CMD
FILE *dbg = fopen ("/dev/tty", "w");
#endif
-
- request_rec *pa_req = sub_req_lookup_uri (r->path_info, r);
char err_string [MAX_STRING_LEN];

#ifdef DEBUG_INCLUDE_CMD
fprintf (dbg, "Attempting to include command '%s'\n", s);
#endif
!
! table_set (env, "PATH_INFO", escape_shell_cmd (r->pool, r->path_info));
! if (pa_req->filename) table_set (env, "PATH_TRANSLATED", pa_req->filename);

if (r->args) {
table_set (env, "QUERY_STRING", r->args);
--- 408,431 ----
#ifdef DEBUG_INCLUDE_CMD
FILE *dbg = fopen ("/dev/tty", "w");
#endif
char err_string [MAX_STRING_LEN];

#ifdef DEBUG_INCLUDE_CMD
fprintf (dbg, "Attempting to include command '%s'\n", s);
#endif
!
! if (r->path_info && r->path_info[0] != '\0')
! {
! request_rec *pa_req;
!
! table_set (env, "PATH_INFO", escape_shell_cmd (r->pool, r->path_info));
!
! pa_req = sub_req_lookup_uri(escape_uri(r->pool, r->path_info), r);
! if (pa_req->filename)
! table_set(env, "PATH_TRANSLATED",
! pstrcat(r->pool, pa_req->filename, pa_req->path_info,
! NULL));
! }

if (r->args) {
table_set (env, "QUERY_STRING", r->args);
------------------- end file inc.patch ---------------------------