--------------------- PatchSet 1425 Date: 2001/01/30 08:57:18 Author: rbcollins Branch: rbcollins_filters Tag: (none) Log: textreplace filter now a external configurable module Members: configure.in:1.1.1.3.8.11.2.1->1.1.1.3.8.11.2.2 src/Makefile.in:1.1.1.3.8.8.2.2->1.1.1.3.8.8.2.3 src/filters.c:1.1.2.1->1.1.2.2 src/protos.h:1.1.1.3.8.11.2.4->1.1.1.3.8.11.2.5 src/modules/Makefile.in:1.1->1.1.2.1 src/modules/textreplace/Makefile.in:1.1->1.1.2.1 src/modules/textreplace/textreplace.c:1.1->1.1.2.1 Index: squid/configure.in =================================================================== RCS file: /cvsroot/squid-sf//squid/configure.in,v retrieving revision 1.1.1.3.8.11.2.1 retrieving revision 1.1.1.3.8.11.2.2 diff -u -r1.1.1.3.8.11.2.1 -r1.1.1.3.8.11.2.2 --- squid/configure.in 30 Jan 2001 04:57:21 -0000 1.1.1.3.8.11.2.1 +++ squid/configure.in 30 Jan 2001 08:57:18 -0000 1.1.1.3.8.11.2.2 @@ -3,13 +3,13 @@ dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.1.1.3.8.11.2.1 2001/01/30 04:57:21 rbcollins Exp $ +dnl $Id: configure.in,v 1.1.1.3.8.11.2.2 2001/01/30 08:57:18 rbcollins Exp $ dnl dnl dnl AC_INIT(src/main.c) AC_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.1.1.3.8.11.2.1 $)dnl +AC_REVISION($Revision: 1.1.1.3.8.11.2.2 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AC_CONFIG_AUX_DIR(cfgaux) @@ -826,7 +826,7 @@ AC_SUBST(CONF_MODULES) CONF_MODULE_OBJS="modules/`echo $CONF_MODULES|sed -e's% %.a modules/%g'`.a" AC_SUBST(CONF_MODULE_OBJS) -COMF_MODULE_LIBS="`echo $CONF_MODULE_OBJS|sed -e's%module/%%g'`" +CONF_MODULE_LIBS="`echo $CONF_MODULE_OBJS|sed -e's%module/%%g'`" AC_SUBST(CONF_MODULE_LIBS) dnl Disable "unlinkd" code @@ -1845,6 +1845,15 @@ fi done +MOD_MAKEFILES="" +for module in `find $srcdir/src/modules -type d -print`; do + if test -f $module/Makefile.in; then + dir=`echo $module | sed -e "s|^$srcdir/||"` + MOD_MAKEFILES="$MOD_MAKEFILES ./$dir/Makefile" + fi +done + + AC_OUTPUT(\ ./makefile \ ./lib/Makefile \ @@ -1859,6 +1868,7 @@ $REPL_MAKEFILES \ ./src/auth/Makefile \ $AUTH_MAKEFILES \ + $MOD_MAKEFILES \ ./contrib/Makefile \ $SNMP_MAKEFILE \ ./icons/Makefile \ Index: squid/src/Makefile.in =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/Makefile.in,v retrieving revision 1.1.1.3.8.8.2.2 retrieving revision 1.1.1.3.8.8.2.3 diff -u -r1.1.1.3.8.8.2.2 -r1.1.1.3.8.8.2.3 --- squid/src/Makefile.in 30 Jan 2001 04:28:30 -0000 1.1.1.3.8.8.2.2 +++ squid/src/Makefile.in 30 Jan 2001 08:57:18 -0000 1.1.1.3.8.8.2.3 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.1.1.3.8.8.2.2 2001/01/30 04:28:30 rbcollins Exp $ +# $Id: Makefile.in,v 1.1.1.3.8.8.2.3 2001/01/30 08:57:18 rbcollins Exp $ # # Uncomment and customize the following to suit your needs: # @@ -18,7 +18,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ -SUBDIRS = fs repl auth +SUBDIRS = fs repl auth modules # Gotta love the DOS legacy # @@ -49,8 +49,8 @@ AUTH_OBJS = @AUTH_OBJS@ AUTH_MODULES = @AUTH_MODULES@ -#CONF_OBJS = -CONF_MODULES = textreplace +CONF_MODULE_OBJS = @CONF_MODULE_OBJS@ +CONF_MODULES = @CONF_MODULES@ CC = @CC@ MAKEDEPEND = @MAKEDEPEND@ INSTALL = @INSTALL@ @@ -216,8 +216,8 @@ $(SNMP_OBJS): ../snmplib/libsnmp.a $(top_srcdir)/include/cache_snmp.h -$(SQUID_EXE): $(OBJS) $(STORE_OBJS) $(REPL_OBJS) $(AUTH_OBJS) - $(CC) -o $@ $(LDFLAGS) $(OBJS) $(STORE_OBJS) $(REPL_OBJS) $(AUTH_OBJS) $(SQUID_LIBS) +$(SQUID_EXE): $(OBJS) $(STORE_OBJS) $(REPL_OBJS) $(AUTH_OBJS) $(CONF_MODULE_OBJS) + $(CC) -o $@ $(LDFLAGS) $(OBJS) $(STORE_OBJS) $(REPL_OBJS) $(AUTH_OBJS) $(CONF_MODULE_OBJS) $(SQUID_LIBS) globals.o: globals.c Makefile $(CC) -c globals.c $(CFLAGS) -I$(srcdir) $(DEFAULTS) @@ -321,6 +321,9 @@ conf_modules.o: conf_modules.c $(CC) -c conf_modules.c $(CFLAGS) -I$(srcdir) +$(CONF_MODULE_OBJS): + @sh -c "cd `dirname $@` && $(MAKE) $(MFLAGS) `basename $@`" + install-mkdirs: -@if test ! -d $(prefix); then \ echo "mkdir $(prefix)"; \ Index: squid/src/filters.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/filters.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/filters.c 30 Jan 2001 04:28:55 -0000 1.1.2.1 +++ squid/src/filters.c 30 Jan 2001 08:57:18 -0000 1.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: filters.c,v 1.1.2.1 2001/01/30 04:28:55 rbcollins Exp $ + * $Id: filters.c,v 1.1.2.2 2001/01/30 08:57:18 rbcollins Exp $ * * DEBUG: section 83 Content Processing Filters * AUTHOR: Robert Collins @@ -85,215 +85,3 @@ } return NULL; } - - - -/* the textreplace filter */ -typedef struct _onunloadcfg OnUnloadConfig; -typedef struct _onunloadstate OnUnloadState; -struct _onunloadstate { - OnUnloadConfig *config; - /* allow for searching across buffer breaks */ - /* not implemented just yet :] */ - char *pos; -}; -struct _onunloadcfg { - char *searchstring, *replace; -}; - - -static REMOVEFILTER clientFilterOnUnload_Remove; -static ADDFILTER clientFilterOnUnload_Add; -static FILTERMKSTATE clientFilterOnUnload_MakeState; -static FILTERPARSE clientFilterOnUnload_Parse; -static DATAFILTER clientFilterOnUnload; - - -MOD_INSTALL mod_install_textreplace; - - -void -clientFilterFreeConfig(void *data) { - OnUnloadConfig *config=data; - xfree(config->searchstring); - config->searchstring=NULL; - xfree(config->replace); - config->replace=NULL; - xfree(config); -} - -void -clientFilterOnUnload_AddInstance(FILTER_instance *instance) { - OnUnloadConfig *config; - instance->Add=clientFilterOnUnload_Add; - instance->MakeState=clientFilterOnUnload_MakeState; - instance->Parse =clientFilterOnUnload_Parse; - instance->data=xmalloc(sizeof(OnUnloadConfig)); - /* Set defaults, if sensible defaults exist */ - config=instance->data; - config->searchstring=NULL; - config->replace=NULL; -} - -void -clientFilterOnUnload_RemInstance(FILTER_instance *instance) { - instance->Add=NULL; - instance->MakeState=NULL; - clientFilterFreeConfig(instance->data); - instance->data=NULL; -} - -static void -clientFilterOnUnload_Add(dlink_list *filters, void *filter_config) { - FILTER_list *temp_filter; - temp_filter=xmalloc(sizeof(FILTER_list)); - temp_filter->filter=clientFilterOnUnload; - temp_filter->Remove=clientFilterOnUnload_Remove; - temp_filter->data=filter_config; - /* cbDataLock(http); ? */ - dlinkAddTail(temp_filter, &temp_filter->node, filters); -} - -static void * -clientFilterOnUnload_MakeState(void * data) { - OnUnloadState *state; - OnUnloadConfig *config=data; - if (!config) - return NULL; - /* it's up to the filter writer wether to refcount the config, - * or copy it. For now, to save learning cbdata, I copy it - */ - state=xmalloc(sizeof(OnUnloadState)); - state->config=xmalloc(sizeof(OnUnloadConfig)); - state->config->searchstring=xstrdup(config->searchstring); - state->config->replace=xstrdup(config->replace); - return state; -} - -static void -clientFilterOnUnload_Remove(FILTER_list *filters, dlink_list *filter_list, void *data) { - OnUnloadState *state=data; - dlinkDelete(&filters->node, filter_list); - xfree(filters); - clientFilterFreeConfig(state->config); - state->config=NULL; - xfree(state); -} - -static void -clientFilterOnUnload_Parse(void *data, const char *namestr, char *param_str) { - OnUnloadConfig *config=data; - if (strcasecmp(param_str, "replace") == 0) { - parse_eol(&config->replace); - } else if (strcasecmp(param_str, "search") == 0) { - parse_eol(&config->searchstring); - } else { - debug(33, 0) ("unrecognised parameter '%s' for filter %s\n", param_str,namestr); - } -} - -void -mod_install_textreplace(const char *namestr) { - /* Register as a potential client_side reply filter */ - filterRegisterModule(namestr,clientFilterOnUnload_AddInstance, - clientFilterOnUnload_RemInstance); -} - - -char * -strnchr(const char *str, char chr, size_t len) { - size_t pos=0; - while (posconfig; - char *chr, *searchstring=config->searchstring; - const char *startpos,*pos; - size_t replacelen=strlen(config->replace); - - /* this looks for browser DOM handlers of the type onunload="..." and - * removes them from the data passed to the client - * caveats and problems: - * 1. theres probably a set of library functions for matching patterns at arbitrary - * places in a datastream (ie handles buffer edge issues, optimum search patterns - * and the like. Well this is a proof of concept filter - live with it :-] - * 2. Some code may not quote the handler properly. I haven't tried to build - * a full blown parser here - see 1. - * 3. this will match patterns in jpegs etc as well at this point. It needs a - * acl or content type check in clientSendMoreData before adding the filter to the - * list. - * - * 4. I'm making use of the properties of the fixed search string to simplify - * the search. IT IS NOT GENERAL PURPOSE - - - * The compiled expression isn't cached. This _is_ a performance issue. - * !!! !!!!!!!! !!!!!!!!!! - */ - - temp_filter=filters->node.next->data; - - chr=searchstring; - pos=0; - startpos=buf; - - while (startpos) { - startpos=strnchr(startpos, *chr, len-(startpos-buf)); - - if (startpos) { - /* possibly present in this buffer */ - chr++; - pos=startpos+1; - while (pos) { - if (tolower(*pos)==tolower(*chr)) { - chr++; - pos++; - } - if (pos-buf>=len){ - /* end of data */ - temp_filter->filter(buf,len,filter_list, temp_filter, flags, temp_filter->data); - return; - } - if (*chr=='\0') { - /* end of search string - we've got a match */ - /* send the first set of data */ - if (startpos-buf) - temp_filter->filter(buf,startpos-buf,filter_list, temp_filter, flags, temp_filter->data); - /* send the filter set of data */ - temp_filter->filter(config->replace,replacelen,filter_list, temp_filter, flags, temp_filter->data); - /* and the rest */ - temp_filter->filter(startpos+replacelen,len-(startpos-buf)-replacelen,filter_list, temp_filter, flags,temp_filter->data); - return; - } - if(tolower(*pos)!=tolower(*chr)) { - /* reset the search criteria to after the corrent position */ - startpos=pos; - pos=NULL; - chr=searchstring; - } - } - } - else { - temp_filter->filter(buf,len,filter_list, temp_filter, flags, temp_filter->data); - return; - } - - } - temp_filter->filter(buf,len,filter_list, temp_filter, flags, temp_filter->data); - -} - - - Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.1.1.3.8.11.2.4 retrieving revision 1.1.1.3.8.11.2.5 diff -u -r1.1.1.3.8.11.2.4 -r1.1.1.3.8.11.2.5 --- squid/src/protos.h 30 Jan 2001 04:28:30 -0000 1.1.1.3.8.11.2.4 +++ squid/src/protos.h 30 Jan 2001 08:57:18 -0000 1.1.1.3.8.11.2.5 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.1.1.3.8.11.2.4 2001/01/30 04:28:30 rbcollins Exp $ + * $Id: protos.h,v 1.1.1.3.8.11.2.5 2001/01/30 08:57:18 rbcollins Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -1306,7 +1306,9 @@ extern void mod_compiled_install(void); /* modules.c */ extern void mod_register(const char * namestr, MOD_INSTALL *installfunc); +extern void modules_install(); /* filters.c */ extern FILTER_module *filterByName(const char *namestr); -FILTER_instance *filterInstanceByName(const char *namestr, filterConfig *cfg); +extern FILTER_instance *filterInstanceByName(const char *namestr, filterConfig *cfg); +extern void filterRegisterModule(const char *, ADDFILTERINSTANCE *, REMFILTERINSTANCE *); --- /dev/null Wed Feb 14 00:48:56 2007 +++ squid/src/modules/Makefile.in Wed Feb 14 00:49:28 2007 @@ -0,0 +1,36 @@ +# Makefile for modules in the Squid Object Cache server +# +# $Id$ +# + +SUBDIRS = @CONF_MODULES@ +OUTLIBS = @CONF_MODULE_LIBS@ + +all install: + @test -z "$(SUBDIRS)" || for dir in $(SUBDIRS); do \ + sh -c "cd $$dir && $(MAKE) $(MFLAGS) $@" || exit 1; \ + done; + +$(OUTLIBS): + @sh -c "cd `basename $@ .a` && $(MAKE) $(MFLAGS) ../$@" + +clean: + -rm -f *.a stamp + -for dir in *; do \ + if [ -f $$dir/Makefile ]; then \ + sh -c "cd $$dir && $(MAKE) $(MFLAGS) $@" || exit 1;\ + fi; \ + done + +distclean: + -rm -f *.a Makefile + -for dir in *; do \ + if [ -f $$dir/Makefile ]; then \ + sh -c "cd $$dir && $(MAKE) $(MFLAGS) distclean"; \ + fi; \ + done + +.DEFAULT: + @test -z "$(SUBDIRS)" || for dir in $(SUBDIRS); do \ + sh -c "cd $$dir && $(MAKE) $(MFLAGS) $@" || exit 1; \ + done --- /dev/null Wed Feb 14 00:48:56 2007 +++ squid/src/modules/textreplace/Makefile.in Wed Feb 14 00:49:28 2007 @@ -0,0 +1,70 @@ +# +# Makefile for the ntlm authentication scheme module for the Squid Object Cache server +# +# $Id: Makefile.in,v 1.1.2.1 2001/01/30 08:57:18 rbcollins Exp $ +# + +MODULE = textreplace + +#SUBDIRS = helpers + +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +CC = @CC@ +MAKEDEPEND = @MAKEDEPEND@ +AR_R = @AR_R@ +RANLIB = @RANLIB@ +AC_CFLAGS = @CFLAGS@ +SHELL = /bin/sh + +INCLUDE = -I../../../include -I$(top_srcdir)/include -I$(top_srcdir)/src/ +CFLAGS = $(AC_CFLAGS) $(INCLUDE) $(DEFINES) + +OUT = ../$(MODULE).a + +OBJS = \ + textreplace.o + + +all install: $(OUT) + @for dir in $(SUBDIRS); do \ + if [ -f $$dir/Makefile ]; then \ + sh -c "cd $$dir && $(MAKE) $@" || exit 1; \ + fi; \ + done; + +$(OUT): $(OBJS) + @rm -f ../stamp + $(AR_R) $(OUT) $(OBJS) + $(RANLIB) $(OUT) + +$(OBJS): $(top_srcdir)/include/version.h ../../../include/autoconf.h + +.c.o: + @rm -f ../stamp + $(CC) $(CFLAGS) -c $< + +clean: + -rm -rf *.o *pure_* core ../$(MODULE).a + -for dir in *; do \ + if [ -f $$dir/Makefile ]; then \ + sh -c "cd $$dir && $(MAKE) clean"; \ + fi; \ + done + +distclean: clean + -rm -f Makefile + -rm -f Makefile.bak + -rm -f tags + -for dir in *; do \ + if [ -f $$dir/Makefile ]; then \ + sh -c "cd $$dir && $(MAKE) distclean"; \ + fi; \ + done + +tags: + ctags *.[ch] $(top_srcdir)/src/*.[ch] $(top_srcdir)/include/*.h $(top_srcdir)/lib/*.[ch] + +depend: + $(MAKEDEPEND) $(INCLUDE) -fMakefile *.c --- /dev/null Wed Feb 14 00:48:56 2007 +++ squid/src/modules/textreplace/textreplace.c Wed Feb 14 00:49:28 2007 @@ -0,0 +1,246 @@ + +/* + * $Id: textreplace.c,v 1.1.2.1 2001/01/30 08:57:19 rbcollins Exp $ + * + * DEBUG: section 83 Content Processing Filters + * AUTHOR: Robert Collins + * + * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from the + * Internet community. Development is led by Duane Wessels of the + * National Laboratory for Applied Network Research and funded by the + * National Science Foundation. Squid is Copyrighted (C) 1998 by + * the Regents of the University of California. Please see the + * COPYRIGHT file for full details. Squid incorporates software + * developed and/or copyrighted by other sources. Please see the + * CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#include "squid.h" + +/* The textreplace filter */ +typedef struct _onunloadcfg OnUnloadConfig; +typedef struct _onunloadstate OnUnloadState; +struct _onunloadstate { + OnUnloadConfig *config; + /* allow for searching across buffer breaks */ + /* not implemented just yet :] */ + char *pos; +}; +struct _onunloadcfg { + char *searchstring, *replace; +}; + + +static REMOVEFILTER clientFilterOnUnload_Remove; +static ADDFILTER clientFilterOnUnload_Add; +static FILTERMKSTATE clientFilterOnUnload_MakeState; +static FILTERPARSE clientFilterOnUnload_Parse; +static DATAFILTER clientFilterOnUnload; + + +MOD_INSTALL mod_install_textreplace; + + +void +clientFilterFreeConfig(void *data) { + OnUnloadConfig *config=data; + xfree(config->searchstring); + config->searchstring=NULL; + xfree(config->replace); + config->replace=NULL; + xfree(config); +} + +void +clientFilterOnUnload_AddInstance(FILTER_instance *instance) { + OnUnloadConfig *config; + instance->Add=clientFilterOnUnload_Add; + instance->MakeState=clientFilterOnUnload_MakeState; + instance->Parse =clientFilterOnUnload_Parse; + instance->data=xmalloc(sizeof(OnUnloadConfig)); + /* Set defaults, if sensible defaults exist */ + config=instance->data; + config->searchstring=NULL; + config->replace=NULL; +} + +void +clientFilterOnUnload_RemInstance(FILTER_instance *instance) { + instance->Add=NULL; + instance->MakeState=NULL; + clientFilterFreeConfig(instance->data); + instance->data=NULL; +} + +static void +clientFilterOnUnload_Add(dlink_list *filters, void *filter_config) { + FILTER_list *temp_filter; + temp_filter=xmalloc(sizeof(FILTER_list)); + temp_filter->filter=clientFilterOnUnload; + temp_filter->Remove=clientFilterOnUnload_Remove; + temp_filter->data=filter_config; + /* cbDataLock(http); ? */ + dlinkAddTail(temp_filter, &temp_filter->node, filters); +} + +static void * +clientFilterOnUnload_MakeState(void * data) { + OnUnloadState *state; + OnUnloadConfig *config=data; + if (!config) + return NULL; + /* it's up to the filter writer wether to refcount the config, + * or copy it. For now, to save learning cbdata, I copy it + */ + state=xmalloc(sizeof(OnUnloadState)); + state->config=xmalloc(sizeof(OnUnloadConfig)); + state->config->searchstring=xstrdup(config->searchstring); + state->config->replace=xstrdup(config->replace); + return state; +} + +static void +clientFilterOnUnload_Remove(FILTER_list *filters, dlink_list *filter_list, void *data) { + OnUnloadState *state=data; + dlinkDelete(&filters->node, filter_list); + xfree(filters); + clientFilterFreeConfig(state->config); + state->config=NULL; + xfree(state); +} + +static void +clientFilterOnUnload_Parse(void *data, const char *namestr, char *param_str) { + OnUnloadConfig *config=data; + if (strcasecmp(param_str, "replace") == 0) { + parse_eol(&config->replace); + } else if (strcasecmp(param_str, "search") == 0) { + parse_eol(&config->searchstring); + } else { + debug(33, 0) ("unrecognised parameter '%s' for filter %s\n", param_str,namestr); + } +} + +void +mod_install_textreplace(const char *namestr) { + /* Register as a potential client_side reply filter */ + filterRegisterModule(namestr,clientFilterOnUnload_AddInstance, + clientFilterOnUnload_RemInstance); +} + + +char * +strnchr(const char *str, char chr, size_t len) { + size_t pos=0; + while (posconfig; + char *chr, *searchstring=config->searchstring; + const char *startpos,*pos; + size_t replacelen=strlen(config->replace); + + /* this looks for browser DOM handlers of the type onunload="..." and + * removes them from the data passed to the client + * caveats and problems: + * 1. theres probably a set of library functions for matching patterns at arbitrary + * places in a datastream (ie handles buffer edge issues, optimum search patterns + * and the like. Well this is a proof of concept filter - live with it :-] + * 2. Some code may not quote the handler properly. I haven't tried to build + * a full blown parser here - see 1. + * 3. this will match patterns in jpegs etc as well at this point. It needs a + * acl or content type check in clientSendMoreData before adding the filter to the + * list. + * + * 4. I'm making use of the properties of the fixed search string to simplify + * the search. IT IS NOT GENERAL PURPOSE + + + * The compiled expression isn't cached. This _is_ a performance issue. + * !!! !!!!!!!! !!!!!!!!!! + */ + + temp_filter=filters->node.next->data; + + chr=searchstring; + pos=0; + startpos=buf; + + while (startpos) { + startpos=strnchr(startpos, *chr, len-(startpos-buf)); + + if (startpos) { + /* possibly present in this buffer */ + chr++; + pos=startpos+1; + while (pos) { + if (tolower(*pos)==tolower(*chr)) { + chr++; + pos++; + } + if (pos-buf>=len){ + /* end of data */ + temp_filter->filter(buf,len,filter_list, temp_filter, flags, temp_filter->data); + return; + } + if (*chr=='\0') { + /* end of search string - we've got a match */ + /* send the first set of data */ + if (startpos-buf) + temp_filter->filter(buf,startpos-buf,filter_list, temp_filter, flags, temp_filter->data); + /* send the filter set of data */ + temp_filter->filter(config->replace,replacelen,filter_list, temp_filter, flags, temp_filter->data); + /* and the rest */ + temp_filter->filter(startpos+replacelen,len-(startpos-buf)-replacelen,filter_list, temp_filter, flags,temp_filter->data); + return; + } + if(tolower(*pos)!=tolower(*chr)) { + /* reset the search criteria to after the corrent position */ + startpos=pos; + pos=NULL; + chr=searchstring; + } + } + } + else { + temp_filter->filter(buf,len,filter_list, temp_filter, flags, temp_filter->data); + return; + } + + } + temp_filter->filter(buf,len,filter_list, temp_filter, flags, temp_filter->data); + +} + + +