fixed #729: Incorrect PATH_INFO when FastCGI is serving "/", use "fix-root-scriptname" => "enable" to workaround
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2182 152afb58-edef-0310-8abb-c4023f1b3aa9svn/tags/lighttpd-1.4.20
parent
765d3cbe6a
commit
b5632eada1
|
@ -235,6 +235,16 @@ typedef struct {
|
|||
|
||||
unsigned short break_scriptfilename_for_php;
|
||||
|
||||
/*
|
||||
* workaround for program when prefix="/"
|
||||
*
|
||||
* rule to build PATH_INFO is hardcoded for when check_local is disabled
|
||||
* enable this option to use the workaround
|
||||
*
|
||||
*/
|
||||
|
||||
unsigned short fix_root_path_name;
|
||||
|
||||
/*
|
||||
* If the backend includes X-LIGHTTPD-send-file in the response
|
||||
* we use the value as filename and ignore the content.
|
||||
|
@ -1195,6 +1205,7 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
|
|||
{ "allow-x-send-file", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 15 */
|
||||
{ "strip-request-uri", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 16 */
|
||||
{ "kill-signal", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 17 */
|
||||
{ "fix-root-scriptname", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 18 */
|
||||
|
||||
{ NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
|
||||
};
|
||||
|
@ -1222,6 +1233,7 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
|
|||
host->break_scriptfilename_for_php = 0;
|
||||
host->allow_xsendfile = 0; /* handle X-LIGHTTPD-send-file */
|
||||
host->kill_signal = SIGTERM;
|
||||
host->fix_root_path_name = 0;
|
||||
|
||||
fcv[0].destination = host->host;
|
||||
fcv[1].destination = host->docroot;
|
||||
|
@ -1243,6 +1255,7 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
|
|||
fcv[15].destination = &(host->allow_xsendfile);
|
||||
fcv[16].destination = host->strip_request_uri;
|
||||
fcv[17].destination = &(host->kill_signal);
|
||||
fcv[18].destination = &(host->fix_root_path_name);
|
||||
|
||||
if (0 != config_insert_values_internal(srv, da_host->value, fcv)) {
|
||||
return HANDLER_ERROR;
|
||||
|
@ -3585,6 +3598,13 @@ static handler_t fcgi_check_extension(server *srv, connection *con, void *p_d, i
|
|||
* SCRIPT_NAME = /fcgi-bin/foo
|
||||
* PATH_INFO = /bar
|
||||
*
|
||||
* if prefix = /, and fix-root-path-name is enable
|
||||
*
|
||||
* /fcgi-bin/foo/bar
|
||||
*
|
||||
* SCRIPT_NAME = /fcgi-bin/foo
|
||||
* PATH_INFO = /bar
|
||||
*
|
||||
*/
|
||||
|
||||
/* the rewrite is only done for /prefix/? matches */
|
||||
|
@ -3597,6 +3617,10 @@ static handler_t fcgi_check_extension(server *srv, connection *con, void *p_d, i
|
|||
|
||||
con->uri.path->used -= con->request.pathinfo->used - 1;
|
||||
con->uri.path->ptr[con->uri.path->used - 1] = '\0';
|
||||
} else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
|
||||
buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
|
||||
con->uri.path->used = 1;
|
||||
con->uri.path->ptr[con->uri.path->used - 1] = '\0';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -202,6 +202,15 @@ typedef struct {
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* workaround for program when prefix="/"
|
||||
*
|
||||
* rule to build PATH_INFO is hardcoded for when check_local is disabled
|
||||
* enable this option to use the workaround
|
||||
*
|
||||
*/
|
||||
|
||||
unsigned short fix_root_path_name;
|
||||
ssize_t load; /* replace by host->load */
|
||||
|
||||
size_t max_id; /* corresponds most of the time to
|
||||
|
@ -969,6 +978,7 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) {
|
|||
|
||||
{ "bin-environment", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 11 */
|
||||
{ "bin-copy-environment", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 12 */
|
||||
{ "fix-root-scriptname", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 13 */
|
||||
|
||||
|
||||
{ NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
|
||||
|
@ -991,6 +1001,7 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) {
|
|||
df->max_load_per_proc = 1;
|
||||
df->idle_timeout = 60;
|
||||
df->disable_time = 60;
|
||||
df->fix_root_path_name = 0;
|
||||
|
||||
fcv[0].destination = df->host;
|
||||
fcv[1].destination = df->docroot;
|
||||
|
@ -1007,6 +1018,7 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) {
|
|||
|
||||
fcv[11].destination = df->bin_env;
|
||||
fcv[12].destination = df->bin_env_copy;
|
||||
fcv[13].destination = &(df->fix_root_path_name);
|
||||
|
||||
|
||||
if (0 != config_insert_values_internal(srv, da_host->value, fcv)) {
|
||||
|
@ -2811,6 +2823,10 @@ static handler_t scgi_check_extension(server *srv, connection *con, void *p_d, i
|
|||
|
||||
con->uri.path->used -= con->request.pathinfo->used - 1;
|
||||
con->uri.path->ptr[con->uri.path->used - 1] = '\0';
|
||||
} else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
|
||||
buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
|
||||
con->uri.path->used = 1;
|
||||
con->uri.path->ptr[con->uri.path->used - 1] = '\0';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue