r76993 - in /branches/upstream/libhttp-proxy-perl/current: ./ lib/HTTP/ lib/HTTP/Proxy/BodyFilter/ lib/HTTP/Proxy/Engine/ t/
carnil at users.alioth.debian.org
carnil at users.alioth.debian.org
Sun Jul 3 11:49:24 UTC 2011
Author: carnil
Date: Sun Jul 3 11:49:23 2011
New Revision: 76993
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=76993
Log:
[svn-upgrade] new version libhttp-proxy-perl (0.25)
Added:
branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/Threaded.pm
Modified:
branches/upstream/libhttp-proxy-perl/current/Changes
branches/upstream/libhttp-proxy-perl/current/MANIFEST
branches/upstream/libhttp-proxy-perl/current/META.yml
branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy.pm
branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/BodyFilter/save.pm
branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/Legacy.pm
branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/ScoreBoard.pm
branches/upstream/libhttp-proxy-perl/current/t/00basic.t
branches/upstream/libhttp-proxy-perl/current/t/90diveintomark.t
Modified: branches/upstream/libhttp-proxy-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-proxy-perl/current/Changes?rev=76993&op=diff
==============================================================================
--- branches/upstream/libhttp-proxy-perl/current/Changes (original)
+++ branches/upstream/libhttp-proxy-perl/current/Changes Sun Jul 3 11:49:23 2011
@@ -1,4 +1,11 @@
Revision history for Perl extension HTTP::Proxy
+
+0.25 Sun Jul 3 00:28:10 CEST 2011
+ [ENHANCEMENTS]
+ - new Engine: HTTP::Proxy::Engine::Threaded, by Angelos Karageorgiou
+ [FIXES]
+ - Correctly call eod() when the response has no body
+ (closed RT ticket #48310)
0.24 Tue Jul 21 21:28:02 CEST 2009
[ENHANCEMENTS]
Modified: branches/upstream/libhttp-proxy-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-proxy-perl/current/MANIFEST?rev=76993&op=diff
==============================================================================
--- branches/upstream/libhttp-proxy-perl/current/MANIFEST (original)
+++ branches/upstream/libhttp-proxy-perl/current/MANIFEST Sun Jul 3 11:49:23 2011
@@ -39,6 +39,7 @@
lib/HTTP/Proxy/Engine/Legacy.pm
lib/HTTP/Proxy/Engine/NoFork.pm
lib/HTTP/Proxy/Engine/ScoreBoard.pm
+lib/HTTP/Proxy/Engine/Threaded.pm
lib/HTTP/Proxy/FilterStack.pm
lib/HTTP/Proxy/HeaderFilter.pm
lib/HTTP/Proxy/HeaderFilter/simple.pm
Modified: branches/upstream/libhttp-proxy-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-proxy-perl/current/META.yml?rev=76993&op=diff
==============================================================================
--- branches/upstream/libhttp-proxy-perl/current/META.yml (original)
+++ branches/upstream/libhttp-proxy-perl/current/META.yml Sun Jul 3 11:49:23 2011
@@ -1,20 +1,19 @@
---
+abstract: 'A pure Perl HTTP proxy'
+author:
+ - "Philippe \"BooK\" Bruhat <book at cpan.org>"
+configure_requires:
+ Module::Build: 0.36
+generated_by: 'Module::Build version 0.3607'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
name: HTTP-Proxy
-version: 0.24
-author:
- - 'Philippe "BooK" Bruhat <book at cpan.org>'
-abstract: A pure Perl HTTP proxy
-license: perl
-resources:
- license: http://dev.perl.org/licenses/
-requires:
- HTTP::Daemon: 1.25
- LWP::UserAgent: 2
- Test::More: 0
provides:
HTTP::Proxy:
file: lib/HTTP/Proxy.pm
- version: 0.24
+ version: 0.25
HTTP::Proxy::BodyFilter:
file: lib/HTTP/Proxy/BodyFilter.pm
HTTP::Proxy::BodyFilter::complete:
@@ -39,6 +38,8 @@
file: lib/HTTP/Proxy/Engine/NoFork.pm
HTTP::Proxy::Engine::ScoreBoard:
file: lib/HTTP/Proxy/Engine/ScoreBoard.pm
+ HTTP::Proxy::Engine::Threaded:
+ file: lib/HTTP/Proxy/Engine/Threaded.pm
HTTP::Proxy::FilterStack:
file: lib/HTTP/Proxy/FilterStack.pm
HTTP::Proxy::HeaderFilter:
@@ -47,7 +48,10 @@
file: lib/HTTP/Proxy/HeaderFilter/simple.pm
HTTP::Proxy::HeaderFilter::standard:
file: lib/HTTP/Proxy/HeaderFilter/standard.pm
-generated_by: Module::Build version 0.280801
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.2.html
- version: 1.2
+requires:
+ HTTP::Daemon: 1.25
+ LWP::UserAgent: 2
+ Test::More: 0
+resources:
+ license: http://dev.perl.org/licenses/
+version: 0.25
Modified: branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy.pm?rev=76993&op=diff
==============================================================================
--- branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy.pm (original)
+++ branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy.pm Sun Jul 3 11:49:23 2011
@@ -20,7 +20,7 @@
DATA CONNECT ENGINE ALL );
%EXPORT_TAGS = ( log => [@EXPORT_OK] ); # only one tag
-$VERSION = '0.24';
+$VERSION = '0.25';
my $CRLF = "\015\012"; # "\r\n" is not portable
@@ -422,6 +422,16 @@
# remove the header added by LWP::UA before it sends the response back
$response->remove_header('Client-Date');
+ # the callback is not called by LWP::UA->request
+ # in some cases (HEAD, redirect, error responses have no body)
+ if ( !$sent ) {
+ $self->response($response);
+ $self->{$_}{response}->select_filters( $response )
+ for qw( headers body );
+ $self->{headers}{response}
+ ->filter( $response->headers, $response );
+ }
+
# do a last pass, in case there was something left in the buffers
my $data = ""; # FIXME $protocol is undef here too
$self->{body}{response}->filter_last( \$data, $response, undef );
@@ -435,16 +445,6 @@
# last chunk
print $conn "0$CRLF$CRLF" if $chunked; # no trailers either
$self->response($response);
-
- # the callback is not called by LWP::UA->request
- # in some case (HEAD, error)
- if ( !$sent ) {
- $self->response($response);
- $self->{$_}{response}->select_filters( $response )
- for qw( headers body );
- $self->{headers}{response}
- ->filter( $response->headers, $response );
- }
# what about X-Died and X-Content-Range?
if( my $died = $response->header('X-Died') ) {
@@ -921,10 +921,10 @@
$proxy->push_filter(
mime => undef,
request => HTTP::Proxy::HeaderFilter::simple->new(
- sub { $_[0]->remove_header(qw( User-Agent From Referer Cookie )) },
+ sub { $_[1]->remove_header(qw( User-Agent From Referer Cookie )) },
),
response => HTTP::Proxy::HeaderFilter::simple->new(
- sub { $_[0]->remove_header(qw( Set-Cookie )); },
+ sub { $_[1]->remove_header(qw( Set-Cookie )); },
)
);
Modified: branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/BodyFilter/save.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/BodyFilter/save.pm?rev=76993&op=diff
==============================================================================
--- branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/BodyFilter/save.pm (original)
+++ branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/BodyFilter/save.pm Sun Jul 3 11:49:23 2011
@@ -285,14 +285,14 @@
and C<prefix>) are ignored.
The C<filename> option expects a reference to a subroutine. The subroutine
-will receive the HTTP::Message object and must return a string which
+will receive the C<HTTP::Message> object and must return a string which
is the path of the file to be created (an absolute path is recommended,
but a relative path is accepted).
Returning C<""> or C<undef> will prevent the creation of the file.
This lets a filter decide even more precisely what to save or not,
even though this should be done in the match subroutine (see
-HTTP::Proxy's C<pushè_filte()> method).
+HTTP::Proxy's C<push_filter()> method).
=back
Modified: branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/Legacy.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/Legacy.pm?rev=76993&op=diff
==============================================================================
--- branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/Legacy.pm (original)
+++ branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/Legacy.pm Sun Jul 3 11:49:23 2011
@@ -114,11 +114,23 @@
This engine reproduces the older child creation algorithm of HTTP::Proxy.
+Angelos Karageorgiou C<< <angelos at unix.gr> >> reports:
+
+I<I got the Legacy engine to work really fast under C<Win32> with the following trick:>
+
+ max_keep_alive_requests(1);
+ max_clients(120);
+ $HTTP::VERSION(1.0); # just in case
+
+I<and it smokes.>
+
+I<It seems that forked children are really slow when calling select for handling C<keep-alive>d requests!>
+
=head1 METHODS
The module defines the following methods, used by HTTP::Proxy main loop:
-=over
+=over 4
=item start()
Modified: branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/ScoreBoard.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/ScoreBoard.pm?rev=76993&op=diff
==============================================================================
--- branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/ScoreBoard.pm (original)
+++ branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/ScoreBoard.pm Sun Jul 3 11:49:23 2011
@@ -232,7 +232,7 @@
=head1 SYNOPSIS
- my $proxy = HTTP::Proxy->new( engine => ScoreBoard );
+ my $proxy = HTTP::Proxy->new( engine => 'ScoreBoard' );
=head1 DESCRIPTION
@@ -242,7 +242,7 @@
The module defines the following methods, used by HTTP::Proxy main loop:
-=over
+=over 4
=item start()
Added: branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/Threaded.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/Threaded.pm?rev=76993&op=file
==============================================================================
--- branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/Threaded.pm (added)
+++ branches/upstream/libhttp-proxy-perl/current/lib/HTTP/Proxy/Engine/Threaded.pm Sun Jul 3 11:49:23 2011
@@ -1,0 +1,121 @@
+package HTTP::Proxy::Engine::Threaded;
+use strict;
+use HTTP::Proxy;
+use threads;
+
+# A massive hack of Engine::Fork to use the threads stuff
+# Basically created to work under win32 so that the filters
+# can share global caches among themselves
+# Angelos Karageorgiou angelos at unix.gr
+
+our @ISA = qw( HTTP::Proxy::Engine );
+our %defaults = (
+ max_clients => 60,
+);
+
+
+__PACKAGE__->make_accessors( qw( kids select ), keys %defaults );
+
+sub start {
+ my $self = shift;
+ $self->kids( [] );
+ $self->select( IO::Select->new( $self->proxy->daemon ) );
+}
+
+sub run {
+ my $self = shift;
+ my $proxy = $self->proxy;
+ my $kids = $self->kids;
+
+ # check for new connections
+ my @ready = $self->select->can_read(1);
+ for my $fh (@ready) { # there's only one, anyway
+ # single-process proxy (useful for debugging)
+
+ # accept the new connection
+ my $conn = $fh->accept;
+ my $child=threads->new(\&worker,$proxy,$conn);
+ if ( !defined $child ) {
+ $conn->close;
+ $proxy->log( HTTP::Proxy::ERROR, "PROCESS", "Cannot spawn thread" );
+ next;
+ }
+ $child->detach();
+
+ }
+
+}
+
+sub stop {
+ my $self = shift;
+ my $kids = $self->kids;
+
+ # not needed
+}
+
+sub worker {
+ my $proxy=shift;
+ my $conn=shift;
+ $proxy->serve_connections($conn);
+ $conn->close();
+ return;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+HTTP::Proxy::Engine::Threaded - A scoreboard-based HTTP::Proxy engine
+
+=head1 SYNOPSIS
+
+ my $proxy = HTTP::Proxy->new( engine => 'Threaded' );
+
+=head1 DESCRIPTION
+
+This module provides a threaded engine to HTTP::Proxy.
+
+=head1 METHODS
+
+The module defines the following methods, used by HTTP::Proxy main loop:
+
+=over 4
+
+=item start()
+
+Initialize the engine.
+
+=item run()
+
+Implements the forking logic: a new process is forked for each new
+incoming TCP connection.
+
+=item stop()
+
+Reap remaining child processes.
+
+=back
+
+=head1 SEE ALSO
+
+L<HTTP::Proxy>, L<HTTP::Proxy::Engine>.
+
+=head1 AUTHOR
+
+Angelos Karageorgiou C<< <angelos at unix.gr> >>. (Actual code)
+
+Philippe "BooK" Bruhat, C<< <book at cpan.org> >>. (Documentation)
+
+=head1 COPYRIGHT
+
+Copyright 2010, Philippe Bruhat.
+
+=head1 LICENSE
+
+This module is free software; you can redistribute it or modify it under
+the same terms as Perl itself.
+
+=cut
+
Modified: branches/upstream/libhttp-proxy-perl/current/t/00basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-proxy-perl/current/t/00basic.t?rev=76993&op=diff
==============================================================================
--- branches/upstream/libhttp-proxy-perl/current/t/00basic.t (original)
+++ branches/upstream/libhttp-proxy-perl/current/t/00basic.t Sun Jul 3 11:49:23 2011
@@ -1,6 +1,7 @@
use vars qw( @modules );
BEGIN {
+ use Config;
use File::Find;
use vars qw( @modules );
@@ -9,5 +10,12 @@
use Test::More tests => scalar @modules;
-use_ok($_) for sort map { s!/!::!g; s/\.pm$//; s/^blib::lib:://; $_ } @modules;
+for ( sort map { s!/!::!g; s/\.pm$//; s/^blib::lib:://; $_ } @modules ) {
+SKIP:
+ {
+ skip "$^X is not a threaded Perl", 1
+ if /Thread/ && !$Config{usethreads};
+ use_ok($_);
+ }
+}
Modified: branches/upstream/libhttp-proxy-perl/current/t/90diveintomark.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-proxy-perl/current/t/90diveintomark.t?rev=76993&op=diff
==============================================================================
--- branches/upstream/libhttp-proxy-perl/current/t/90diveintomark.t (original)
+++ branches/upstream/libhttp-proxy-perl/current/t/90diveintomark.t Sun Jul 3 11:49:23 2011
@@ -30,12 +30,15 @@
$tests += @$_ - 1 for @url;
}
-use Test::More tests => $tests;
+use Test::More;
use HTTP::Proxy;
use HTTP::Request::Common;
use t::Utils;
my $base = 'http://diveintomark.org/tests/client/http';
+
+plan skip_all => "$base seems to have stopped working";
+plan tests => $tests;
SKIP:
{
More information about the Pkg-perl-cvs-commits
mailing list