[Bps-public-commit] lwp-useragent-determined branch, master, updated. 1.05-13-g69b5edb

Alex Vandiver alexmv at bestpractical.com
Tue Jun 24 16:26:20 EDT 2014


The branch, master has been updated
       via  69b5edb627c54f19ce4c1e3103e3aeb7b66b81fb (commit)
       via  8ec526a0c55f4c7c978e5dc1c9950b4b44dd71e0 (commit)
       via  c8ce665893bbd28dbd76ad513403f825dfcdc7f6 (commit)
      from  de4b3cfb664c93a54056b3c004dc81bedf9ef4d0 (commit)

Summary of changes:
 ChangeLog                       | 33 +++++++--------
 MANIFEST                        |  1 -
 MANIFEST.SKIP                   |  8 ----
 lib/LWP/UserAgent/Determined.pm | 89 ++++++++++++++++++++++-------------------
 4 files changed, 65 insertions(+), 66 deletions(-)
 delete mode 100644 MANIFEST.SKIP

- Log -----------------------------------------------------------------
commit c8ce665893bbd28dbd76ad513403f825dfcdc7f6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 24 15:42:52 2014 -0400

    perltidy and whitespace cleanup

diff --git a/lib/LWP/UserAgent/Determined.pm b/lib/LWP/UserAgent/Determined.pm
index 1bee07d..8d9f0f2 100644
--- a/lib/LWP/UserAgent/Determined.pm
+++ b/lib/LWP/UserAgent/Determined.pm
@@ -8,63 +8,67 @@ use      LWP::UserAgent ();
 use strict;
 die "Where's _elem?!!?" unless __PACKAGE__->can('_elem');
 
-sub timing                { shift->_elem('timing' , @_) }
-sub codes_to_determinate  { shift->_elem('codes_to_determinate' , @_) }
+sub timing                     { shift->_elem('timing' , @_) }
+sub codes_to_determinate       { shift->_elem('codes_to_determinate' , @_) }
 sub before_determined_callback { shift->_elem('before_determined_callback' , @_) }
-sub  after_determined_callback { shift->_elem( 'after_determined_callback' , @_) }
+sub after_determined_callback  { shift->_elem( 'after_determined_callback' , @_) }
 
 #==========================================================================
 
 sub simple_request {
-  my($self, @args) = @_;
-  my(@timing_tries) = ( $self->timing() =~ m<(\d+(?:\.\d+)*)>g );
-  my $determination = $self->codes_to_determinate();
-
-  my $resp;
-  my $before_c = $self->before_determined_callback;
-  my $after_c  = $self->after_determined_callback;
-  foreach my $pause_if_unsuccessful (@timing_tries, undef) {
-    
-    $before_c and $before_c->(
-      $self, \@timing_tries, $pause_if_unsuccessful, $determination, \@args);
-    $resp = $self->SUPER::simple_request(@args);
-    $after_c and $after_c->(
-      $self, \@timing_tries, $pause_if_unsuccessful, $determination, \@args, $resp);
-
-    my $code = $resp->code;
-    unless( $determination->{$code} ) { # normal case: all is well (or 404, etc)
-      return $resp;
+    my ( $self, @args ) = @_;
+    my (@timing_tries) = ( $self->timing() =~ m<(\d+(?:\.\d+)*)>g );
+    my $determination = $self->codes_to_determinate();
+
+    my $resp;
+    my $before_c = $self->before_determined_callback;
+    my $after_c  = $self->after_determined_callback;
+    foreach my $pause_if_unsuccessful ( @timing_tries, undef ) {
+        $before_c and $before_c->(
+            $self, \@timing_tries, $pause_if_unsuccessful, $determination,
+            \@args
+        );
+        $resp = $self->SUPER::simple_request(@args);
+        $after_c and $after_c->(
+            $self, \@timing_tries, $pause_if_unsuccessful, $determination,
+            \@args, $resp
+        );
+
+        my $code = $resp->code;
+        unless ( $determination->{$code} ) {
+            # normal case: all is well (or 404, etc)
+            return $resp;
+        }
+        if ( defined $pause_if_unsuccessful ) {
+            # it's undef only on the last
+            sleep $pause_if_unsuccessful if $pause_if_unsuccessful;
+        }
     }
-    if(defined $pause_if_unsuccessful) { # it's undef only on the last
 
-      sleep $pause_if_unsuccessful if $pause_if_unsuccessful;
-    }
-  }
-  
-  return $resp;
+    return $resp;
 }
 
 #--------------------------------------------------------------------------
 
 sub new {
-  my $self = shift->SUPER::new(@_);
-  $self->_determined_init();
-  return $self;
+    my $self = shift->SUPER::new(@_);
+    $self->_determined_init();
+    return $self;
 }
 
 #--------------------------------------------------------------------------
 
 sub _determined_init {
-  my $self = shift;
-  $self->timing( '1,3,15' );
-  $self->codes_to_determinate( { map { $_=>1 }
-   '408', # Request Timeout
-   '500', # Internal Server Error
-   '502', # Bad Gateway
-   '503', # Service Unavailable
-   '504', # Gateway Timeout
-  } );
-  return;
+    my $self = shift;
+    $self->timing('1,3,15');
+    $self->codes_to_determinate( { map { $_ => 1 }
+        '408', # Request Timeout
+        '500', # Internal Server Error
+        '502', # Bad Gateway
+        '503', # Service Unavailable
+        '504', # Gateway Timeout
+    } );
+    return;
 }
 
 #==========================================================================

commit 8ec526a0c55f4c7c978e5dc1c9950b4b44dd71e0
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 24 16:11:38 2014 -0400

    Ensure that the request does not change across requests
    
    This prevents the standard cookie headers from being added more than once.
    
    Fixes rt.cpan.org #96497

diff --git a/lib/LWP/UserAgent/Determined.pm b/lib/LWP/UserAgent/Determined.pm
index 8d9f0f2..e45425b 100644
--- a/lib/LWP/UserAgent/Determined.pm
+++ b/lib/LWP/UserAgent/Determined.pm
@@ -23,7 +23,10 @@ sub simple_request {
     my $resp;
     my $before_c = $self->before_determined_callback;
     my $after_c  = $self->after_determined_callback;
+
+    my $request = $args[0];
     foreach my $pause_if_unsuccessful ( @timing_tries, undef ) {
+        $args[0] = $request->clone;
         $before_c and $before_c->(
             $self, \@timing_tries, $pause_if_unsuccessful, $determination,
             \@args

commit 69b5edb627c54f19ce4c1e3103e3aeb7b66b81fb
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 24 16:25:45 2014 -0400

    Version 1.07

diff --git a/ChangeLog b/ChangeLog
index 4a20433..7ebce4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,22 +1,23 @@
 Revision history for Perl extension LWP::Determined::UserAgent
 
-2012.05-20 Jesse Vincent <jesse at cpan.org>
-	* Release 1.06
-	* Mock http responses to avoid unnecessary network requests -- Randy Stauner
+1.07 2014-06-24
+ - Prevent changes to request object (such as Cookie headers) from being
+   added once for each request [cpan #96497]
 
-2011-01-03 Jesse Vincent <jesse at cpan.org>
-    * Release 1.05
-    * Fix for RT#55591: Incorrect default value for 'codes_to_determinate'
-	  from yibe via github.
+1.06 2012.05-20
+ - Mock http responses to avoid unnecessary network requests -- Randy
+   Stauner
 
-2009-04-04 Jesse Vincent <jesse at cpan.org>
-	* Release 1.04 -- Keeping pace with LWP updates
-	* New Maintainer
-	* Resolves [cpan #42123] and [cpan #41508]
+1.05 2011-01-03
+ - Fix for RT#55591: Incorrect default value for 'codes_to_determinate'
+   from yibe via github.
 
+1.04 2009-04-04
+ - New Maintainer (Jesse vincent)
+ - Resolves [cpan #42123] and [cpan #41508]
 
-2004-04-08  Sean M. Burke  sburke at cpan.org
-	* Release 1.03 -- just a doc-typo bugfix version.
-	
-2004-04-07  Sean M. Burke  sburke at cpan.org
-	* Release 1.02 -- First public release.
+1.03 2004-04-08
+ - Doc-typo bugfix
+
+1.02 2004-04-07
+ - First public release
diff --git a/MANIFEST b/MANIFEST
index 13fbd41..e1d70eb 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2,7 +2,6 @@ ChangeLog
 lib/LWP/UserAgent/Determined.pm
 Makefile.PL
 MANIFEST
-MANIFEST.SKIP
 README
 t/01_about_verbose.t
 t/10_determined_test.t
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
deleted file mode 100644
index c8c9c48..0000000
--- a/MANIFEST.SKIP
+++ /dev/null
@@ -1,8 +0,0 @@
-^MANIFEST\.bak$
-^[-_a-zA-Z0-9]+[0-9]+\.[0-9]+(?:_[0-9]+)?$
-Makefile(\.old)?$
-t/.*.rtf$
-\.rej$
-CVS
-blib
-~
diff --git a/lib/LWP/UserAgent/Determined.pm b/lib/LWP/UserAgent/Determined.pm
index e45425b..8484940 100644
--- a/lib/LWP/UserAgent/Determined.pm
+++ b/lib/LWP/UserAgent/Determined.pm
@@ -1,7 +1,7 @@
 
 package LWP::UserAgent::Determined;
 
-$VERSION = '1.06';
+$VERSION = '1.07';
 use      LWP::UserAgent ();
 @ISA = ('LWP::UserAgent');
 

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list