You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by st...@apache.org on 2001/11/30 15:08:44 UTC

cvs commit: apache-1.3/src/main buff.c

stoddard    01/11/30 06:08:44

  Modified:    src      CHANGES
               src/include ap_mmn.h buff.h
               src/main buff.c
  Log:
  Modify buff.h and buff.c to enable modules to intercept the
  output byte stream for dynamic page caching. A pointer to a
  'filter callback' function is added to the end of buff.h.
  This function, if registered by a module, is called
  at the top of buff_write() and writev_it_all().
  
  MMN Minor bumped.
  
  Obtained from: [Kevin Mallory <km...@spidercache.com>
  Reviewed by:	Bill Stoddard
  
  Revision  Changes    Path
  1.1744    +7 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1743
  retrieving revision 1.1744
  diff -u -r1.1743 -r1.1744
  --- CHANGES	2001/11/28 15:02:12	1.1743
  +++ CHANGES	2001/11/30 14:08:43	1.1744
  @@ -1,4 +1,11 @@
   Changes with Apache 1.3.23
  +  *) Modify buff.h and buff.c to enable modules to intercept the
  +     output byte stream for dynamic page caching. A pointer to a 
  +     'filter callback' function is added to the end of buff.h. 
  +     This function, if registered by a module, is called 
  +     at the top of buff_write() and writev_it_all().
  +     [Kevin Mallory <km...@spidercache.com>
  +
     *) When the default of 'Group #-1' was changed to 'Group "#-1"',
        the Makefile wasn't updated to recognise the quotation marks.
        [Owen Boyle <ob...@bourse.ch>]
  
  
  
  1.55      +3 -1      apache-1.3/src/include/ap_mmn.h
  
  Index: ap_mmn.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/ap_mmn.h,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- ap_mmn.h	2001/01/15 17:04:28	1.54
  +++ ap_mmn.h	2001/11/30 14:08:43	1.55
  @@ -231,6 +231,8 @@
    * 19990320.8           - add request_rec.case_preserved_filename
    * 19990320.9           - renamed alloc.h to ap_alloc.h
    * 19990320.10          - add ap_is_rdirectory() and ap_stripprefix()
  + * 20011130.11          - Add a couple of fields, callback_data and
  + *                        filter_callback to the end of buff.h
    */
   
   #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */
  @@ -238,7 +240,7 @@
   #ifndef MODULE_MAGIC_NUMBER_MAJOR
   #define MODULE_MAGIC_NUMBER_MAJOR 19990320
   #endif
  -#define MODULE_MAGIC_NUMBER_MINOR 10                    /* 0...n */
  +#define MODULE_MAGIC_NUMBER_MINOR 11                    /* 0...n */
   
   /* Useful for testing for features. */
   #define AP_MODULE_MAGIC_AT_LEAST(major,minor)		\
  
  
  
  1.50      +4 -0      apache-1.3/src/include/buff.h
  
  Index: buff.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/buff.h,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- buff.h	2001/01/15 17:04:30	1.49
  +++ buff.h	2001/11/30 14:08:43	1.50
  @@ -129,6 +129,10 @@
       Sfio_t *sf_in;
       Sfio_t *sf_out;
   #endif
  +
  +    void *callback_data;
  +    void (*filter_callback)(BUFF *, const void *, int );
  +	
   };
   
   #ifdef B_SFIO
  
  
  
  1.102     +13 -0     apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- buff.c	2001/01/15 17:04:56	1.101
  +++ buff.c	2001/11/30 14:08:44	1.102
  @@ -356,6 +356,10 @@
   {
       int rv;
   
  +    if (fb->filter_callback != NULL) {
  +        fb->filter_callback(fb, buf, nbyte);
  +    }
  +   
   #if defined(WIN32) || defined(NETWARE)
       if (fb->flags & B_SOCKET) {
   	rv = sendwithtimeout(fb->fd, buf, nbyte, 0);
  @@ -438,6 +442,9 @@
   		       (size_t) SF_UNBOUND, 1, SF_WRITE);
   #endif
   
  +    fb->callback_data = NULL;
  +    fb->filter_callback = NULL;
  +
       return fb;
   }
   
  @@ -1077,6 +1084,12 @@
   static int writev_it_all(BUFF *fb, struct iovec *vec, int nvec)
   {
       int i, rv;
  +    
  +    if (fb->filter_callback != NULL) {
  +        for (i = 0; i < nvec; i++) {
  +            fb->filter_callback(fb, vec[i].iov_base, vec[i].iov_len);
  +        }
  +    }
   
       /* while it's nice an easy to build the vector and crud, it's painful
        * to deal with a partial writev()