httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Bertola <d...@jupiterhosting.com>
Subject Re: splitting a string...
Date Sun, 31 Dec 2006 20:18:17 GMT
Joachim Zobel wrote:
> Hi.
>
> One recommendation beforehand: If you can live with the memory
> footprint, use mod_perl. It gives you full access to the apache API and
> it is much easier to handle. 
>   

Thanks for the response.  I considered mod_perl, but we're trying to
keep this very light weight.

> If str was \0 terminated, you would not need a length. In the above
> case, you better move the bucket you just read.
>   

How can I ensure it's null terminated?

> You need to punch a \0 into str, the you can use it as head. 
>   

Yes, I worked this out, but was getting a lot of segfaults.  I'm now doing:


          tail = position + strlen(search_tag);

          while ( (str + i) < ( position + strlen(search_tag) ) )
            {
              ap_fputc(f->next, ctx->bb, str[i++]);
            }

          ap_fputs(f->next, ctx->bb, "\n");
          ap_fputs(f->next, ctx->bb, insert_line);
          ap_fputs(f->next, ctx->bb, tail);

This prints everything up to my head tag, then my required warning meta
tag is inserted, then everything after my head tag.

The problem is that my short html test page works fine, but my short php
test page has garbage at the end of it.  I believe this is left over in
the bucket brigade.  Any clues?

>         
> You also need to handle the case that <head> is broken into 2 parts in 2
> buckets.
>   

OK, I'll look at that, too. 

Thanks,
--
Drew

Mime
View raw message