httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@zyzzyva.com>
Subject Re: Fwd> Apache: XSSI: Pagecounter command added
Date Wed, 14 Aug 1996 21:18:35 GMT
Here is a patch against the current mod_include.c to add this
functionality.

*** mod_include.c.orig	Wed Aug 14 16:11:38 1996
--- mod_include.c	Wed Aug 14 16:14:25 1996
***************
*** 656,663 ****
      }
  }
  
! int handle_config(FILE *in, request_rec *r, char *error, char *tf,
!                   int *sizefmt) {
      char tag[MAX_STRING_LEN];
      char *tag_val;
      char parsed_string[MAX_STRING_LEN];
--- 656,689 ----
      }
  }
  
! 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);
!     }
! }
!   
! int handle_config(FILE *in, request_rec *r, char *error, char *tf, int *sizefmt)
! {
      char tag[MAX_STRING_LEN];
      char *tag_val;
      char parsed_string[MAX_STRING_LEN];
***************
*** 1605,1610 ****
--- 1631,1638 ----
                  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);
              else {
                  log_printf(r->server,
                          "httpd: unknown directive %s in parsed doc %s",

> 
> Randy Terbush writes:
> > Actually, Chris Radek and I worked up a similar deal sometime back
> > that adds a <!--#module -->  tag to SSI which does an internal_redirect
> > to a different handler. I think it would be of more general use.
> > I'll send along a patch if anyone thinks this would be useful.
> > 
> > The syntax for the example below would be:
> > 
> > <!--#module pagecounter="..."-->
> > 
> > Passing whatever arguments in the r->notes.
> > 
> > (assuming 'pagecounter' is a registered handler)
> 
> I like this concept as it allows people to add more or less static
> functionality to the server and use it directly.  I'm wondering if
> the overhead of the module interface is really necessary for this
> though.  Since the page is already being processed, you can't get
> at most of the module exits or do 90% of things that a module can
> do.  Basically, you can do the equivilent of a function call with
> the user passing parameters.
> 
> Balance that with the fact that the module interface already exists
> and developing yet another registration scheme is yet more overhead
> and provides more room for bugs.
> 
> Yes, I do think this could be an interesting addition.
> 
> --
> Howard Fear      email1: howard_fear@pageplus.com
>                  email2: howard_fear@stortek.com
>                  http://www.pageplus.com/~hsf/




Mime
View raw message