develooper Front page | perl.cvs.modperl.modules | Postings from January 2005

[svn:modperl-modules] rev 96 - in Apache-DebugFilter/trunk: . t/response/TestDebugFilter

From:
stas
Date:
January 2, 2005 15:17
Subject:
[svn:modperl-modules] rev 96 - in Apache-DebugFilter/trunk: . t/response/TestDebugFilter
Message ID:
20050102231718.30373.qmail@x1.develooper.com
Author: stas
Date: Sun Jan  2 15:17:18 2005
New Revision: 96

Modified:
   Apache-DebugFilter/trunk/Changes
   Apache-DebugFilter/trunk/DebugFilter.pm
   Apache-DebugFilter/trunk/Makefile.PL
   Apache-DebugFilter/trunk/t/response/TestDebugFilter/bb_dump.pm
   Apache-DebugFilter/trunk/t/response/TestDebugFilter/snoop.pm
Log:
- bring the module and tests up-to-date with mp-1.99_15
- add release timestamp


Modified: Apache-DebugFilter/trunk/Changes
==============================================================================
--- Apache-DebugFilter/trunk/Changes	(original)
+++ Apache-DebugFilter/trunk/Changes	Sun Jan  2 15:17:18 2005
@@ -1,6 +1,8 @@
 Revision history for Perl extension Apache::DebugFilter.
 
-0.01 
+0.01 - Sun Jan  2 18:15:20 EST 2005
+
+- bring the module and tests up-to-date with mp-1.99_15
 
 - added the snoop filters
 

Modified: Apache-DebugFilter/trunk/DebugFilter.pm
==============================================================================
--- Apache-DebugFilter/trunk/DebugFilter.pm	(original)
+++ Apache-DebugFilter/trunk/DebugFilter.pm	Sun Jan  2 15:17:18 2005
@@ -1,6 +1,5 @@
 package Apache::DebugFilter;
 
-require 5.006;
 use mod_perl 1.99;
 
 use strict;
@@ -12,6 +11,7 @@
 use Apache::FilterRec ();
 use APR::Brigade ();
 use APR::Bucket ();
+use APR::BucketType ();
 
 use Apache::Const -compile => qw(OK DECLINED);
 use APR::Const    -compile => ':common';

Modified: Apache-DebugFilter/trunk/Makefile.PL
==============================================================================
--- Apache-DebugFilter/trunk/Makefile.PL	(original)
+++ Apache-DebugFilter/trunk/Makefile.PL	Sun Jan  2 15:17:18 2005
@@ -15,6 +15,11 @@
     push @clean_files, $_;
 }
 
+my %require = (
+    "Apache::Test" => "1.10", # ipv6 fixes
+    "mod_perl"     => "1.9915",
+);
+
 ModPerl::MM::WriteMakefile(
     NAME          => "Apache::DebugFilter",
     VERSION_FROM  => "DebugFilter.pm",
@@ -23,7 +28,7 @@
     },
     ABSTRACT_FROM => 'DebugFilter.pm',
     AUTHOR        => 'Stas Bekman <stas@stason.org>',
-    PREREQ_PM     => {},
+    PREREQ_PM     => \%require,
     dist          => {
         PREOP        => 'pod2text DebugFilter.pm > $(DISTVNAME)/README',
         COMPRESS     => 'gzip -9f',

Modified: Apache-DebugFilter/trunk/t/response/TestDebugFilter/bb_dump.pm
==============================================================================
--- Apache-DebugFilter/trunk/t/response/TestDebugFilter/bb_dump.pm	(original)
+++ Apache-DebugFilter/trunk/t/response/TestDebugFilter/bb_dump.pm	Sun Jan  2 15:17:18 2005
@@ -7,6 +7,7 @@
 use APR::Bucket ();
 use APR::Brigade ();
 use APR::Util ();
+use APR::Error ();
 
 use Apache::TestTrace;
 
@@ -24,8 +25,8 @@
 
     for (;;) {
         my $rv = $c->input_filters->get_brigade($ibb, Apache::MODE_GETLINE);
-        if ($rv != APR::SUCCESS or $ibb->empty) {
-            my $error = APR::strerror($rv);
+        if ($rv != APR::SUCCESS or $ibb->is_empty) {
+            my $error = APR::Error::strerror($rv);
             unless ($rv == APR::EOF) {
                 warn "[echo_filter] get_brigade: $error\n";
             }
@@ -40,7 +41,7 @@
 
         while (my($btype, $data) = splice @$ra_data, 0, 2) {
             my $data = "$btype => $data";
-            $obb->insert_tail(APR::Bucket->new($data));
+            $obb->insert_tail(APR::Bucket->new($ba, $data));
         }
         $obb->insert_tail(APR::Bucket::flush_create($ba));
 

Modified: Apache-DebugFilter/trunk/t/response/TestDebugFilter/snoop.pm
==============================================================================
--- Apache-DebugFilter/trunk/t/response/TestDebugFilter/snoop.pm	(original)
+++ Apache-DebugFilter/trunk/t/response/TestDebugFilter/snoop.pm	Sun Jan  2 15:17:18 2005
@@ -3,6 +3,8 @@
 use strict;
 use warnings FATAL => 'all';
 
+use APR::Brigade ();
+use APR::Bucket ();
 use Apache::RequestRec ();
 use Apache::RequestIO ();
 use Apache::Connection ();
@@ -25,53 +27,49 @@
     Apache::OK;
 }
 
+# to enable debug start with: (or simply run with -trace=debug)
+# t/TEST -trace=debug -start
 sub read_post {
     my $r = shift;
     my $debug = shift || 0;
 
-    require APR::Brigade;
-    require APR::Bucket;
+    my $bb = APR::Brigade->new($r->pool,
+                               $r->connection->bucket_alloc);
 
-    my @data = ();
+    my $data = '';
     my $seen_eos = 0;
-    my $filters = $r->input_filters();
-    my $ba = $r->connection->bucket_alloc;
-    my $bb = APR::Brigade->new($r->pool, $ba);
-
+    my $count = 0;
     do {
-        my $rv = $filters->get_brigade($bb,
-            Apache::MODE_READBYTES, APR::BLOCK_READ, IOBUFSIZE);
-        if ($rv != APR::SUCCESS) {
-            return $rv;
-        }
+        $r->input_filters->get_brigade($bb, Apache::MODE_READBYTES,
+                                       APR::BLOCK_READ, IOBUFSIZE);
 
-        while (!$bb->empty) {
-            my $buf;
-            my $b = $bb->first;
+        $count++;
 
-            $b->remove;
+        warn "read_post: bb $count\n" if $debug;
+
+        while (!$bb->is_empty) {
+            my $b = $bb->first;
 
             if ($b->is_eos) {
-                warn "EOS bucket:\n" if $debug;
+                warn "read_post: EOS bucket:\n" if $debug;
                 $seen_eos++;
                 last;
             }
 
-            my $status = $b->read($buf);
-            warn "DATA bucket: [$buf]\n" if $debug;
-            if ($status != APR::SUCCESS) {
-                return $status;
+            if ($b->read(my $buf)) {
+                warn "read_post: DATA bucket: [$buf]\n" if $debug;
+                $data .= $buf;
             }
-            push @data, $buf;
-        }
 
-        $bb->destroy;
+            $b->delete;
+        }
 
     } while (!$seen_eos);
 
-    return join '', @data;
-}
+    $bb->destroy;
 
+    return $data;
+}
 
 1;
 __END__
@@ -83,7 +81,7 @@
       # Connection snooping (everything)
       PerlInputFilterHandler  Apache::DebugFilter::snoop_connection
       PerlOutputFilterHandler Apache::DebugFilter::snoop_connection
-      
+
       # HTTP Request snooping (only HTTP request body)
       <Location /TestDebugFilter__snoop>
           SetHandler modperl



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About