Changeset 477

Show
Ignore:
Timestamp:
07/28/2005 10:22:53 AM (3 years ago)
Author:
jan
Message:

added support to have a PATH_INFO on /prefix if check-local is disabled

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/lighttpd-1.3.x/src/mod_fastcgi.c

    r470 r477  
    330330        int       fde_ndx;   /* index into the fd-event buffer */ 
    331331 
    332         size_t    path_info_offset; /* start of path_info in uri.path */ 
    333          
    334332        pid_t     pid; 
    335333        int       got_proc; 
     
    29702968        buffer *fn; 
    29712969        fcgi_extension *extension = NULL; 
    2972         size_t path_info_offset; 
    29732970         
    29742971        /* Possibly, we processed already this request */ 
     
    29912988        } 
    29922989         
    2993         path_info_offset = 0; 
    2994          
    29952990        /* check if extension matches */ 
    29962991        for (k = 0; k < p->conf.exts->used; k++) { 
    2997                 size_t ct_len; 
     2992                size_t ct_len; /* length of the config entry */ 
    29982993                 
    29992994                extension = p->conf.exts->exts[k]; 
     
    30073002                /* check extension in the form "/fcgi_pattern" */ 
    30083003                if (*(extension->key->ptr) == '/' && strncmp(fn->ptr, extension->key->ptr, ct_len) == 0) { 
    3009                         if (s_len > ct_len + 1) { 
    3010                                 char *pi_offset; 
    3011                                  
    3012                                 if (0 != (pi_offset = strchr(fn->ptr + ct_len + 1, '/'))) { 
    3013                                         path_info_offset = pi_offset - fn->ptr; 
    3014                                 } 
    3015                         } 
    30163004                        break; 
    30173005                } else if (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len)) { 
     
    30533041                        if (host->check_local == 0) { 
    30543042                                handler_ctx *hctx; 
     3043                                char *pathinfo; 
     3044                                 
    30553045                                hctx = handler_ctx_init(); 
    30563046                                 
    3057                                 hctx->path_info_offset = path_info_offset; 
    30583047                                hctx->remote_conn      = con; 
    30593048                                hctx->plugin_data      = p; 
     
    30733062                                        log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_fastcgi"); 
    30743063                                } 
     3064                                 
     3065                                /* the prefix is the SCRIPT_NAME,  
     3066                                 * everthing from start to the next slash 
     3067                                 * this is important for check-local = "disable" 
     3068                                 *  
     3069                                 * if prefix = /admin.fcgi 
     3070                                 *  
     3071                                 * /admin.fcgi/foo/bar 
     3072                                 *  
     3073                                 * SCRIPT_NAME = /admin.fcgi 
     3074                                 * PATH_INFO   = /foo/bar 
     3075                                 *  
     3076                                 * if prefix = /fcgi-bin/ 
     3077                                 *  
     3078                                 * /fcgi-bin/foo/bar 
     3079                                 *  
     3080                                 * SCRIPT_NAME = /fcgi-bin/foo 
     3081                                 * PATH_INFO   = /bar 
     3082                                 *  
     3083                                 */ 
     3084                                 
     3085                                /* the rewrite is only done for /prefix/? matches */ 
     3086                                if (extension->key->ptr[0] == '/' && 
     3087                                    con->uri.path->used > extension->key->used && 
     3088                                    NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) { 
     3089                                        /* rewrite uri.path and pathinfo */  
     3090                                         
     3091                                        buffer_copy_string(con->request.pathinfo, pathinfo); 
     3092                                         
     3093                                        con->uri.path->used -= con->request.pathinfo->used - 1; 
     3094                                        con->uri.path->ptr[con->uri.path->used - 1] = '\0'; 
     3095                                } 
    30753096                        } 
    30763097                        return HANDLER_GO_ON; 
     
    30793100                        hctx = handler_ctx_init(); 
    30803101                         
    3081                         hctx->path_info_offset = path_info_offset; 
    30823102                        hctx->remote_conn      = con; 
    30833103                        hctx->plugin_data      = p;