diff --git a/NEWS b/NEWS index 105544ef..b0f3b06f 100644 --- a/NEWS +++ b/NEWS @@ -77,6 +77,7 @@ NEWS * [mod_ssi] config ssi.conditional-requests * [mod_ssi] config ssi.exec (fixes #2051) * [mod_redirect,mod_rewrite] short-circuit if blank replacement (fixes #2085) + * [mod_indexfile] save physical path to env (fixes #448, #892) - 1.4.39 - 2016-01-02 * [core] fix memset_s call (fixes #2698) diff --git a/src/mod_indexfile.c b/src/mod_indexfile.c index c0027b41..90829d43 100644 --- a/src/mod_indexfile.c +++ b/src/mod_indexfile.c @@ -193,11 +193,22 @@ URIHANDLER_FUNC(mod_indexfile_subrequest) { continue; } - /* rewrite uri.path to the real path (/ -> /index.php) */ - buffer_append_string_buffer(con->uri.path, ds->value); - buffer_copy_buffer(con->physical.path, p->tmp_buf); + if (ds->value && ds->value->ptr[0] == '/') { + /* replace uri.path */ + buffer_copy_buffer(con->uri.path, ds->value); - /* fce is already set up a few lines above */ + if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) { + ds = data_string_init(); + } + buffer_copy_string_len(ds->key, CONST_STR_LEN("PATH_TRANSLATED_DIRINDEX")); + buffer_copy_buffer(ds->value, con->physical.path); + array_insert_unique(con->environment, (data_unset *)ds); + } else { + /* append to uri.path the relative path to index file (/ -> /index.php) */ + buffer_append_string_buffer(con->uri.path, ds->value); + } + + buffer_copy_buffer(con->physical.path, p->tmp_buf); return HANDLER_GO_ON; }