~ubuntu-branches/ubuntu/edgy/libapache2-mod-perl2/edgy

« back to all changes in this revision

Viewing changes to t/filter/TestFilter/in_str_declined_read.pm

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2006-03-24 02:48:44 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060324024844-73oxqkcj2jmlmh2t
Tags: 2.0.2-2build1
Fake sync to bring in new upstream bugfixes, UVF exception by mdz.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package TestFilter::in_str_declined_read;
 
2
 
 
3
use strict;
 
4
use warnings FATAL => 'all';
 
5
 
 
6
use Apache::Test;
 
7
use Apache::TestUtil;
 
8
 
 
9
use Apache2::RequestRec ();
 
10
use Apache2::RequestIO ();
 
11
 
 
12
use Apache2::Filter ();
 
13
 
 
14
use TestCommon::Utils ();
 
15
 
 
16
use Apache2::Const -compile => qw(OK DECLINED M_POST);
 
17
 
 
18
# a filter must not return DECLINED after calling $r->read, since the
 
19
# latter already fetches the bucket brigade in which case it's up to
 
20
# the user to complete reading it and send it out
 
21
# thefore this filter must fail
 
22
sub handler {
 
23
      my $filter = shift;
 
24
 
 
25
      # this causes a fetch of bb
 
26
      $filter->read(my $buffer, 10);
 
27
 
 
28
      return Apache2::Const::DECLINED;
 
29
}
 
30
 
 
31
sub response {
 
32
    my $r = shift;
 
33
 
 
34
    plan $r, tests => 1;
 
35
 
 
36
    $r->content_type('text/plain');
 
37
 
 
38
    if ($r->method_number == Apache2::Const::M_POST) {
 
39
        # this should fail, because of the failing filter
 
40
        eval { TestCommon::Utils::read_post($r) };
 
41
        ok $@;
 
42
    }
 
43
 
 
44
    Apache2::Const::OK;
 
45
}
 
46
1;
 
47
__DATA__
 
48
SetHandler modperl
 
49
PerlModule          TestFilter::in_str_declined_read
 
50
PerlResponseHandler TestFilter::in_str_declined_read::response
 
51