I'm new to writing modules, but this is just baffling to me. I'm trying to write an input filter
to access POST data from an incoming request. I don't need to modify the data in any way,
just trap it and pass the contents to the next filter. The problem is, I only seem to trap
one character from the brigade, and then I drop into an infinite loop. My guess this is at
the server level, since it reenters my function over and over.
Here's the code I have thus far:
static int infilter(ap_filter_t* f, apr_bucket_brigade* bb,
ap_input_mode_t mode, apr_read_type_e block,
apr_off_t readbytes) {
apr_size_t bucket_len = 102400; /* some size, I'll config it later. */
char* bucket_text = apr_palloc(f->r->pool, bucket_len);
while(ap_get_brigade(f->next, bb, AP_MODE_READBYTES, APR_BLOCK_READ, readbytes) == APR_SUCCESS){
apr_brigade_flatten(bb, bucket_text, &bucket_len);
apr_brigade_cleanup(bb);
/* Now do something with the text. */
}
return APR_SUCCESS;
}
What am I doing wrong?
-Tess
|