r30962 - in /trunk/libpoe-component-client-http-perl: ./ debian/ lib/POE/Component/Client/ lib/POE/Component/Client/HTTP/ lib/POE/Filter/ t/

antonio-guest at users.alioth.debian.org antonio-guest at users.alioth.debian.org
Sat Feb 21 13:47:33 UTC 2009


Author: antonio-guest
Date: Sat Feb 21 13:47:30 2009
New Revision: 30962

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=30962
Log:
last remaining commit for the upstream upgrade

Added:
    trunk/libpoe-component-client-http-perl/t/57_pravus_progress.t
      - copied unchanged from r30961, branches/upstream/libpoe-component-client-http-perl/current/t/57_pravus_progress.t
Modified:
    trunk/libpoe-component-client-http-perl/CHANGES
    trunk/libpoe-component-client-http-perl/MANIFEST
    trunk/libpoe-component-client-http-perl/META.yml
    trunk/libpoe-component-client-http-perl/debian/changelog
    trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP.pm
    trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP/Request.pm
    trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP/RequestFactory.pm
    trunk/libpoe-component-client-http-perl/lib/POE/Filter/HTTPChunk.pm
    trunk/libpoe-component-client-http-perl/t/01_request.t
    trunk/libpoe-component-client-http-perl/t/02_keepalive.t
    trunk/libpoe-component-client-http-perl/t/04_chunk_filter.t
    trunk/libpoe-component-client-http-perl/t/10_shutdown.t
    trunk/libpoe-component-client-http-perl/t/11_cancel.t

Modified: trunk/libpoe-component-client-http-perl/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/CHANGES?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/CHANGES (original)
+++ trunk/libpoe-component-client-http-perl/CHANGES Sat Feb 21 13:47:30 2009
@@ -1,3 +1,69 @@
+=================================
+2009-02-19T07:14:44.152645Z v0_88
+=================================
+
+  2009-02-19 07:14:19 (r361) by rcaputo
+  lib/POE/Component/Client/HTTP.pm M
+
+    Time for a new release.
+
+  2009-02-19 07:09:22 (r360) by rcaputo
+  lib/POE/Component/Client/HTTP/RequestFactory.pm M;
+  t/57_pravus_progress.t A; MANIFEST M
+
+    Add PRAVUS' test case and patch to return progress events even after
+    a redirect. Resolves his rt.cpan.org ticket, #36627. 
+
+  2009-02-19 05:20:37 (r359) by rcaputo
+  lib/POE/Component/Client/HTTP/Request.pm M
+
+    Comment the RS_* states.
+
+  2009-02-19 04:00:21 (r358) by rcaputo; t/01_request.t M
+
+    Resolve rt.cpan.org #41278, reported by Andreas J. König. The
+    component test was timing out on his smoker, so I increased the
+    timeout. 
+
+  2009-02-18 17:43:15 (r357) by rcaputo
+  lib/POE/Component/Client/HTTP/RequestFactory.pm M;
+  lib/POE/Component/Client/HTTP.pm M
+
+    Resolve rt.cpan.org #35951, reported by Dave Miller. We were passing
+    Tag to POE::Component::Client::Request->new() when it wasn't
+    necessary. 
+
+  2009-02-18 17:36:32 (r356) by rcaputo
+  lib/POE/Component/Client/HTTP.pm M
+
+    Resolve rt.cpan.org ticket #27643. When a server disconnects before
+    responding, POE::Component::Client::HTTP returns a 406 error to the
+    application. The "MaxSize" error was incorrect and has been replaced
+    with "Server response is Not Acceptable". The surrounding logic has
+    been simplified somewhat as well. 
+
+  2009-02-18 07:29:34 (r355) by rcaputo
+  lib/POE/Component/Client/HTTP.pm M
+
+    Clarify the docs per Evan Carroll's suggestion. Resolves rt.cpan.org
+    ticket 41312. 
+
+  2009-02-18 06:19:51 (r354) by rcaputo
+  t/10_shutdown.t M; lib/POE/Filter/HTTPChunk.pm M; t/04_chunk_filter.t
+  M; t/02_keepalive.t M; t/11_cancel.t M
+
+    Clean up several warnings introduced by recent POE changes.
+    
+    Apply Zhurs' patch to resolve rt.cpan.org tickets 43073 and 25855.
+    POE::Filter::HTTPChunk would go into an infinite loop on bad chunk
+    trailer data, but now it appears to be fixed. Thank you! 
+
+  2009-01-06 03:11:42 (r353) by rcaputo
+  lib/POE/Component/Client/HTTP.pm M
+
+    Doc fix. Client::DNS is used by Client::Keepalive and is currently
+    not optional.
+
 =================================
 2008-12-09T06:22:46.753700Z v0_87
 =================================

Modified: trunk/libpoe-component-client-http-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/MANIFEST?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/MANIFEST (original)
+++ trunk/libpoe-component-client-http-perl/MANIFEST Sat Feb 21 13:47:30 2009
@@ -1,4 +1,4 @@
-# $Id: MANIFEST 336 2008-09-03 17:54:09Z martijn $
+# $Id: MANIFEST 360 2009-02-19 07:09:22Z rcaputo $
 CHANGES
 CHANGES.OLD
 MANIFEST
@@ -31,4 +31,5 @@
 t/54_hzheng_head_redir.t
 t/55_reiss_double_resp.t
 t/56_redirect_excess.t
+t/57_pravus_progress.t
 t/58_joel_cancel_multi.t

Modified: trunk/libpoe-component-client-http-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/META.yml?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/META.yml (original)
+++ trunk/libpoe-component-client-http-perl/META.yml Sat Feb 21 13:47:30 2009
@@ -1,26 +1,20 @@
 --- #YAML:1.0
-name:               POE-Component-Client-HTTP
-version:            0.87
-abstract:           Non-blocking/concurrent HTTP queries with POE
-author:
+name:                POE-Component-Client-HTTP
+version:             0.88
+abstract:            Non-blocking/concurrent HTTP queries with POE
+license:             perl
+author:              
     - Rocco Caputo <rcaputo at cpan.org>
-license:            perl
-distribution_type:  module
-configure_requires:
-    ExtUtils::MakeMaker:  0
-requires:
-    HTTP::Request:        1.3
-    HTTP::Response:       1.37
-    Net::HTTP::Methods:   0.02
-    POE:                  0.3202
-    POE::Component::Client::Keepalive:  0.25
-    Test::POE::Server::TCP:  0
-    URI:                  1.24
-no_index:
-    directory:
-        - t
-        - inc
-generated_by:       ExtUtils::MakeMaker version 6.48
+generated_by:        ExtUtils::MakeMaker version 6.42
+distribution_type:   module
+requires:     
+    HTTP::Request:                 1.3
+    HTTP::Response:                1.37
+    Net::HTTP::Methods:            0.02
+    POE:                           0.3202
+    POE::Component::Client::Keepalive: 0.25
+    Test::POE::Server::TCP:        0
+    URI:                           1.24
 meta-spec:
-    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
-    version:  1.4
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Modified: trunk/libpoe-component-client-http-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/debian/changelog?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/debian/changelog (original)
+++ trunk/libpoe-component-client-http-perl/debian/changelog Sat Feb 21 13:47:30 2009
@@ -1,3 +1,9 @@
+libpoe-component-client-http-perl (0.88-1) UNRELEASED; urgency=low
+
+  * (NOT RELEASED YET) New upstream release
+
+ -- Antonio Radici <antonio at dyne.org>  Sat, 21 Feb 2009 13:46:01 +0000
+
 libpoe-component-client-http-perl (0.87-1) UNRELEASED; urgency=low
 
   PROBLEM:

Modified: trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP.pm?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP.pm (original)
+++ trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP.pm Sat Feb 21 13:47:30 2009
@@ -1,4 +1,4 @@
-# $Id: HTTP.pm 351 2008-12-09 06:17:03Z rcaputo $
+# $Id: HTTP.pm 361 2009-02-19 07:14:19Z rcaputo $
 
 package POE::Component::Client::HTTP;
 
@@ -11,7 +11,7 @@
 use constant DEBUG_DATA => 0;
 
 use vars qw($VERSION);
-$VERSION = '0.87';
+$VERSION = '0.88';
 
 use Carp qw(croak);
 use HTTP::Response;
@@ -448,7 +448,7 @@
   );
 
   my $request = $heap->{request}->{$request_id};
-  
+
   # Read content to send from a callback
   if ( ref $request->[REQ_HTTP_REQUEST]->content() eq 'CODE' ) {
     my $callback = $request->[REQ_HTTP_REQUEST]->content();
@@ -467,7 +467,7 @@
       return;
     }
   }
-  
+
   $request->[REQ_STATE] ^= RS_SENDING;
   $request->[REQ_STATE] = RS_IN_HEAD;
   # XXX - Removed a second time.  The first time was in version 0.53,
@@ -492,79 +492,86 @@
   my $request_id = delete $heap->{wheel_to_request}->{$wheel_id};
   #K or die "!!!: unexpectedly undefined request ID" unless defined $request_id;
 
-  if ($request_id) {
-
-    DEBUG and warn "I/O: removing request $request_id";
-    my $request = delete $heap->{request}->{$request_id};
-    $request->remove_timeout;
-    delete $heap->{ext_request_to_int_id}{$request->[REQ_HTTP_REQUEST]};
-
-    # Otherwise the remote end simply closed.  If we've got a
-    # pending response, then post it back to the client.
-    DEBUG and warn "STATE is ", $request->[REQ_STATE];
-
-    # except when we're redirected
-    return if ($request->[REQ_STATE] & RS_REDIRECTED);
-
-    # If there was a non-zero error, then something bad happened.  Post
-    # an error response back, if we haven't posted anything before.
-    if ($errnum) {
-      unless ($request->[REQ_STATE] & RS_POSTED) {
-        $request->error(400, "$operation error $errnum: $errstr");
-      }
+  # There was no corresponding request?  Nothing left to do here.
+  return unless $request_id;
+
+  DEBUG and warn "I/O: removing request $request_id";
+  my $request = delete $heap->{request}->{$request_id};
+  $request->remove_timeout;
+  delete $heap->{ext_request_to_int_id}{$request->[REQ_HTTP_REQUEST]};
+
+  # Otherwise the remote end simply closed.  If we've got a pending
+  # response, then post it back to the client.
+  DEBUG and warn "STATE is ", $request->[REQ_STATE];
+
+  # Except when we're redirected.  In this case, the connection was but
+  # one step towards our destination.
+  return if ($request->[REQ_STATE] & RS_REDIRECTED);
+
+  # If there was a non-zero error, then something bad happened.  Post
+  # an error response back, if we haven't posted anything before.
+  if ($errnum) {
+    unless ($request->[REQ_STATE] & RS_POSTED) {
+      $request->error(400, "$operation error $errnum: $errstr");
+    }
+    return;
+  }
+
+  # We seem to have finished with the request.  Send back a response.
+  if (
+    $request->[REQ_STATE] & (RS_IN_CONTENT | RS_DONE) and
+    not $request->[REQ_STATE] & RS_POSTED
+  ) {
+    _finish_request($heap, $request, 0);
+    return;
+  }
+
+  # We have already posted a response, so this is a remote keepalive
+  # timeout or other delayed socket shutdown.  Nothing left to do.
+  if ($request->[REQ_STATE] & RS_POSTED) {
+    DEBUG and warn "I/O: Disconnect, remote keepalive timeout or HTTP/1.0.";
+    return;
+  }
+
+  # We never received a response.
+  if (not defined $request->[REQ_RESPONSE]) {
+    # Check for pending data indicating a LF-free HTTP 0.9 response.
+    my $lines = $request->wheel->get_input_filter()->get_pending();
+    my $text = join '' => @$lines;
+    DEBUG and warn "Got ", length($text), " bytes of data without LF.";
+
+    # If we have data, build and return a response from it.
+    if ($text =~ /\S/) {
+      DEBUG and warn(
+        "Generating HTTP response for HTTP/0.9 response without LF."
+      );
+      $request->[REQ_RESPONSE] = HTTP::Response->new(
+        200, 'OK', [ 'Content-Type' => 'text/html' ], $text
+      );
+      $request->[REQ_RESPONSE]->protocol('HTTP/0.9');
+      $request->[REQ_RESPONSE]->request($request->[REQ_HTTP_REQUEST]);
+      $request->[REQ_STATE] = RS_DONE;
+      $request->return_response;
       return;
     }
 
-    if (
-      $request->[REQ_STATE] & (RS_IN_CONTENT | RS_DONE) and
-      not $request->[REQ_STATE] & RS_POSTED
-    ) {
-      _finish_request($heap, $request, 0);
-      return;
-    }
-    elsif ($request->[REQ_STATE] & RS_POSTED) {
-      DEBUG and warn "I/O: Disconnect, remote keepalive timeout or HTTP/1.0.";
-      return;
-    }
-    elsif (not defined $request->[REQ_RESPONSE]) {
-      # never got a response, check for pending data indicating
-      # a LF-free HTTP 0.9 response
-      my $lines = $request->wheel->get_input_filter()->get_pending();
-      my $text = join '' => @$lines;
-      DEBUG and warn "Got ", length($text), " bytes of data without LF.";
-      if ($text =~ /\S/) {
-        # generate response
-        DEBUG and warn(
-          "Generating HTTP response for HTTP/0.9 response without LF."
-        );
-        $request->[REQ_RESPONSE] = HTTP::Response->new(
-          200, 'OK', [ 'Content-Type' => 'text/html' ], $text
-        );
-        $request->[REQ_RESPONSE]->protocol('HTTP/0.9');
-        $request->[REQ_RESPONSE]->request($request->[REQ_HTTP_REQUEST]);
-        $request->[REQ_STATE] = RS_DONE;
-        $request->return_response;
-        return;
-      } else {
-        unless ($request->[REQ_STATE] & RS_POSTED) {
-          $request->error(400, "incomplete response $request_id");
-          return;
-        }
-      }
-    }
-
-    # We haven't built a proper response.  Send back an error.
-    # Changed to 406 after considering rt.cpan.org 20975.
-    #
-    # 10.4.7 406 Not Acceptable
-    #
-    # The resource identified by the request is only capable of
-    # generating response entities which have content characteristics
-    # not acceptable according to the accept headers sent in the
-    # request.
-
-    $request->error(406, "Response larger than MaxSize - $request_id");
-  }
+    # No data received.  This is an incomplete response.
+    $request->error(400, "Incomplete response - $request_id");
+    return;
+  }
+
+  # We haven't built a proper response, and nothing returned by the
+  # server can be turned into a proper response.  Send back an error.
+  # Changed to 406 after considering rt.cpan.org 20975.
+  #
+  # 10.4.7 406 Not Acceptable
+  #
+  # The resource identified by the request is only capable of
+  # generating response entities which have content characteristics
+  # not acceptable according to the accept headers sent in the
+  # request.
+
+  $request->error(406, "Server response is Not Acceptable - $request_id");
 }
 
 # }}} _poco_weeble_io_error
@@ -1039,9 +1046,9 @@
 other sessions run while HTTP transactions are being processed, and it
 lets several HTTP transactions be processed in parallel.
 
-If POE::Component::Client::DNS is also installed, Client::HTTP will
-use it to resolve hosts without blocking.  Otherwise it will use
-gethostbyname(), which may have performance problems.
+It supports keep-alive through POE::Component::Client::Keepalive,
+which in turn uses POE::Component::Client::DNS for asynchronous name
+resolution.
 
 HTTP client components are not proper objects.  Instead of being
 created, as most objects are, they are "spawned" as separate sessions.
@@ -1207,8 +1214,48 @@
 
 =item Timeout => $query_timeout
 
-C<Timeout> specifies the amount of time a HTTP request will wait for
-an answer.  This defaults to 180 seconds (three minutes).
+C<Timeout> sets how long POE::Component::Client::HTTP has to process
+an application's request, in seconds.  C<Timeout> defaults to 180
+(three minutes) if not specified.
+
+It's important to note that the timeout begins when the component
+receives an application's request, not when it attempts to connect to
+the web server.
+
+Timeouts may result from sending the component too many requests at
+once.  Each request would need to be received and tracked in order.
+Consider this:
+
+  $_[KERNEL]->post(component => request => ...) for (1..15_000);
+
+15,000 requests are queued together in one enormous bolus.  The
+component would receive and initialize them in order.  The first
+socket activity wouldn't arrive until the 15,000th request was set up.
+If that took longer than C<Timeout>, then the requests that have
+waited too long would fail.
+
+C<ConnectionManager>'s own timeout and concurrency limits also affect
+how many requests may be processed at once.  For example, most of the
+15,000 requests would wait in the connection manager's pool until
+sockets become available.  Meanwhile, the C<Timeout> would be counting
+down.
+
+Applications may elect to control concurrency outside the component's
+C<Timeout>.  They may do so in a few ways.
+
+The easiest way is to limit the initial number of requests to
+something more manageable.  As responses arrive, the application
+should handle them and start new requests.  This limits concurrency to
+the initial request count.
+
+An application may also outsource job throttling to another module,
+such as POE::Component::JobQueue.
+
+In any case, C<Timeout> and C<ConnectionManager> may be tuned to
+maximize timeouts and concurrency limits.  This may help in some
+cases.  Developers should be aware that doing so will increase memory
+usage.  POE::Component::Client::HTTP and KeepAlive track requests in
+memory, while applications are free to keep pending requests on disk.
 
 =back
 
@@ -1330,11 +1377,11 @@
 to set the Content-Length header correctly.  Example:
 
   my $request = HTTP::Request->new( PUT => 'http://...' );
-  
+
   my $file = '/path/to/large_file';
-  
+
   open my $fh, '<', $file;
-  
+
   my $upload_cb = sub {
     if ( sysread $fh, my $buf, 4096 ) {
       return $buf;
@@ -1344,11 +1391,11 @@
       return '';
     }
   };
-  
+
   $request->content_length( -s $file );
-  
+
   $request->content( $upload_cb );
-  
+
   $kernel->post( ua => request, 'response', $request );
 
 =head1 CONTENT ENCODING AND COMPRESSION
@@ -1367,7 +1414,7 @@
   );
 
   # ... time passes ...
-  
+
   my $content = $response->decoded_content();
 
 The change in POE::Component::Client::HTTP behavior was prompted by
@@ -1414,7 +1461,7 @@
 L<POE::Component::Client::Keepalive> and
 L<POE::Component::Client::DNS> for examples of a decent OO interface.
 
-=head1 AUTHOR, COPYRIGHT, & LICENSE 
+=head1 AUTHOR, COPYRIGHT, & LICENSE
 
 POE::Component::Client::HTTP is
 
@@ -1460,3 +1507,4 @@
 =cut
 
 # }}} POD
+# rocco // vim: ts=2 sw=2 expandtab

Modified: trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP/Request.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP/Request.pm?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP/Request.pm (original)
+++ trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP/Request.pm Sat Feb 21 13:47:30 2009
@@ -1,4 +1,4 @@
-# $Id: Request.pm 344 2008-12-08 07:23:22Z rcaputo $
+# $Id: Request.pm 359 2009-02-19 05:20:37Z rcaputo $
 
 package POE::Component::Client::HTTP::Request;
 use strict;
@@ -42,14 +42,13 @@
 use constant REQ_FACTORY       => 16;
 use constant REQ_CONN_ID       => 17;
 
-use constant RS_CONNECT        => 0x01;
-use constant RS_SENDING        => 0x02;
-use constant RS_IN_HEAD        => 0x04;
-use constant RS_REDIRECTED     => 0x08;
-use constant RS_IN_CONTENT     => 0x20;
-use constant RS_DONE           => 0x40;
-use constant RS_POSTED         => 0x80;
-
+use constant RS_CONNECT        => 0x01; # establishing a connection
+use constant RS_SENDING        => 0x02; # sending request to server
+use constant RS_IN_HEAD        => 0x04; # waiting for or receiving headers
+use constant RS_REDIRECTED     => 0x08; # request has been redirected
+use constant RS_IN_CONTENT     => 0x20; # waiting for or receiving content
+use constant RS_DONE           => 0x40; # received full content
+use constant RS_POSTED         => 0x80; # we have posted back a response
 
 sub import {
   my ($class) = shift;

Modified: trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP/RequestFactory.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP/RequestFactory.pm?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP/RequestFactory.pm (original)
+++ trunk/libpoe-component-client-http-perl/lib/POE/Component/Client/HTTP/RequestFactory.pm Sat Feb 21 13:47:30 2009
@@ -1,4 +1,4 @@
-# $Id: RequestFactory.pm 348 2008-12-09 05:29:27Z rcaputo $
+# $Id: RequestFactory.pm 360 2009-02-19 07:09:22Z rcaputo $
 
 package POE::Component::Client::HTTP::RequestFactory;
 use strict;
@@ -265,11 +265,19 @@
   # Create a progress postback if requested.
   my $progress_postback;
   if (defined $progress_event) {
-    $progress_postback = $sender->postback(
-      $progress_event,
-      $http_request,
-      $tag
-    );
+    if (ref $progress_event) {
+      # The given progress event appears to already
+      # be a postback, so use it.  This is needed to
+      # propagate the postback through redirects.
+      $progress_postback = $progress_event;
+    }
+    else {
+      $progress_postback = $sender->postback(
+        $progress_event,
+        $http_request,
+        $tag
+      );
+    }
   }
 
   # If we have a cookie jar, have it add the appropriate headers.
@@ -306,7 +314,7 @@
     Request => $http_request,
     Proxy => $proxy,
     Postback => $postback,
-    Tag => $tag,
+    #Tag => $tag, # TODO - Is this needed for anything?
     Progress => $progress_postback,
     Factory => $self,
   );

Modified: trunk/libpoe-component-client-http-perl/lib/POE/Filter/HTTPChunk.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/lib/POE/Filter/HTTPChunk.pm?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/lib/POE/Filter/HTTPChunk.pm (original)
+++ trunk/libpoe-component-client-http-perl/lib/POE/Filter/HTTPChunk.pm Sat Feb 21 13:47:30 2009
@@ -1,4 +1,4 @@
-# $Id: HTTPChunk.pm 320 2008-04-19 22:46:23Z rcaputo $
+# $Id: HTTPChunk.pm 354 2009-02-18 06:19:51Z rcaputo $
 
 package POE::Filter::HTTPChunk;
 use warnings;
@@ -167,7 +167,12 @@
         unshift (@{$self->[FRAMING_BUFFER]}, $chunk) if (length $chunk);
         return $retval;
       }
-      unshift (@{$self->[FRAMING_BUFFER]}, $chunk);
+      if (@{$self->[FRAMING_BUFFER]}) {
+          $self->[FRAMING_BUFFER]->[0] = $chunk . $self->[FRAMING_BUFFER]->[0];
+      } else {
+          unshift (@{$self->[FRAMING_BUFFER]}, $chunk);
+          return $retval;
+      }
     }
   }
   return $retval;

Modified: trunk/libpoe-component-client-http-perl/t/01_request.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/t/01_request.t?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/t/01_request.t (original)
+++ trunk/libpoe-component-client-http-perl/t/01_request.t Sat Feb 21 13:47:30 2009
@@ -39,7 +39,7 @@
 POE::Component::Client::HTTP->spawn(
   #MaxSize => MAX_BIG_REQUEST_SIZE,
   MaxSize => 200,
-  Timeout => 1,
+  Timeout => 3,
   #Protocol => 'HTTP/1.1', #default
   #ConnectionManager => $cm, #default
 );
@@ -120,7 +120,7 @@
   elsif ($buffer =~ /^GET \/timeout/) {
     pass("got test request we will let timeout");
     $heap->{input_buffer} = "";
-    $kernel->delay_add('send_after_timeout', 1.1, $id);
+    $kernel->delay_add('send_after_timeout', 3.3, $id);
   }
   elsif ($buffer =~ /^POST \/post1.*field.*field/s) {
     pass("got post request with content");

Modified: trunk/libpoe-component-client-http-perl/t/02_keepalive.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/t/02_keepalive.t?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/t/02_keepalive.t (original)
+++ trunk/libpoe-component-client-http-perl/t/02_keepalive.t Sat Feb 21 13:47:30 2009
@@ -1,4 +1,4 @@
-# $Id: 02_keepalive.t 336 2008-09-03 17:54:09Z martijn $
+# $Id: 02_keepalive.t 354 2009-02-18 06:19:51Z rcaputo $
 # vim: filetype=perl sts=2 sw=2
 use strict;
 
@@ -97,11 +97,11 @@
   if ($input =~ /Close/) {
     $heap->{testd}->disconnect($id);
     $heap->{prevtype} = 'close';
-    my $tosend =~ s/CONNECTION/$cl/;
+    $tosend =~ s/CONNECTION/$cl/;
   } else {
     $kernel->delay('timeout', 2, $id);
     $heap->{prevtype} = 'reuse';
-    my $tosend =~ s/CONNECTION/$ka/;
+    $tosend =~ s/CONNECTION/$ka/;
   }
   $heap->{previd} = $id;
   $heap->{testd}->send_to_client($id, $tosend);

Modified: trunk/libpoe-component-client-http-perl/t/04_chunk_filter.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/t/04_chunk_filter.t?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/t/04_chunk_filter.t (original)
+++ trunk/libpoe-component-client-http-perl/t/04_chunk_filter.t Sat Feb 21 13:47:30 2009
@@ -1,4 +1,4 @@
-# $Id: 04_chunk_filter.t 332 2008-07-09 19:44:56Z martijn $
+# $Id: 04_chunk_filter.t 354 2009-02-18 06:19:51Z rcaputo $
 # vim: filetype=perl ts=2 sw=2 expandtab
 
 use strict;
@@ -9,7 +9,7 @@
 
 sub DEBUG () { 0 }
 
-plan tests => 18;
+plan tests => 20;
 
 use_ok ('POE::Filter::HTTPChunk');
 
@@ -173,3 +173,14 @@
   my $pending = $filter->get_pending;
   is (shift @$pending, 'garbage', "got expected pending data");
 }
+{ # extra-extra garbage at the end gets retrieved by get_pending()
+  my @input = ("9\nchunk_333\nA\nchunk_4444\n", "0\n", "7\ngarbage\n", "0\n");
+  my $filter = POE::Filter::HTTPChunk->new;
+  $filter->get_one_start( \@input );
+
+  my $output = $filter->get_one();
+  is_deeply($output, [qw/chunk_333 chunk_4444/], "got expected chunks");
+
+  my $pending = $filter->get_pending;
+  is_deeply($pending, ["7\ngarbage\n0\n"], "got expected pending data");
+}

Modified: trunk/libpoe-component-client-http-perl/t/10_shutdown.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/t/10_shutdown.t?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/t/10_shutdown.t (original)
+++ trunk/libpoe-component-client-http-perl/t/10_shutdown.t Sat Feb 21 13:47:30 2009
@@ -1,18 +1,17 @@
 #!/usr/bin/perl -w
-# $Id: 10_shutdown.t 336 2008-09-03 17:54:09Z martijn $
+# $Id: 10_shutdown.t 354 2009-02-18 06:19:51Z rcaputo $
 # vim: filetype=perl
 
 use strict;
+
+sub DEBUG () { 0 }
+sub POE::Kernel::ASSERT_DEFAULT () { DEBUG }
 
 use HTTP::Request::Common qw(GET);
 use Test::More;
 use Test::POE::Server::TCP;
 
-sub DEBUG () { 0 }
-sub POE::Kernel::ASSERT_DEFAULT () { DEBUG }
-
 use POE qw(Component::Client::HTTP);
-
 
 plan tests => 2;
 

Modified: trunk/libpoe-component-client-http-perl/t/11_cancel.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-http-perl/t/11_cancel.t?rev=30962&op=diff
==============================================================================
--- trunk/libpoe-component-client-http-perl/t/11_cancel.t (original)
+++ trunk/libpoe-component-client-http-perl/t/11_cancel.t Sat Feb 21 13:47:30 2009
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# $Id: 11_cancel.t 350 2008-12-09 06:10:50Z rcaputo $
+# $Id: 11_cancel.t 354 2009-02-18 06:19:51Z rcaputo $
 # vim: filetype=perl
 
 use strict;
@@ -121,11 +121,13 @@
     my $response_string = $http_headers->as_string();
     $response_string =~ s/^/| /mg;
 
-    warn ",", '-' x 78, "\n";
-    warn $response_string;
-    warn "`", '-' x 78, "\n";
-    warn ($chunk ? $chunk : "(undef)"), "\n";
-    warn "`", '-' x 78, "\n";
+    warn (
+      ",", '-' x 78, "\n",
+      $response_string,
+      "`", '-' x 78, "\n",
+      ($chunk ? $chunk : "(undef)"), "\n",
+      "`", '-' x 78, "\n",
+    );
   };
 
   if (defined $chunk) {




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