]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Modify buff.h and buff.c to enable modules to intercept the
authorBill Stoddard <stoddard@apache.org>
Fri, 30 Nov 2001 14:08:44 +0000 (14:08 +0000)
committerBill Stoddard <stoddard@apache.org>
Fri, 30 Nov 2001 14:08:44 +0000 (14:08 +0000)
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 <kmallory@spidercache.com>
Reviewed by: Bill Stoddard

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@92260 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/include/ap_mmn.h
src/include/buff.h
src/main/buff.c

index 2eac0097cf322f2e1e66ebe063dbfdb1badf2123..1cb6daf3d1f99aba166a978e98aaf105fedc5a25 100644 (file)
@@ -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 <kmallory@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 <obo@bourse.ch>]
index 287304970e1d34992e79c3fa96989c84149f75a8..fd99387b72e971d14cb17eeccc3da763bedb2f3c 100644 (file)
  * 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" */
 #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)          \
index c4353dc3c7e9ae7fa07fbd56db09b9b58a913627..6a12b4e766c053e2c0d7e75897f7900c1240d2a5 100644 (file)
@@ -129,6 +129,10 @@ struct buff_struct {
     Sfio_t *sf_in;
     Sfio_t *sf_out;
 #endif
+
+    void *callback_data;
+    void (*filter_callback)(BUFF *, const void *, int );
+       
 };
 
 #ifdef B_SFIO
index b49ccc59a2b32979b8e4de4ac07278b75e8c9522..793570444802ffc4b3baf0a6ae072fa2c2c41984 100644 (file)
@@ -356,6 +356,10 @@ static ap_inline int buff_write(BUFF *fb, const void *buf, int nbyte)
 {
     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 @@ API_EXPORT(BUFF *) ap_bcreate(pool *p, int flags)
                       (size_t) SF_UNBOUND, 1, SF_WRITE);
 #endif
 
+    fb->callback_data = NULL;
+    fb->filter_callback = NULL;
+
     return fb;
 }
 
@@ -1077,6 +1084,12 @@ static int write_it_all(BUFF *fb, const void *buf, int nbyte)
 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()