r19439 - in /trunk/libhttp-proxy-perl: Changes MANIFEST META.yml debian/changelog lib/HTTP/Proxy.pm lib/HTTP/Proxy/BodyFilter/complete.pm t/22http.t t/22transparent.t t/23connect.t t/42will_modify.t t/61simple.t t/67complete.t
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Mon May 5 19:52:52 UTC 2008
Author: gregoa
Date: Mon May 5 19:52:51 2008
New Revision: 19439
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=19439
Log:
New upstream release.
Added:
trunk/libhttp-proxy-perl/t/67complete.t
- copied unchanged from r19438, branches/upstream/libhttp-proxy-perl/current/t/67complete.t
Modified:
trunk/libhttp-proxy-perl/Changes
trunk/libhttp-proxy-perl/MANIFEST
trunk/libhttp-proxy-perl/META.yml
trunk/libhttp-proxy-perl/debian/changelog
trunk/libhttp-proxy-perl/lib/HTTP/Proxy.pm
trunk/libhttp-proxy-perl/lib/HTTP/Proxy/BodyFilter/complete.pm
trunk/libhttp-proxy-perl/t/22http.t
trunk/libhttp-proxy-perl/t/22transparent.t
trunk/libhttp-proxy-perl/t/23connect.t
trunk/libhttp-proxy-perl/t/42will_modify.t
trunk/libhttp-proxy-perl/t/61simple.t
Modified: trunk/libhttp-proxy-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-proxy-perl/Changes?rev=19439&op=diff
==============================================================================
--- trunk/libhttp-proxy-perl/Changes (original)
+++ trunk/libhttp-proxy-perl/Changes Mon May 5 19:52:51 2008
@@ -1,4 +1,14 @@
Revision history for Perl extension HTTP::Proxy
+
+0.22 Thu May 1 00:18:38 CEST 2008
+ [TESTS]
+ - increased test coverage
+ - t/23connect.t doesn't need an Internet connection any more,
+ thus closing RT ticket #19653.
+ - t/67complete.t tests HTTP::Proxy::BodyFilter::complete
+ [DOCUMENTATION]
+ - closed RT ticket #33465 (Jimbo), by explaining in a little
+ more detail how HTTP::Proxy::BodyFilter::complete works.
0.21 Sun Apr 20 04:34:47 CEST 2008
[ENHANCEMENTS]
@@ -17,6 +27,8 @@
[TESTS]
- t/67save.t provides 96% coverage of HTTP::Proxy::BodyFilter::save,
and helped fix many bugs in it.
+ - fixed t/22http.t and t/22transparent.t not to break when the
+ DNS wrongly resolves an invalid address.
[DOCUMENTATION]
- closed RT ticket #25295 (Matsuno Tokuhiro) with a doc patch.
Modified: trunk/libhttp-proxy-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-proxy-perl/MANIFEST?rev=19439&op=diff
==============================================================================
--- trunk/libhttp-proxy-perl/MANIFEST (original)
+++ trunk/libhttp-proxy-perl/MANIFEST Mon May 5 19:52:51 2008
@@ -78,6 +78,7 @@
t/64lines.t
t/64tags.t
t/66htmlparser.t
+t/67complete.t
t/67save.t
t/71rot13.t
t/90diveintomark.t
Modified: trunk/libhttp-proxy-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-proxy-perl/META.yml?rev=19439&op=diff
==============================================================================
--- trunk/libhttp-proxy-perl/META.yml (original)
+++ trunk/libhttp-proxy-perl/META.yml Mon May 5 19:52:51 2008
@@ -1,6 +1,6 @@
---
name: HTTP-Proxy
-version: 0.21
+version: 0.22
author:
- 'Philippe "BooK" Bruhat <book at cpan.org>'
abstract: A pure Perl HTTP proxy
@@ -12,7 +12,7 @@
provides:
HTTP::Proxy:
file: lib/HTTP/Proxy.pm
- version: 0.21
+ version: 0.22
HTTP::Proxy::BodyFilter:
file: lib/HTTP/Proxy/BodyFilter.pm
HTTP::Proxy::BodyFilter::complete:
Modified: trunk/libhttp-proxy-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-proxy-perl/debian/changelog?rev=19439&op=diff
==============================================================================
--- trunk/libhttp-proxy-perl/debian/changelog (original)
+++ trunk/libhttp-proxy-perl/debian/changelog Mon May 5 19:52:51 2008
@@ -1,3 +1,9 @@
+libhttp-proxy-perl (0.22-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org> Mon, 05 May 2008 21:50:36 +0200
+
libhttp-proxy-perl (0.21-1) unstable; urgency=low
* debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser
Modified: trunk/libhttp-proxy-perl/lib/HTTP/Proxy.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-proxy-perl/lib/HTTP/Proxy.pm?rev=19439&op=diff
==============================================================================
--- trunk/libhttp-proxy-perl/lib/HTTP/Proxy.pm (original)
+++ trunk/libhttp-proxy-perl/lib/HTTP/Proxy.pm Mon May 5 19:52:51 2008
@@ -20,7 +20,7 @@
DATA CONNECT ENGINE ALL );
%EXPORT_TAGS = ( log => [@EXPORT_OK] ); # only one tag
-$VERSION = '0.21';
+$VERSION = '0.22';
my $CRLF = "\015\012"; # "\r\n" is not portable
@@ -1326,7 +1326,7 @@
=head1 COPYRIGHT
-Copyright 2002-2005, Philippe Bruhat.
+Copyright 2002-2008, Philippe Bruhat.
=head1 LICENSE
Modified: trunk/libhttp-proxy-perl/lib/HTTP/Proxy/BodyFilter/complete.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-proxy-perl/lib/HTTP/Proxy/BodyFilter/complete.pm?rev=19439&op=diff
==============================================================================
--- trunk/libhttp-proxy-perl/lib/HTTP/Proxy/BodyFilter/complete.pm (original)
+++ trunk/libhttp-proxy-perl/lib/HTTP/Proxy/BodyFilter/complete.pm Mon May 5 19:52:51 2008
@@ -39,6 +39,7 @@
response => HTTP::Proxy::BodyFilter::complete->new,
response => HTTP::Proxy::BodyFilter::simple->new(
sub {
+ my ( $self, $dataref, $message, $protocol, $buffer ) = @_;
# some complex processing that needs
# the whole response body
}
@@ -50,7 +51,7 @@
=head1 DESCRIPTION
The HTTP::Proxy::BodyFilter::complete filter will ensure that the next
-filter in the filter chain will only receive complete messages body
+filter in the filter chain will only receive complete message bodies
(either request or response).
It will store the chunks of data as they arrive, only to pass the B<entire>
@@ -66,6 +67,12 @@
Use with caution, otherwise your client will timeout, or your proxy will
run out of memory.
+Also note that all filters after C<complete> are still called when the
+proxy receives data: they just receive empty data. They will receive
+the complete data when the filter chain is called for the very last time
+(the C<$buffer> parameter is C<undef>). (See the documentation of
+L<HTTP::Proxy::BodyFilter> for details about the C<$buffer> parameter.)
+
=head1 METHOD
This filter defines two methods, called automatically:
@@ -74,8 +81,9 @@
=item filter()
-Stores the incoming data in memory until the last moment. The data
-is then released to the subsequent filters in the chain.
+Stores the incoming data in memory until the last moment and passes
+empty data to the subsequent filters in the chain. They will receive
+the full body during the last round of filter calls.
=item will_modify()
@@ -95,7 +103,7 @@
=head1 COPYRIGHT
-Copyright 2004-2006, Philippe Bruhat.
+Copyright 2004-2008, Philippe Bruhat.
=head1 LICENSE
Modified: trunk/libhttp-proxy-perl/t/22http.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-proxy-perl/t/22http.t?rev=19439&op=diff
==============================================================================
--- trunk/libhttp-proxy-perl/t/22http.t (original)
+++ trunk/libhttp-proxy-perl/t/22http.t Mon May 5 19:52:51 2008
@@ -10,7 +10,7 @@
[ 'http://www.mongueurs.net/', 200 ],
[ 'http://httpd.apache.org/docs', 301 ],
[ 'http://www.google.com/testing/', 404 ],
- [ 'http://www.error.zzz/', qr/^5\d\d$/, 1 ],
+ [ 'http://www.error.zzz/', '5..', 1 ],
);
}
@@ -67,9 +67,8 @@
# the real test
my $req = HTTP::Request->new( GET => $uri );
my $rep = $ua->simple_request($req);
- my $sub = ref( $_->[1] ) ? \&like : \&is;
- $sub->(
- $rep->code, $_->[1], "Got an answer (@{[$rep->code]})"
+ like(
+ $rep->code, qr/^$code$/, "Got an answer (@{[$rep->code]})"
);
}
}
Modified: trunk/libhttp-proxy-perl/t/22transparent.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-proxy-perl/t/22transparent.t?rev=19439&op=diff
==============================================================================
--- trunk/libhttp-proxy-perl/t/22transparent.t (original)
+++ trunk/libhttp-proxy-perl/t/22transparent.t Mon May 5 19:52:51 2008
@@ -11,7 +11,7 @@
[ 'www.mongueurs.net', '/', 200 ],
[ 'httpd.apache.org', '/docs', 301 ],
[ 'www.google.com', '/testing/', 404 ],
- [ 'www.error.zzz', '/', 500, 1 ],
+ [ 'www.error.zzz', '/', '5..', 1 ],
);
if ( $^O eq 'MSWin32' ) {
@@ -68,7 +68,7 @@
$content = bare_request( $path,
HTTP::Headers->new( Host => $host ), $proxy );
($code) = $content =~ m!^HTTP/\d+\.\d+ (\d\d\d) !g;
- is( $code, $status, "Got an answer ($code)" );
+ like( $code, qr/^$status$/, "Got an answer ($code)" );
}
}
}
Modified: trunk/libhttp-proxy-perl/t/23connect.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-proxy-perl/t/23connect.t?rev=19439&op=diff
==============================================================================
--- trunk/libhttp-proxy-perl/t/23connect.t (original)
+++ trunk/libhttp-proxy-perl/t/23connect.t Mon May 5 19:52:51 2008
@@ -1,8 +1,11 @@
-use Test::More tests => 4;
+use Test::More;
use strict;
use t::Utils; use HTTP::Proxy;
use LWP::UserAgent;
use IO::Socket::INET;
+
+plan skip_all => "This test fails on MSWin32. HTTP::Proxy is usable on Win32 with maxchild => 0"
+ if $^O eq 'MSWin32';
# test CONNECT
my $test = Test::Builder->new;
@@ -11,16 +14,29 @@
$test->use_numbers(0);
$test->no_ending(1);
-my $host = 'www.perl.org:22';
+# fork a local server that'll print a banner on connection
+my $host;
+my $banner = "President_of_Earth Barbarella Professor_Ping Stomoxys Dildano\n";
+{
-SKIP:
+ my $server = IO::Socket::INET->new( Listen => 1 );
+ plan 'skip_all', "Couldn't create local server" if !defined $server;
+
+ $host = 'localhost:' . $server->sockport;
+ my $pid = fork;
+ plan 'skip_all', "Couldn't fork" if !defined $pid;
+ if ( !$pid ) {
+ my $sock = $server->accept;
+ $sock->print($banner);
+ $sock->close;
+ exit;
+ }
+
+}
+
+plan tests => 4;
+
{
- # check if we can actually connect
- my $sock = IO::Socket::INET->new( PeerAddr => $host, Timeout => 5 )
- or skip "Direct connection to $host impossible", 4;
- my $banner = <$sock>;
- close $sock;
-
my $proxy = HTTP::Proxy->new( port => 0, max_connections => 1 );
$proxy->init; # required to access the url later
@@ -32,20 +48,24 @@
}
);
+ # wait for the server and proxy to be ready
+ sleep 4;
+
# run a client
my $ua = LWP::UserAgent->new;
$ua->proxy( https => $proxy->url );
my $req = HTTP::Request->new( CONNECT => "https://$host/" );
my $res = $ua->request($req);
- $sock = $res->{client_socket};
+ my $sock = $res->{client_socket};
+
my $read;
is( $res->code, 200, "The proxy accepts CONNECT requests" );
ok( $sock->sysread( $read, 100 ), "Read some data from the socket" );
- is( $read, $banner, "CONNECTed to the TCP server" );
+ is( $read, $banner, "CONNECTed to the TCP server and got the banner" );
close $sock;
- # make sure the kid is dead
- wait;
+ # make sure the kids are dead
+ wait for 1 .. 2;
}
Modified: trunk/libhttp-proxy-perl/t/42will_modify.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-proxy-perl/t/42will_modify.t?rev=19439&op=diff
==============================================================================
--- trunk/libhttp-proxy-perl/t/42will_modify.t (original)
+++ trunk/libhttp-proxy-perl/t/42will_modify.t Mon May 5 19:52:51 2008
@@ -1,19 +1,41 @@
use strict;
-use Test::More tests => 2;
+use Test::More;
use HTTP::Proxy;
use HTTP::Proxy::BodyFilter::tags;
use HTTP::Proxy::BodyFilter::simple;
use HTTP::Proxy::BodyFilter::complete;
+use HTTP::Proxy::BodyFilter::htmltext;
+use HTTP::Proxy::BodyFilter::lines;
+use HTTP::Proxy::BodyFilter::save;
use HTTP::Request;
+
+my @idem_filters = qw( complete lines save tags );
+
+plan tests => 2 + @idem_filters;
my $proxy = HTTP::Proxy->new( port => 0 );
-my $req = HTTP::Request->new( GET => 'http://www.zlonk.com/' );
-my $res = HTTP::Response->new();
+my $req = HTTP::Request->new( GET => 'http://www.vronk.com/' );
+my $res = HTTP::Response->new( 200 );
$res->request( $req );
$res->content_type( 'text/html' );
$proxy->request( $req );
$proxy->response( $res );
+
+# basic values
+for my $filter (@idem_filters) {
+ $req->uri("http://www.$filter.com/");
+ $proxy->push_filter(
+ response => "HTTP::Proxy::BodyFilter::$filter"->new );
+
+ $proxy->{body}{response}->select_filters($res);
+ is( $proxy->{body}{response}->will_modify($res),
+ 0, qq{Filter $filter won't change a thing} );
+}
+
+
+# change the request info
+$req->uri( 'http://www.zlonk.com/' );
# filters that don't modify anything
$proxy->push_filter(
@@ -40,3 +62,5 @@
ok( $proxy->{body}{response}->will_modify( $res ),
q{Filters admit they will change something}
);
+
+unlink( 'www.zlonk.com' ); # cleanup file created by HPBF::save
Modified: trunk/libhttp-proxy-perl/t/61simple.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-proxy-perl/t/61simple.t?rev=19439&op=diff
==============================================================================
--- trunk/libhttp-proxy-perl/t/61simple.t (original)
+++ trunk/libhttp-proxy-perl/t/61simple.t Mon May 5 19:52:51 2008
@@ -1,4 +1,4 @@
-use Test::More tests => 12;
+use Test::More tests => 14;
use strict;
use HTTP::Proxy::BodyFilter::simple;
@@ -41,6 +41,8 @@
# test the filter
for (
[ "\nfoo\n", "", "\nbar\n", "" ],
+ HTTP::Proxy::BodyFilter::simple->new( end => sub {} ),
+ [ "\nfoo\n", "", "\nfoo\n", "" ],
)
{
$filter = $_, next if ref $_ eq 'HTTP::Proxy::BodyFilter::simple';
More information about the Pkg-perl-cvs-commits
mailing list