/[mod_czs]/mod_czs.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /mod_czs.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by dpavlin, Wed Aug 9 21:09:50 2000 UTC revision 1.10 by dpavlin, Fri Aug 11 09:58:04 2000 UTC
# Line 28  Line 28 
28  #include "http_config.h"  #include "http_config.h"
29  #include "http_log.h"  #include "http_log.h"
30  #include "http_protocol.h"  #include "http_protocol.h"
 #include "translate.c"  
31    
32  module MODULE_VAR_EXPORT mod_czs;  module MODULE_VAR_EXPORT mod_czs;
33    
# Line 54  static int czs_handler(request_rec *r) { Line 53  static int czs_handler(request_rec *r) {
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] ) {
# Line 101  static int czs_handler(request_rec *r) { Line 102  static int czs_handler(request_rec *r) {
102          return OK;          return OK;
103  }  }
104    
105    int translate_path(request_rec *r) {
106            char *uri = r->uri;
107            request_rec *subr;
108            char *type = NULL;
109            extern do_czs;
110    
111            do_czs=0;
112    
113    #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
118                    ap_table_setn(r->headers_out, "Location", ap_pstrcat(r->pool, uri+2, "?czs", NULL));
119                    return REDIRECT;
120    #endif
121                    subr = (request_rec *) ap_sub_req_lookup_uri(r->uri+4, r);
122                    r->filename=ap_pstrdup(r->pool, subr->filename);
123                    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;
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;
138            }
139    
140            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 },

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.26