cvs commit: modperl-2.0 Changes

2003-01-15 Thread stas
stas2003/01/15 18:38:09

  Modified:.Changes
  Log:
  log the recent changes
  
  Revision  ChangesPath
  1.101 +14 -2 modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- Changes   14 Jan 2003 06:42:44 -  1.100
  +++ Changes   16 Jan 2003 02:38:09 -  1.101
  @@ -10,9 +10,21 @@
   
   =item 1.99_09-dev
   
  -prevent a segfault when push_handlers are used to push a handler into
  -the currently phase and switching the handler (perl-script/modperl)
  +input stream filtering support was added + tests (plus renaming filter
  +tests so we can know from the test name what kind of filter is tested)
   [Stas]
  +
  +Add proper support for mis-behaved feeding filters that send more than
  +one EOS bucket in streaming filters + test. [Stas]
  +
  +implement a more robust autogenerated client .t test in
  +Apache::TestConfigPerl. Before this fix if the server side returned
  +500, the test would get skipped, not good. Now it will die a horrible
  +death. [Stas]
  +
  +prevent a segfault when push_handlers are used to push a handler into
  +the currently phase and switching the handler (perl-script/modperl) +
  +tests [Stas]
   
   Add $filter-seen_eos to the streaming filter api to know when eos has
   been seen, so special signatures can be passed and any data stored in
  
  
  



cvs commit: modperl-2.0/t/filter/TestFilter in_str_consume.pm

2003-01-15 Thread stas
stas2003/01/15 21:15:18

  Added:   t/filter in_str_consume.t
   t/filter/TestFilter in_str_consume.pm
  Log:
  add a faulty filter test, but keep the fault disabled for now
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/filter/in_str_consume.t
  
  Index: in_str_consume.t
  ===
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest;
  
  plan tests = 1;
  
  my $location = '/TestFilter::in_str_consume';
  
  # send a message bigger than 8k, so to make sure that the input filter
  # will get more than one bucket brigade with data.
  my $data = A 22 chars long string x 500; # about 11k
  my $received = POST_BODY $location, content = $data;
  my $expected = read just the first 1024b from the first brigade;
  
  ok t_cmp($expected, $received, input stream filter partial consume)
  
  
  
  1.1  modperl-2.0/t/filter/TestFilter/in_str_consume.pm
  
  Index: in_str_consume.pm
  ===
  package TestFilter::in_str_consume;
  
  # this test verifies that streaming filters framework handles
  # gracefully the case when a filter doesn't print anything at all to
  # the caller. I figure it's absolutely doesn't matter if the incoming
  # bb from the upstream is consumed or not. What matter is that the
  # filter sends something downstream (an empty bb will do).
  #
  # e.g. a filter that cleans up the incoming stream (extra spaces?)
  # might reduce the whole bb into nothing (e.g. if it was made of only
  # white spaces) then it should send  down.
  #
  # another problem with not reading in the while() loop, is that the
  # eos bucket won't be detected by the streaming framework and
  # consequently won't be sent downstream, probably breaking other
  # filters who rely on receiving the EOS bucket.
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Filter ();
  
  use Apache::Const -compile = qw(OK M_POST);
  
  sub handler {
  my($filter, $bb, $mode, $block, $readbytes) = @_;
  
  my $ctx = $filter-ctx;
  
  unless ($ctx) {
  # read a bit from the first brigade and leave the second
  # brigade completely unconsumed. we assume that there are two
  # brigades because the core input filter will split data in
  # 8kb chunks per brigade and we have sent 11k of data (1st bb:
  # 8kb, 2nd bb: ~3kb)
  my $len = $filter-read($mode, $block, $readbytes, my $buffer, 1024);
  warn FILTER READ: $len bytes\n;
  $filter-print(read just the first 1024b from the first brigade);
  
  $filter-ctx(1);
  }
  else {
  unless ($filter-seen_eos) {
  # XXX: comment out the next line to reproduce the segfault
  $filter-print();
  }
  }
  
  return Apache::OK;
  }
  
  sub response {
  my $r = shift;
  
  $r-content_type('text/plain');
  
  if ($r-method_number == Apache::M_POST) {
  my $data = ModPerl::Test::read_post($r);
  #warn HANDLER READ: $data\n;
  $r-print($data);
  }
  
  return Apache::OK;
  }
  1;
  __DATA__
  SetHandler modperl
  PerlResponseHandler TestFilter::in_str_consume::response