53 |
#ifdef DEBUG |
#ifdef DEBUG |
54 |
if(r->args != 0 || do_czs) { |
if(r->args != 0 || do_czs) { |
55 |
ap_table_setn(r->headers_out, "X-czs_filename", r->filename); |
ap_table_setn(r->headers_out, "X-czs_filename", r->filename); |
56 |
|
ap_table_setn(r->headers_out, "X-czs_content-type", r->content_type); |
57 |
if (r->args != 0) { |
if (r->args != 0) { |
58 |
ap_table_setn(r->headers_out, "X-czs_args", r->args); |
ap_table_setn(r->headers_out, "X-czs_args", r->args); |
59 |
} |
} |
60 |
} |
} |
61 |
#endif |
#endif |
62 |
|
|
63 |
ap_soft_timeout("send", r); |
#ifdef TEST_QUERYSTRINGV |
64 |
ap_send_http_header(r); |
if(r->args == 0 && !do_czs || strstr(r->content_type,"cgi") != NULL) { |
|
|
|
|
if(r->header_only) { |
|
|
ap_kill_timeout(r); |
|
|
ap_pfclose(r->pool, in); |
|
|
return OK; |
|
|
} |
|
|
|
|
|
#ifdef TEST_QUERYSTRING |
|
|
if(r->args == 0 && !do_czs) { |
|
65 |
#else |
#else |
66 |
if(!do_czs) { |
if(!do_czs || strstr(r->content_type,"cgi") != NULL) { |
67 |
#endif |
#endif |
68 |
ap_send_fd(in, r); |
return DECLINED; |
69 |
|
/* ap_send_fd(in, r); */ |
70 |
} else { |
} else { |
71 |
|
|
72 |
|
ap_soft_timeout("send", r); |
73 |
|
ap_send_http_header(r); |
74 |
|
|
75 |
|
if(r->header_only) { |
76 |
|
ap_kill_timeout(r); |
77 |
|
ap_pfclose(r->pool, in); |
78 |
|
return OK; |
79 |
|
} |
80 |
|
|
81 |
while(fgets(buffer,MAX_STRING_LEN,in)) { |
while(fgets(buffer,MAX_STRING_LEN,in)) { |
82 |
for(i=0; i<MAX_STRING_LEN && buffer[i]; i++) { |
for(i=0; i<MAX_STRING_LEN && buffer[i]; i++) { |
83 |
switch ( buffer[i] ) { |
switch ( buffer[i] ) { |
105 |
int translate_path(request_rec *r) { |
int translate_path(request_rec *r) { |
106 |
char *uri = r->uri; |
char *uri = r->uri; |
107 |
request_rec *subr; |
request_rec *subr; |
108 |
|
char *type = NULL; |
109 |
|
extern do_czs; |
110 |
|
|
111 |
do_czs=0; |
do_czs=0; |
112 |
|
|
113 |
if (uri[0]=='/' && uri[1]=='c' && uri[2]=='z' && uri[3]=='s') { |
#ifdef DEBUG |
114 |
|
ap_table_setn(r->headers_out, "X-translate", r->uri); |
115 |
|
#endif |
116 |
|
if (uri[0]=='/' && (uri[1] | 0x20) =='c' && (uri[2] | 0x20)=='z' && (uri[3] | 0x20) =='s') { |
117 |
#if 0 |
#if 0 |
118 |
ap_table_setn(r->headers_out, "Location", ap_pstrcat(r->pool, uri+2, "?czs", NULL)); |
ap_table_setn(r->headers_out, "Location", ap_pstrcat(r->pool, uri+2, "?czs", NULL)); |
119 |
return REDIRECT; |
return REDIRECT; |
120 |
#endif |
#endif |
121 |
subr = (request_rec *) ap_sub_req_lookup_uri(r->uri+4, r); |
subr = (request_rec *) ap_sub_req_lookup_uri(r->uri+4, r); |
122 |
r->filename=ap_pstrdup(r->pool, subr->filename); |
r->filename=ap_pstrdup(r->pool, subr->filename); |
123 |
ap_destroy_sub_req(subr); |
type = subr->content_type; |
124 |
|
#ifdef DEBUG |
125 |
|
ap_table_setn(r->headers_out, "X-translate-content-type", type); |
126 |
|
#endif |
127 |
|
if (type == NULL) { |
128 |
|
return DECLINED; /* hm? */ |
129 |
|
} |
130 |
do_czs=1; |
do_czs=1; |
131 |
|
ap_destroy_sub_req(subr); |
132 |
|
#ifdef XHEADER |
133 |
|
# ifdef DEBUG |
134 |
|
ap_table_setn(r->headers_out, "X-debug", XHEADER); |
135 |
|
# endif |
136 |
|
#endif |
137 |
return OK; |
return OK; |
138 |
} |
} |
139 |
|
|
140 |
return DECLINED; |
return DECLINED; |
141 |
} |
} |
|
|
|
142 |
/* Dispatch list of content handlers */ |
/* Dispatch list of content handlers */ |
143 |
static const handler_rec czs_handlers[] = { |
static const handler_rec czs_handlers[] = { |
144 |
{ "czs", czs_handler }, |
{ "czs", czs_handler }, |
166 |
NULL, /* child_init */ |
NULL, /* child_init */ |
167 |
NULL, /* child_exit */ |
NULL, /* child_exit */ |
168 |
NULL /* [#0] post read-request */ |
NULL /* [#0] post read-request */ |
169 |
|
#ifdef EAPI |
170 |
|
,NULL, /* EAPI: add_module */ |
171 |
|
NULL, /* EAPI: remove_module */ |
172 |
|
NULL, /* EAPI: rewrite_command */ |
173 |
|
NULL /* EAPI: new_connection */ |
174 |
|
#endif |
175 |
}; |
}; |
176 |
|
|