httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tess Flynn" <tfl...@mqsoftware.com>
Subject Input Filter Infinite Loop
Date Mon, 27 Nov 2006 16:36:59 GMT
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

Mime
View raw message