Changeset 2182

Show
Ignore:
Timestamp:
05/22/2008 10:04:01 AM (1 month ago)
Author:
moo
Message:

fixed #729: Incorrect PATH_INFO when FastCGI is serving "/", use "fix-root-scriptname" => "enable" to workaround

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/lighttpd-1.4.x/src/mod_fastcgi.c

    r2173 r2182  
    235235 
    236236        unsigned short break_scriptfilename_for_php; 
     237 
     238        /* 
     239         * workaround for program when prefix="/" 
     240         * 
     241         * rule to build PATH_INFO is hardcoded for when check_local is disabled 
     242         * enable this option to use the workaround 
     243         * 
     244         */ 
     245 
     246        unsigned short fix_root_path_name; 
    237247 
    238248        /* 
     
    11961206                                                { "strip-request-uri",  NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },      /* 16 */ 
    11971207                                                { "kill-signal",        NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },      /* 17 */ 
     1208                                                { "fix-root-scriptname",   NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },  /* 18 */ 
    11981209 
    11991210                                                { NULL,                NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } 
     
    12231234                                        host->allow_xsendfile = 0; /* handle X-LIGHTTPD-send-file */ 
    12241235                                        host->kill_signal = SIGTERM; 
     1236                                        host->fix_root_path_name = 0; 
    12251237 
    12261238                                        fcv[0].destination = host->host; 
     
    12441256                                        fcv[16].destination = host->strip_request_uri; 
    12451257                                        fcv[17].destination = &(host->kill_signal); 
     1258                                        fcv[18].destination = &(host->fix_root_path_name); 
    12461259 
    12471260                                        if (0 != config_insert_values_internal(srv, da_host->value, fcv)) { 
     
    35863599                         * PATH_INFO   = /bar 
    35873600                         * 
     3601                         * if prefix = /, and fix-root-path-name is enable 
     3602                         * 
     3603                         * /fcgi-bin/foo/bar 
     3604                         * 
     3605                         * SCRIPT_NAME = /fcgi-bin/foo 
     3606                         * PATH_INFO   = /bar 
     3607                         * 
    35883608                         */ 
    35893609 
     
    35973617 
    35983618                                con->uri.path->used -= con->request.pathinfo->used - 1; 
     3619                                con->uri.path->ptr[con->uri.path->used - 1] = '\0'; 
     3620                        } else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') { 
     3621                                buffer_copy_string(con->request.pathinfo, con->uri.path->ptr); 
     3622                                con->uri.path->used = 1; 
    35993623                                con->uri.path->ptr[con->uri.path->used - 1] = '\0'; 
    36003624                        } 
  • branches/lighttpd-1.4.x/src/mod_scgi.c

    r2173 r2182  
    203203         */ 
    204204 
     205        /* 
     206         * workaround for program when prefix="/" 
     207         * 
     208         * rule to build PATH_INFO is hardcoded for when check_local is disabled 
     209         * enable this option to use the workaround 
     210         * 
     211         */ 
     212 
     213        unsigned short fix_root_path_name; 
    205214        ssize_t load; /* replace by host->load */ 
    206215 
     
    970979                                                { "bin-environment",   NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },        /* 11 */ 
    971980                                                { "bin-copy-environment", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },     /* 12 */ 
     981                                                { "fix-root-scriptname",  NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },   /* 13 */ 
    972982 
    973983 
     
    9921002                                        df->idle_timeout = 60; 
    9931003                                        df->disable_time = 60; 
     1004                                        df->fix_root_path_name = 0; 
    9941005 
    9951006                                        fcv[0].destination = df->host; 
     
    10081019                                        fcv[11].destination = df->bin_env; 
    10091020                                        fcv[12].destination = df->bin_env_copy; 
     1021                                        fcv[13].destination = &(df->fix_root_path_name); 
    10101022 
    10111023 
     
    28112823 
    28122824                                con->uri.path->used -= con->request.pathinfo->used - 1; 
     2825                                con->uri.path->ptr[con->uri.path->used - 1] = '\0'; 
     2826                        } else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') { 
     2827                                buffer_copy_string(con->request.pathinfo, con->uri.path->ptr); 
     2828                                con->uri.path->used = 1; 
    28132829                                con->uri.path->ptr[con->uri.path->used - 1] = '\0'; 
    28142830                        }