Stas Bekman wrote:
> Tatsuhiko Miyagawa wrote:
> 
>> At Thu, 04 Jul 2002 20:07:12 +0900,
>> Tatsuhiko Miyagawa wrote:
>>  
>>
>>> I mean I don't use perl-script or modperl for content generation. just
>>> serves  plain .html file with default-handler.
>>
>>
>>
>> OK. I tried
>>
>> <Location /hello>
>> SetHandler modperl
>> PerlResponseHandler Slasher::Hello
>> PerlOutputFilterHandler Slasher::HTMLTemplate
>> </Location>
>>
>> and then it worked!
>>
>> okay, current TestFilter::lc test is applied to static file, thus
>> here's a patch to reproduce the failure:
>>
>> (does it never get flushed? if I put die() after last print(), the
>> message gets out before "OK" annoying error messages)
> 
> 
> Good observation. I can reproduce this problem with non-mod_perl 
> handler. Actually I've continued building on top of the reverse test. 
> For some reason I like it :)
> 
> When a file is sent the EOS bucket arrives as well. And after the EOS 
> bucket went through the filter shouldn't send anything at all. If the 
> filter wants to add something it must remove the EOS bucket, send 
> whatever it needs to send and then re-insert the EOS bucket. And in the 
> stream mode this should be done transparently to the filter.
> 
> As a temp workaround to get you going you can use this patch, but I 
> think it's a bad hack. I'll try to come up with something better.

here is the proper patch. This patch makes the filter remember that it 
saw an EOS bucket, but it actually uses this information only at the end 
of modperl_run_filter so a stream filter gets a chance to send more data 
after eos was seen.

Index: src/modules/perl/modperl_types.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_types.h,v
retrieving revision 1.60
diff -u -r1.60 modperl_types.h
--- src/modules/perl/modperl_types.h    29 Jun 2002 20:38:33 -0000      1.60
+++ src/modules/perl/modperl_types.h    5 Jul 2002 15:09:12 -0000
@@ -182,6 +182,7 @@
  } modperl_filter_mode_e;

  typedef struct {
+    int seen_eos;
      int eos;
      int flush;
      ap_filter_t *f;

Index: src/modules/perl/modperl_filter.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
retrieving revision 1.36
diff -u -r1.36 modperl_filter.c
--- src/modules/perl/modperl_filter.c   29 Jun 2002 20:38:33 -0000      1.36
+++ src/modules/perl/modperl_filter.c   5 Jul 2002 15:03:08 -0000
@@ -156,6 +156,10 @@
      MP_TRACE_f(MP_FUNC, "%s returned %d\n", handler->name, status);

      if (filter->mode == MP_OUTPUT_FILTER_MODE) {
+        if (filter->seen_eos) {
+            filter->eos = 1;
+            filter->seen_eos = 0;
+        }
          modperl_output_filter_flush(filter);
      }

@@ -211,7 +215,7 @@
          return 1;
      }
      else if (MP_FILTER_IS_EOS(filter)) {
-        filter->eos = 1;
+        filter->seen_eos = 1;
          return 1;
      }
      else if (filter->bucket != MP_FILTER_SENTINEL(filter)) {
@@ -279,7 +283,7 @@

          if (MP_FILTER_IS_EOS(filter)) {
              MP_TRACE_f(MP_FUNC, "received EOS bucket\n");
-            filter->eos = 1;
+            filter->seen_eos = 1;
              break;
          }
          else if (MP_FILTER_IS_FLUSH(filter)) {


-- 


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to