| 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) { |
| 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; |
| 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; |