--- mod_czs.c 2000/08/09 08:45:38 1.3 +++ mod_czs.c 2000/08/11 09:58:04 1.10 @@ -50,49 +50,52 @@ ap_log_reason("file permissions deny server access", r->filename, r); return FORBIDDEN; } +#ifdef DEBUG if(r->args != 0 || do_czs) { ap_table_setn(r->headers_out, "X-czs_filename", r->filename); + ap_table_setn(r->headers_out, "X-czs_content-type", r->content_type); if (r->args != 0) { ap_table_setn(r->headers_out, "X-czs_args", r->args); } } +#endif - r->content_type = "text/html"; /* hm? */ +#ifdef TEST_QUERYSTRINGV + if(r->args == 0 && !do_czs || strstr(r->content_type,"cgi") != NULL) { +#else + if(!do_czs || strstr(r->content_type,"cgi") != NULL) { +#endif + return DECLINED; +/* ap_send_fd(in, r); */ + } else { - ap_soft_timeout("send", r); - ap_send_http_header(r); + ap_soft_timeout("send", r); + ap_send_http_header(r); - if(r->header_only) { - ap_kill_timeout(r); - ap_pfclose(r->pool, in); - return OK; - } + if(r->header_only) { + ap_kill_timeout(r); + ap_pfclose(r->pool, in); + return OK; + } -#ifdef TEST_QUERYSTRING - if(r->args == 0 && !do_czs) { - ap_send_fd(in, r); - } else { -#endif - while(fgets(buffer,MAX_STRING_LEN,in)) { - for(i=0; ipool, in); @@ -102,23 +105,40 @@ int translate_path(request_rec *r) { char *uri = r->uri; request_rec *subr; + char *type = NULL; + extern do_czs; + do_czs=0; - if (uri[0]=='/' && uri[1]=='_' && uri[2]=='/') { +#ifdef DEBUG + ap_table_setn(r->headers_out, "X-translate", r->uri); +#endif + if (uri[0]=='/' && (uri[1] | 0x20) =='c' && (uri[2] | 0x20)=='z' && (uri[3] | 0x20) =='s') { #if 0 ap_table_setn(r->headers_out, "Location", ap_pstrcat(r->pool, uri+2, "?czs", NULL)); return REDIRECT; #endif - subr = (request_rec *) ap_sub_req_lookup_uri(r->uri+2, r); + subr = (request_rec *) ap_sub_req_lookup_uri(r->uri+4, r); r->filename=ap_pstrdup(r->pool, subr->filename); - ap_destroy_sub_req(subr); + type = subr->content_type; +#ifdef DEBUG + ap_table_setn(r->headers_out, "X-translate-content-type", type); +#endif + if (type == NULL) { + return DECLINED; /* hm? */ + } do_czs=1; + ap_destroy_sub_req(subr); +#ifdef XHEADER +# ifdef DEBUG + ap_table_setn(r->headers_out, "X-debug", XHEADER); +# endif +#endif return OK; } return DECLINED; } - /* Dispatch list of content handlers */ static const handler_rec czs_handlers[] = { { "czs", czs_handler }, @@ -146,5 +166,11 @@ NULL, /* child_init */ NULL, /* child_exit */ NULL /* [#0] post read-request */ +#ifdef EAPI + ,NULL, /* EAPI: add_module */ + NULL, /* EAPI: remove_module */ + NULL, /* EAPI: rewrite_command */ + NULL /* EAPI: new_connection */ +#endif };