r20764 - in /branches/upstream/libpoe-component-client-http-perl/current: CHANGES MANIFEST META.yml lib/POE/Component/Client/HTTP.pm lib/POE/Component/Client/HTTP/Request.pm t/14_gzipped_content.t t/59_andy_one_keepalive.t

tincho at users.alioth.debian.org tincho at users.alioth.debian.org
Fri Jun 6 11:31:26 UTC 2008


Author: tincho
Date: Fri Jun  6 11:31:26 2008
New Revision: 20764

URL: http://svn.debian.org/wsvn/?sc=1&rev=20764
Log:
[svn-upgrade] Integrating new upstream version, libpoe-component-client-http-perl (0.84)

Added:
    branches/upstream/libpoe-component-client-http-perl/current/t/59_andy_one_keepalive.t
Modified:
    branches/upstream/libpoe-component-client-http-perl/current/CHANGES
    branches/upstream/libpoe-component-client-http-perl/current/MANIFEST
    branches/upstream/libpoe-component-client-http-perl/current/META.yml
    branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP.pm
    branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/Request.pm
    branches/upstream/libpoe-component-client-http-perl/current/t/14_gzipped_content.t

Modified: branches/upstream/libpoe-component-client-http-perl/current/CHANGES
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-client-http-perl/current/CHANGES?rev=20764&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/CHANGES (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/CHANGES Fri Jun  6 11:31:26 2008
@@ -1,3 +1,27 @@
+======================================
+9999-99-99 99:99:99.999999Z (untagged)
+======================================
+
+  2008-05-28 17:33:06 (r327) by rcaputo
+  lib/POE/Component/Client/HTTP.pm M; t/14_gzipped_content.t M;
+  lib/POE/Component/Client/HTTP/Request.pm M
+
+    Resolve Content-Encoding issue surfaced by recent changes to
+    HTTP::Response. Applies the fix recommeded by Yuri Karaban in
+    rt.cpan.org ticket 35538. 
+
+  2008-05-04 06:57:15 (r326) by rcaputo
+  lib/POE/Component/Client/HTTP/Request.pm M
+
+    Resolve character encoding issues arising from a change in
+    HTTP::Message's decoded_content() behavior. Tentatively resolves
+    rt.cpan.org ticket 35538, reported by Yuri Karaban, with additional
+    commentary and a test case by "OverlordQ". 
+
+  2008-04-20 00:34:15 (r325) by rcaputo; MANIFEST M
+
+    Add t/59_andy_one_keepalive.t 
+
 =================================
 2008-04-20T00:30:17.408340Z v0_83
 =================================

Modified: branches/upstream/libpoe-component-client-http-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-client-http-perl/current/MANIFEST?rev=20764&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/MANIFEST (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/MANIFEST Fri Jun  6 11:31:26 2008
@@ -1,4 +1,4 @@
-# $Id: MANIFEST 294 2006-10-25 06:55:14Z rcaputo $
+# $Id: MANIFEST 325 2008-04-20 00:34:15Z rcaputo $
 CHANGES
 CHANGES.OLD
 MANIFEST
@@ -34,3 +34,4 @@
 t/56_redirect_excess.t
 t/57_joel_immed_cancel.t
 t/58_joel_cancel_multi.t
+t/59_andy_one_keepalive.t

Modified: branches/upstream/libpoe-component-client-http-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-client-http-perl/current/META.yml?rev=20764&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/META.yml (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/META.yml Fri Jun  6 11:31:26 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                POE-Component-Client-HTTP
-version:             0.83
+version:             0.84
 abstract:            Non-blocking/concurrent HTTP queries with POE
 license:             perl
 generated_by:        ExtUtils::MakeMaker version 6.31

Modified: branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP.pm?rev=20764&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP.pm (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP.pm Fri Jun  6 11:31:26 2008
@@ -1,4 +1,4 @@
-# $Id: HTTP.pm 323 2008-04-20 00:29:46Z rcaputo $
+# $Id: HTTP.pm 327 2008-05-28 17:33:06Z rcaputo $
 
 package POE::Component::Client::HTTP;
 
@@ -11,7 +11,7 @@
 use constant DEBUG_DATA => 0;
 
 use vars qw($VERSION);
-$VERSION = '0.83';
+$VERSION = '0.84';
 
 use Carp qw(croak);
 use HTTP::Response;
@@ -83,11 +83,6 @@
 #  grep { exists $te_filters{$_} }
 #  qw(x-bzip2 gzip x-gzip deflate compress chunked identity)
 #);
-
-# Set default accept encoding here, but DON'T SET later, if the
-# request is streaming.
-
-my $accept_encoding = Net::HTTP::Methods::zlib_ok() ? 'gzip' : '';
 
 my %supported_schemes = (
   http  => 1,
@@ -261,17 +256,6 @@
 
   if (defined $proxy_override) {
     POE::Component::Client::HTTP::RequestFactory->parse_proxy($proxy_override);
-  }
-
-  # Add an Accept-Encoding header if streaming is not enabled and the
-  # header doesn't already exist.
-  if (
-    !$heap->{factory}->is_streaming and
-    !$heap->{factory}->max_response_size and # or for limited chunk sizes
-    !defined($http_request->header('Accept-Encoding')) and
-    length($accept_encoding)
-  ) {
-    $http_request->header('Accept-Encoding', $accept_encoding);
   }
 
   my $request = $heap->{factory}->create_request(
@@ -1348,6 +1332,37 @@
   
   $kernel->post( ua => request, 'response', $request );
 
+=head1 CONTENT ENCODING AND COMPRESSION
+
+Transparent content decoding has been disabled as of version 0.84.
+This also removes support for transparent gzip requesting and
+decompression.
+
+To re-enable gzip compression, specify the gzip Content-Encoding and
+use HTTP::Response's decoded_content() method rather than content():
+
+  my $request = HTTP::Request->new(
+    GET => "http://www.yahoo.com/", [
+      'Accept-Encoding' => 'gzip'
+    ]
+  );
+
+  # ... time passes ...
+  
+  my $content = $response->decoded_content();
+
+The change in POE::Component::Client::HTTP behavior was prompted by
+changes in HTTP::Response that surfaced a bug in the component's
+transparent gzip handling.
+
+Allowing the application to specify and handle content encodings seems
+to be the most reliable and flexible resolution.
+
+For more information about the problem and discussions regarding the
+solution, see:
+L<http://www.perlmonks.org/?node_id=683833> and
+L<http://rt.cpan.org/Ticket/Display.html?id=35538>
+
 =head1 ENVIRONMENT
 
 POE::Component::Client::HTTP uses two standard environment variables:

Modified: branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/Request.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/Request.pm?rev=20764&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/Request.pm (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/Request.pm Fri Jun  6 11:31:26 2008
@@ -1,4 +1,4 @@
-# $Id: Request.pm 318 2008-03-25 07:42:11Z rcaputo $
+# $Id: Request.pm 327 2008-05-28 17:33:06Z rcaputo $
 
 package POE::Component::Client::HTTP::Request;
 use strict;
@@ -177,16 +177,6 @@
   # if we are. that there's no ARG1 lets the client know we're done
   # with the content in the latter case
   if ($self->[REQ_STATE] & RS_DONE) {
-    DEBUG and warn(
-      "checking $response for content-encoding ", $self->[REQ_ID]
-    );
-    if ($response->header('content-encoding')) {
-      my $content;
-      # LWP likes to die on error.
-      eval { $content = $response->decoded_content };
-      if ($content) { $response->content($content); }
-    }
-
     DEBUG and warn "done; returning $response for ", $self->[REQ_ID];
     $self->[REQ_POSTBACK]->($self->[REQ_RESPONSE]);
     $self->[REQ_STATE] |= RS_POSTED;
@@ -498,10 +488,10 @@
     $http_request->protocol() . "\x0D\x0A" .
     $http_request->headers_as_string("\x0D\x0A") . "\x0D\x0A"
   );
-  
+ 
   if ( !ref $http_request->content() ) {
     $request_string .= $http_request->content(); # . "\x0D\x0A"
-  }    
+  }
 
   DEBUG and do {
     my $formatted_request_string = $request_string;

Modified: branches/upstream/libpoe-component-client-http-perl/current/t/14_gzipped_content.t
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-client-http-perl/current/t/14_gzipped_content.t?rev=20764&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/t/14_gzipped_content.t (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/t/14_gzipped_content.t Fri Jun  6 11:31:26 2008
@@ -108,7 +108,7 @@
 
       ok(
         $response->code() == 200 &&
-        $response->content eq $original_content,
+        $response->decoded_content eq $original_content,
         "gzip encoded transfers decode correctly"
       );
     },

Added: branches/upstream/libpoe-component-client-http-perl/current/t/59_andy_one_keepalive.t
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-client-http-perl/current/t/59_andy_one_keepalive.t?rev=20764&op=file
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/t/59_andy_one_keepalive.t (added)
+++ branches/upstream/libpoe-component-client-http-perl/current/t/59_andy_one_keepalive.t Fri Jun  6 11:31:26 2008
@@ -1,0 +1,77 @@
+# $Id$
+# vim: filetype=perl
+
+# Test case for reusing a single keep-alive connection using max_per_host = 1
+
+use strict;
+
+use Test::More tests => 2;
+use POE qw(
+    Component::Client::Keepalive
+    Component::Client::HTTP
+);
+use HTTP::Request;
+
+# poe.perl.org dns is failing right now
+#my $test_url = 'http://poe.perl.org/misc/test.html';
+
+# A small gif on my server that supports keep-alive
+my $test_url = 'http://www.hybridized.org/static/images/xml.gif';
+
+my $cm = POE::Component::Client::Keepalive->new(
+    keep_alive    => 5,
+    max_open      => 4,
+    max_per_host  => 1,
+    timeout       => 10,
+);
+
+POE::Component::Client::HTTP->spawn( 
+    Alias             => 'ua',
+    ConnectionManager => $cm,
+);
+
+POE::Session->create(
+    inline_states => {
+        _start       => \&_start,
+        got_response => \&got_response,
+    },
+    heap => {
+        reqid => 1,
+    }
+);
+
+POE::Kernel->run;
+exit 0;
+
+sub _start {
+    my ( $kernel, $heap ) = @_[ KERNEL, HEAP ];
+    
+    my $req = HTTP::Request->new( GET => $test_url );
+    $req->header( Connection => 'keep-alive' );
+    
+    $kernel->post(
+        ua => request => 'got_response', $req
+    );
+}
+
+sub got_response {
+    my ( $kernel, $heap, $reqp, $resp ) = @_[ KERNEL, HEAP, ARG0, ARG1 ];
+    
+    my $res = $resp->[0];
+    
+    is( $res->code, 200, 'Request ' . $heap->{reqid} . ' ok' );
+    
+    if ( $heap->{reqid}++ == 1 ) { 
+        # Make a second request on the first connection
+        
+        my $req = HTTP::Request->new( GET => $test_url );
+        $req->header( Connection => 'close' );
+
+        $kernel->post(
+            ua => request => 'got_response', $req
+        );
+    }
+    else {    
+        $kernel->post( ua => 'shutdown' );
+    }
+}




More information about the Pkg-perl-cvs-commits mailing list