httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Bertola <>
Subject strmatch spanning buckets
Date Sat, 06 Jan 2007 23:30:26 GMT
Hi again,

I am having some good success with my filter module, but need to take it
to completion.

The filter will look for a specific string and replace it with a new
string, or insert the new string either before or after the search
string.  This all works for the case that the search string doesn't span
two buckets.  (Not yet ready to deal w/ spanning brigades.)

Currently, I'm looping through the buckets looking for matches.  If I
find one, I split the string, insert the new string (handling insert
before | insert after | replace, as required), look for more matches,
and move on to the next bucket when there are no more full matches.

Now comes the case of a match split across the tail end of my current
bucket and the head end of the next bucket.  I imagine this is something
I should consider. 

If so, what's the most efficient strategy for getting this right?

My guess is something like this:

- before grabbing the next bucket, grab n = (strlen(match_string) - 1)
characters off the tail of the current bucket.  If their are fewer than
n characters between the last match and the tail end, grab only what's left.

- append this to the head of the next bucket.

- start searching.

Is this possible (can I concat two buckets)?  Do I risk overfilling a


View raw message