--- mod_czs.c 2000/08/09 21:09:50 1.8 +++ mod_czs.c 2000/08/11 09:58:04 1.10 @@ -28,7 +28,6 @@ #include "http_config.h" #include "http_log.h" #include "http_protocol.h" -#include "translate.c" module MODULE_VAR_EXPORT mod_czs; @@ -54,29 +53,31 @@ #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 - 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; - } - -#ifdef TEST_QUERYSTRING - if(r->args == 0 && !do_czs) { +#ifdef TEST_QUERYSTRINGV + if(r->args == 0 && !do_czs || strstr(r->content_type,"cgi") != NULL) { #else - if(!do_czs) { + if(!do_czs || strstr(r->content_type,"cgi") != NULL) { #endif - ap_send_fd(in, r); + return DECLINED; +/* ap_send_fd(in, r); */ } else { + 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; + } + while(fgets(buffer,MAX_STRING_LEN,in)) { for(i=0; iuri; + request_rec *subr; + char *type = NULL; + extern do_czs; + + do_czs=0; + +#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+4, r); + r->filename=ap_pstrdup(r->pool, subr->filename); + 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 },