Just checking that this did not get lost on the way. Anyone care to
give me a hint?


On Thu, Jul 31, 2003 at 10:17:06PM +0200, Martin Wickman wrote:
> Hello
> 
> According to docs[1], $r->rflush() should create a new brigade with
> data. It does not.
>
> It seems the docs and/or my understanding of this is in error.
> 
>
> This is with:
>   Apache/2.0.47 (Debian GNU/Linux) mod_perl/1.99_07-dev Perl/v5.8.0
> 
> And I am using the streaming filter api.
> 
> [1] 
> http://perl.apache.org/docs/2.0/user/handlers/filters.html#Multiple_Invocations_of_Filter_Handlers
> 
> 
> Long version below:
> ------------------
> 
> I have tried to make my outputfilter clever enough so it can handle
> being called several times, with tags potentially split between
> several brigades.
> 
> Now I would like to test this somehow (ie, force mod_perl to call my
> filter several times). I tried using $r->rflush(), but cannot get it
> to work as I and the docs would expect.
> 
> I tried creating a ResponseHandler which explicitly breaks some silly
> html data into brigades:
> 
>   sub handler {
>     my $r = shift;
>     $r->content_type('text/html');
>     $r->log_error ("Cutting");
>     $r->print ("<html><head> title </head>"); $r->rflush();
>     $r->print ("<bo");                        $r->rflush();
>     $r->print ("dy> body ");                  $r->rflush();
>     $r->print ("</html>");
>     $r->log_error ("Cutting: end");
>     return Apache::OK;
>   }
> 
> And then a simple 'DebugFilter' output filter which just prints each chunk:
> 
>   sub handler : FilterRequestHandler {
>     my $f = shift;
>     $f->r->log_error ("DebugFilter called");
>     $f->print ("DebugFilter called\n");
>     while ($f->read(my $buffer, 1024)) {
>       $f->print("CHUNK:$buffer:CHUNK\n");
>     }
>     return Apache::OK;
>   }
> 
> And httpd.conf
> 
>   <Location /test/>
>     PerlResponseHandler MyApache::Cutter
>     PerlOutputFilterHandler MyApache::DebugFilter
>   </Location>
> 
> When I run this, I see that DebugFilter gets called 4 times (3
> rflush's + 1 eos or something). But the strange thing is that only the
> _last_ call contains data. That data is _everything_ nicely
> concatenated and not splitted as I would guess.
> 
> Here is actual output:
> 
>  $ wget --quiet -O - http://localhost/test/
>    DebugFilter called
>    DebugFilter called
>    DebugFilter called
>    DebugFilter called
>    CHUNK:<html><head> title </head><body> body </html>:CHUNK
> 
> And the error_log:
> 
>   [Thu Jul 31 21:52:42 2003] [error] Cutting: start
>   [Thu Jul 31 21:52:42 2003] [error] DebugFilter called
>   [Thu Jul 31 21:52:42 2003] [error] DebugFilter called
>   [Thu Jul 31 21:52:42 2003] [error] DebugFilter called
>   [Thu Jul 31 21:52:42 2003] [error] Cutting: end
>   [Thu Jul 31 21:52:42 2003] [error] DebugFilter called

Reply via email to