Changeset 2172

Show
Ignore:
Timestamp:
05/22/2008 03:31:22 AM (3 months ago)
Author:
moo
Message:

sync the "if" logic block with mod_fastcgi to make the indention same

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/lighttpd-1.4.x/src/mod_scgi.c

    r2109 r2172  
    26732673        buffer *fn; 
    26742674        scgi_extension *extension = NULL; 
     2675        scgi_extension_host *host = NULL; 
    26752676 
    26762677        /* Possibly, we processed already this request */ 
     
    27272728 
    27282729        /* found a server */ 
    2729         if (ndx != -1) { 
    2730                 scgi_extension_host *host = extension->hosts[ndx]; 
    2731  
    2732                 /* 
    2733                  * if check-local is disabled, use the uri.path handler 
    2734                  * 
    2735                  */ 
    2736  
    2737                 /* init handler-context */ 
    2738                 if (uri_path_handler) { 
    2739                         if (host->check_local == 0) { 
    2740                                 handler_ctx *hctx; 
    2741                                 char *pathinfo; 
    2742  
    2743                                 hctx = handler_ctx_init(); 
    2744  
    2745                                 hctx->remote_conn      = con; 
    2746                                 hctx->plugin_data      = p; 
    2747                                 hctx->host             = host; 
    2748                                 hctx->proc             = NULL; 
    2749  
    2750                                 hctx->conf.exts        = p->conf.exts; 
    2751                                 hctx->conf.debug       = p->conf.debug; 
    2752  
    2753                                 con->plugin_ctx[p->id] = hctx; 
    2754  
    2755                                 host->load++; 
    2756  
    2757                                 con->mode = p->id; 
    2758  
    2759                                 if (con->conf.log_request_handling) { 
    2760                                         log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_scgi"); 
    2761                                 } 
    2762  
    2763                                 /* the prefix is the SCRIPT_NAME, 
    2764                                  * everthing from start to the next slash 
    2765                                  * this is important for check-local = "disable" 
    2766                                  * 
    2767                                  * if prefix = /admin.fcgi 
    2768                                  * 
    2769                                  * /admin.fcgi/foo/bar 
    2770                                  * 
    2771                                  * SCRIPT_NAME = /admin.fcgi 
    2772                                  * PATH_INFO   = /foo/bar 
    2773                                  * 
    2774                                  * if prefix = /fcgi-bin/ 
    2775                                  * 
    2776                                  * /fcgi-bin/foo/bar 
    2777                                  * 
    2778                                  * SCRIPT_NAME = /fcgi-bin/foo 
    2779                                  * PATH_INFO   = /bar 
    2780                                  * 
    2781                                  */ 
    2782  
    2783                                 /* the rewrite is only done for /prefix/? matches */ 
    2784                                 if (extension->key->ptr[0] == '/' && 
    2785                                     con->uri.path->used > extension->key->used && 
    2786                                     NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) { 
    2787                                         /* rewrite uri.path and pathinfo */ 
    2788  
    2789                                         buffer_copy_string(con->request.pathinfo, pathinfo); 
    2790  
    2791                                         con->uri.path->used -= con->request.pathinfo->used - 1; 
    2792                                         con->uri.path->ptr[con->uri.path->used - 1] = '\0'; 
    2793                                 } 
    2794                         } 
    2795                         return HANDLER_GO_ON; 
    2796                 } else { 
     2730        if (ndx == -1) { 
     2731                /* no handler found */ 
     2732                buffer_reset(con->physical.path); 
     2733                con->http_status = 500; 
     2734 
     2735                log_error_write(srv, __FILE__, __LINE__,  "sb", 
     2736                                "no fcgi-handler found for:", 
     2737                                fn); 
     2738 
     2739                return HANDLER_FINISHED; 
     2740        } 
     2741 
     2742        host = extension->hosts[ndx]; 
     2743 
     2744        /* 
     2745         * if check-local is disabled, use the uri.path handler 
     2746         * 
     2747         */ 
     2748 
     2749        /* init handler-context */ 
     2750        if (uri_path_handler) { 
     2751                if (host->check_local == 0) { 
    27972752                        handler_ctx *hctx; 
     2753                        char *pathinfo; 
     2754 
    27982755                        hctx = handler_ctx_init(); 
    27992756 
     
    28012758                        hctx->plugin_data      = p; 
    28022759                        hctx->host             = host; 
    2803                         hctx->proc             = NULL; 
     2760                        hctx->proc             = NULL; 
    28042761 
    28052762                        hctx->conf.exts        = p->conf.exts; 
     
    28132770 
    28142771                        if (con->conf.log_request_handling) { 
    2815                                 log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_fastcgi"); 
    2816                         } 
    2817  
    2818                         return HANDLER_GO_ON; 
    2819                 } 
     2772                                log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_scgi"); 
     2773                        } 
     2774 
     2775                        /* the prefix is the SCRIPT_NAME, 
     2776                         * everthing from start to the next slash 
     2777                         * this is important for check-local = "disable" 
     2778                         * 
     2779                         * if prefix = /admin.fcgi 
     2780                         * 
     2781                         * /admin.fcgi/foo/bar 
     2782                         * 
     2783                         * SCRIPT_NAME = /admin.fcgi 
     2784                         * PATH_INFO   = /foo/bar 
     2785                         * 
     2786                         * if prefix = /fcgi-bin/ 
     2787                         * 
     2788                         * /fcgi-bin/foo/bar 
     2789                         * 
     2790                         * SCRIPT_NAME = /fcgi-bin/foo 
     2791                         * PATH_INFO   = /bar 
     2792                         * 
     2793                         */ 
     2794 
     2795                        /* the rewrite is only done for /prefix/? matches */ 
     2796                        if (extension->key->ptr[0] == '/' && 
     2797                            con->uri.path->used > extension->key->used && 
     2798                            NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) { 
     2799                                /* rewrite uri.path and pathinfo */ 
     2800 
     2801                                buffer_copy_string(con->request.pathinfo, pathinfo); 
     2802 
     2803                                con->uri.path->used -= con->request.pathinfo->used - 1; 
     2804                                con->uri.path->ptr[con->uri.path->used - 1] = '\0'; 
     2805                        } 
     2806                } 
     2807                return HANDLER_GO_ON; 
    28202808        } else { 
    2821                 /* no handler found */ 
    2822                 buffer_reset(con->physical.path); 
    2823                 con->http_status = 500; 
    2824  
    2825                 log_error_write(srv, __FILE__, __LINE__,  "sb", 
    2826                                 "no fcgi-handler found for:", 
    2827                                 fn); 
    2828  
    2829                 return HANDLER_FINISHED; 
     2809                handler_ctx *hctx; 
     2810                hctx = handler_ctx_init(); 
     2811 
     2812                hctx->remote_conn      = con; 
     2813                hctx->plugin_data      = p; 
     2814                hctx->host             = host; 
     2815                hctx->proc             = NULL; 
     2816 
     2817                hctx->conf.exts        = p->conf.exts; 
     2818                hctx->conf.debug       = p->conf.debug; 
     2819 
     2820                con->plugin_ctx[p->id] = hctx; 
     2821 
     2822                host->load++; 
     2823 
     2824                con->mode = p->id; 
     2825 
     2826                if (con->conf.log_request_handling) { 
     2827                        log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_fastcgi"); 
     2828                } 
     2829 
     2830                return HANDLER_GO_ON; 
    28302831        } 
    28312832        return HANDLER_GO_ON;