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
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>]
* 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) \
Sfio_t *sf_in;
Sfio_t *sf_out;
#endif
+
+ void *callback_data;
+ void (*filter_callback)(BUFF *, const void *, int );
+
};
#ifdef B_SFIO
{
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);
(size_t) SF_UNBOUND, 1, SF_WRITE);
#endif
+ fb->callback_data = NULL;
+ fb->filter_callback = NULL;
+
return fb;
}
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()