Re: New to module development

2007-03-14 Thread Drew Bertola
Souramita Sen wrote: > > > While installing Fedora core I might have missed to install the following > rpms. > So from rpmfimd.net i have installed httpd-devel, apr-devel and > apr-util-devel as mentioned by Joe and Drew. Side note: use "yum" on fedora. It makes life much easier. It will pul

optimization time...

2007-01-27 Thread Drew Bertola
Hi everyone, My output filter module is finished and seems to be running along nicely in production. I have a couple areas where I thought it could be optimized, but I need some input from the list. First, the module reads through the content looking for matches to a configured string (literal,

Re: Meaning of len returned by apr_bucket_read()...

2007-01-19 Thread Drew Bertola
Giuliano Gavazzi wrote: >> >> apr_bucket_read(b, &str, &len, APR_NONBLOCK_READ); >> >> and follow that with: >> >> fprintf(stderr, "strlen(str): %d, len: %d\n", strlen(str), len); >> >> I see that strlen(str) and len are not always the same. Why? > > if the data you read can contain nulls I wo

Meaning of len returned by apr_bucket_read()...

2007-01-19 Thread Drew Bertola
Hello, When I run: apr_bucket_read(b, &str, &len, APR_NONBLOCK_READ); and follow that with: fprintf(stderr, "strlen(str): %d, len: %d\n", strlen(str), len); I see that strlen(str) and len are not always the same. Why? I know what the docs say: /** * read the data from the bucket * @p

Re: Setting up On/Off directive for output filter...

2007-01-13 Thread Drew Bertola
Drew Bertola wrote: > Hi, > > I'm a little bit puzzled about the right way to use AP_INIT_FLAG for per > server directives. Does anyone have a good example (snippet or link)? > Nevermind. Found a good one here: http://buecher.lingoworld.de/apache2/mod_daytime_en.html M

Setting up On/Off directive for output filter...

2007-01-13 Thread Drew Bertola
Hi, I'm a little bit puzzled about the right way to use AP_INIT_FLAG for per server directives. Does anyone have a good example (snippet or link)? Thanks, -- Drew

strmatch spanning buckets

2007-01-06 Thread Drew Bertola
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 doe

Re: apr_bucket_split question...

2007-01-06 Thread Drew Bertola
Joachim Zobel wrote: > Am Freitag, den 05.01.2007, 14:06 -0800 schrieb Drew Bertola: > >> My impression is that b is now the head piece (part before the split) >> and APR_BUCKET_NEXT(b) would return the tail piece. Correct? >> > > Just try. > I was t

apr_bucket_split question...

2007-01-05 Thread Drew Bertola
Hi, If I split a bucket using: apr_bucket_split(b, offset) what exactly happens to the two pieces? My impression is that b is now the head piece (part before the split) and APR_BUCKET_NEXT(b) would return the tail piece. Correct? Also, how can I determine the length of the data held by th

problem getting per server config to work...

2007-01-04 Thread Drew Bertola
Hi again, I'm finishing off my first module, but have some trouble with per server config. I have a simple virtualhost stanza with one added line that's causing a segfault when I run httpd -t. The virtualhost looks like this (a configtest runs fine with the last line commented out): Se

help with filter example: null_filter...

2007-01-03 Thread Drew Bertola
Hey everyone, I'm trying to create a demonstration filter that does nothing but pass buckets to the next filter. I'll extend this later to include reading configuration data, and other standard tasks. Right now, it's not working and I could use some expert help. Since this will be a demonstrati

Re: splitting a string...

2007-01-02 Thread Drew Bertola
Joachim Zobel wrote: > Am Dienstag, den 02.01.2007, 01:14 -0800 schrieb Drew Bertola: > >> line 91 looks like this: >> >> apr_bucket_read(e, &str, &len, APR_NONBLOCK_READ); >> >> Also, it only happens if I use >> >>

Re: splitting a string...

2007-01-02 Thread Drew Bertola
Joe Lewis wrote: > Make SURE you are not using things like strcasestr - it is not > platform independent (requires GNU source definitions). Besides, you > may want to change that to a series of apr_strmatch_precompile and > apr_strmatch commands to do the searching - those take an additional > par

Re: splitting a string...

2007-01-02 Thread Drew Bertola
Joachim Zobel wrote: > Am Montag, den 01.01.2007, 06:18 -0800 schrieb Drew Bertola: > >> This generates segfaults when processing php and doesn't help with my >> problem. Is the problem due to filter order? >> > > To find out more about the segf's

Re: splitting a string...

2007-01-01 Thread Drew Bertola
Joachim Zobel wrote: > Am Montag, den 01.01.2007, 01:48 -0800 schrieb Drew Bertola: > >> APR_BUCKET_REMOVE(e); >> APR_BRIGADE_INSERT_TAIL(ctx->bb, e); >> This generates segfaults when processing php and doesn't help with my problem. Is

Re: splitting a string...

2007-01-01 Thread Drew Bertola
Thanks for all the ideas. They've come in very handy. I haven't done extensive testing, and the module is still too stupid to read configuration data, but I've gotten much farther. Right now, static html works fine, but php pages (need both per customer requirements) spit out too much at the ta

splitting a string...

2006-12-30 Thread Drew Bertola
Happy New Year, everyone. I need some quick help with handling my content in an output filter. I'd like to know how I can get the portion of client content before the tag (if it exists), and the portion after it. That way, I can insert something just after the tag (adult content warnings, etc)

Output Filter help...

2006-12-29 Thread Drew Bertola
Hi, I'm very new to writing apache modules, so I need some help. I'm trying to write a module that will insert some text into the contents of every page. On apache 1.3, we could use mod_layout, but this seems very broken and unsupported on apache 2.x, so... I've been digging around as much d