Robert Sanderson
azaroth at liverpool.ac.uk
Mon Jun 30 14:14:45 EST 2003
On Fri, 27 Jun 2003, Gregory (Grisha) Trubetskoy wrote: > On Thu, 26 Jun 2003, Robert Sanderson wrote: > > However, the connection object is a little too high level ... are there > > plans for implementing a lower level 'socket' like interface, rather than > > a blocking line or character reader? The mod_perl module has this sort of > > interface for example (AFAICT) > > For example, I need to be able to consume all of the data currently > > waiting into one chunk to process ... which may or may not end in a > I'm curious what mod_perl folks are doing, I haven't looked at it. I'm by no means an expert, in fact I've only just started looking at the connection handling stuff in Apache, but: http://perl.apache.org/docs/2.0/api/Apache/Filter.html#Streaming_Filter_API Read $f->read(my $buffer, $read_len); Reads at most $read_len characters into $buffer. It returns a true value as long as it had something to read, and a false value otherwise. > Unless I'm mising something, the only way you can deal with this kind of > data is read a character at a time. > (Or non-blocking IO, but off the top of my head I don't even know if > Apache supports it) There's a flag: APR_NONBLOCK_READ that can be passed to apr_bucket_read() Have a look at: http://www-106.ibm.com/developerworks/linux/library/l-apache/ for example (Which uses mod_python as an example :) ) Rob -- ,'/:. Rob Sanderson (azaroth at liverpool.ac.uk) ,'-/::::. http://www.o-r-g.org/~azaroth/ ,'--/::(@)::. Special Collections and Archives, extension 3142 ,'---/::::::::::. Nebmedes: telnet: nebmedes.o-r-g.org 7777 ____/:::::::::::::. WWW: http://nebmedes.o-r-g.org:8000/ I L L U M I N A T I
|