httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@zyzzyva.com>
Subject [PATCH] forcing handlers in SSI
Date Sat, 23 Aug 1997 15:36:58 GMT
I have the following bit of code that I have been dragging around. 
It would be nice if I could get something like this included in the 
server, or find a more acceptable way to the group to accomplish 
this.


===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_include.c,v
retrieving revision 1.47
diff -u -r1.47 mod_include.c
--- mod_include.c	1997/08/18 13:12:13	1.47
+++ mod_include.c	1997/08/23 15:35:21
@@ -765,6 +765,32 @@
     }
 }
 
+int handle_module (FILE *in, request_rec *r, char *error)
+{   
+    /*
+     * <!--#module mod_coolmodule="cooloption"-->
+     *
+     * will result in the handler "mod_coolmodule" (not a mime-type)
+     * to be called with "cooloption" set in "OptionString" in the
+     * "notes" table.
+     */
+    char tag[MAX_STRING_LEN];
+    char *tag_val;
+    
+    request_rec *rr = sub_req_lookup_uri (r->uri, r);
+    while (1) {
+        if (!(tag_val = get_tag(r->pool, in, tag, MAX_STRING_LEN, 0)))
+            return 1;
+    
+        if (!strcmp(tag,"done")) return 0;
+    
+        table_set(rr->notes, "OptionString", tag_val);
+        rr->handler = tag;
+        run_sub_req (rr);
+        destroy_sub_req (rr);
+    }
+}   
+
 #ifdef USE_PERL_SSI
 static int handle_perl (FILE *in, request_rec *r, char *error) {
     char tag[MAX_STRING_LEN];
@@ -1875,6 +1901,8 @@
                 ret = handle_flastmod(f, r, error, timefmt);
             else if (!strcmp(directive, "printenv"))
                 ret = handle_printenv(f, r, error);
+            else if(!strcmp(directive,"module"))
+                ret=handle_module(f, r, error);
 #ifdef USE_PERL_SSI
             else if (!strcmp(directive, "perl")) 
                 ret = handle_perl(f, r, error);


Mime
View raw message