In an apache handler, we read request data using ap_get_client_block,
which can be used as a drop-in replacement for read or fread in
libraries that expect such functions as callbacks.
A more complex partial equivalent can be used in a filter - eg with
ap_get_brigade in an input filter. But it is limited to a single call
to a filter function that may be called multiple times.
So it can only be used as a callback with the aid of a hack, such as
reading all the data into memory (and there is no apr_realloc) or to
a tmpfile. I can't see any really satisfactory fix for this.
The kind of thing I'm doing is exemplified by mod_xml. In the main handler
I can do things like (illustrative pseudo-code):
parser->read_callback = ap_get_client_block ;
parser->run() ;
But I'm having trouble trying to do the same in a filter, particularly
an output filter where I most often want it!
Any suggestions?
--
Nick Kew
Available for contract work - Programming, Unix, Networking, Markup, etc.