Extracted from httpd-2.x's util_filter.h:

053     /** The filter should return at most one line of CRLF data.
054      *  (If a potential line is too long or no CRLF is found, the 
055      *   filter may return partial data).
056      */
057     AP_MODE_GETLINE,


What that means is: at this point in the current getline loop in 
Apache/Qpsmtpd.pm :

    while (1) {
        my $rc = $c->input_filters->get_brigade($bb,
                                Apache2::Const::MODE_GETLINE);

$rc can be 0 (APR::Const::SUCCESS) with the brigade $bb containing
an incomplete line (ie. no "\n" char at the end).

The loop currently being used by the ASF is at

http://svn.apache.org/repos/asf/infrastructure/qpsmtpd/lib/Apache/Qpsmtpd.pm

FWIW, here's a simpler version using $bb->flatten instead of the inner
loop. (I'm also not sure why APR::Const::EOF shouldn't be treated as an 
exception):

==================================================

   my $data = "";

   while (1) {
        my $rc = $c->input_filters->get_brigade($bb,
                                Apache2::Const::MODE_GETLINE);

        die APR::Error::strerror($rc) unless $rc == APR::Const::SUCCESS;
        $bb->flatten(my $newdata); # $newdata WILL be defined by flatten()
        $bb->cleanup;
        $data .= $newdata;
        last if substr($newdata, length($newdata) - 1) eq "\012";
   }

   return $data;

==================================================


I hope this helps.

-- 
Joe Schaefer

Reply via email to