[Bps-public-commit] plient branch, master, updated. 107e3c2d111e0b29a856bfec461f46e7ee568ddb

? sunnavy sunnavy at bestpractical.com
Tue Apr 12 06:00:01 EDT 2011


The branch, master has been updated
       via  107e3c2d111e0b29a856bfec461f46e7ee568ddb (commit)
       via  35cdd6a372669eb446604691d358d1a6f390445a (commit)
      from  13e32bc84e7a70313fb9401e82d3687b3731fe0f (commit)

Summary of changes:
 lib/Plient.pm              |    4 ++++
 lib/Plient/Handler/curl.pm |    9 ++++++---
 lib/Plient/Handler/wget.pm |    6 +++---
 3 files changed, 13 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit 35cdd6a372669eb446604691d358d1a6f390445a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sun Nov 21 10:28:12 2010 +0800

    add PLIENT_DEBUG env

diff --git a/lib/Plient.pm b/lib/Plient.pm
index ea574bf..afcfe4c 100644
--- a/lib/Plient.pm
+++ b/lib/Plient.pm
@@ -385,6 +385,10 @@ Digest Authentication.
 
 =over 4
 
+=item PLIENT_DEBUG
+
+show more debug info if this it true.
+
 =item PLIENT_CURL
 
 curl's path, if not specified, use the one `which curl` returns
diff --git a/lib/Plient/Handler/curl.pm b/lib/Plient/Handler/curl.pm
index b117ea2..1d73f06 100644
--- a/lib/Plient/Handler/curl.pm
+++ b/lib/Plient/Handler/curl.pm
@@ -42,6 +42,7 @@ sub init {
             my ( $uri, $args ) = @_;
             my $headers = translate_headers( $args );
             my $auth    = translate_auth($args);
+            warn "$curl -k -s -L $headers $auth $uri\n" if $ENV{PLIENT_DEBUG};
             if ( open my $fh, "$curl -k -s -L $headers $auth $uri |" ) {
                 local $/;
                 <$fh>;
@@ -87,6 +88,7 @@ sub init {
                 }
             }
 
+            warn "$curl -s -L $data $headers $auth $uri\n" if $ENV{PLIENT_DEBUG};
             if ( open my $fh, "$curl -s -L $data $headers $auth $uri |" ) {
                 local $/;
                 <$fh>;
@@ -100,6 +102,7 @@ sub init {
             my ( $uri, $args ) = @_;
             my $headers = translate_headers( $args );
             my $auth    = translate_auth($args);
+            warn "$curl -s -I -L $headers $auth $uri\n" if $ENV{PLIENT_DEBUG};
             if ( open my $fh, "$curl -s -I -L $headers $auth $uri |" ) {
                 local $/;
                 my $head = <$fh>;

commit 107e3c2d111e0b29a856bfec461f46e7ee568ddb
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sun Nov 21 14:01:03 2010 +0800

    quote $uri to avid special chars

diff --git a/lib/Plient/Handler/curl.pm b/lib/Plient/Handler/curl.pm
index 1d73f06..7b52b45 100644
--- a/lib/Plient/Handler/curl.pm
+++ b/lib/Plient/Handler/curl.pm
@@ -43,7 +43,7 @@ sub init {
             my $headers = translate_headers( $args );
             my $auth    = translate_auth($args);
             warn "$curl -k -s -L $headers $auth $uri\n" if $ENV{PLIENT_DEBUG};
-            if ( open my $fh, "$curl -k -s -L $headers $auth $uri |" ) {
+            if ( open my $fh, "$curl -k -s -L $headers $auth '$uri' |" ) {
                 local $/;
                 <$fh>;
             }
@@ -89,7 +89,7 @@ sub init {
             }
 
             warn "$curl -s -L $data $headers $auth $uri\n" if $ENV{PLIENT_DEBUG};
-            if ( open my $fh, "$curl -s -L $data $headers $auth $uri |" ) {
+            if ( open my $fh, "$curl -s -L $data $headers $auth '$uri' |" ) {
                 local $/;
                 <$fh>;
             }
@@ -103,7 +103,7 @@ sub init {
             my $headers = translate_headers( $args );
             my $auth    = translate_auth($args);
             warn "$curl -s -I -L $headers $auth $uri\n" if $ENV{PLIENT_DEBUG};
-            if ( open my $fh, "$curl -s -I -L $headers $auth $uri |" ) {
+            if ( open my $fh, "$curl -s -I -L $headers $auth '$uri' |" ) {
                 local $/;
                 my $head = <$fh>;
                 $head =~ s/\r\n$//;
diff --git a/lib/Plient/Handler/wget.pm b/lib/Plient/Handler/wget.pm
index 6fec8cb..1af7d2c 100644
--- a/lib/Plient/Handler/wget.pm
+++ b/lib/Plient/Handler/wget.pm
@@ -51,7 +51,7 @@ sub init {
         my ( $uri, $args ) = @_;
         my $headers = translate_headers( $args );
         my $auth    = translate_auth($args);
-        if ( open my $fh, "$wget -q -O - $headers $auth $uri |" ) {
+        if ( open my $fh, "$wget -q -O - $headers $auth '$uri' |" ) {
             local $/;
             <$fh>;
         }
@@ -77,7 +77,7 @@ sub init {
             }
         }
 
-        if ( open my $fh, "$wget -q -O - $data $headers $auth $uri |" ) {
+        if ( open my $fh, "$wget -q -O - $data $headers $auth '$uri' |" ) {
             local $/;
             <$fh>;
         }
@@ -92,7 +92,7 @@ sub init {
         # we can't use -q here, or some version may not show the header
         my $headers = translate_headers( $args );
         my $auth    = translate_auth($args);
-        if ( open my $fh, "$wget -S --spider $headers $auth $uri 2>&1 |" ) {
+        if ( open my $fh, "$wget -S --spider $headers $auth '$uri' 2>&1 |" ) {
             my $head = '';
             my $flag;
             while ( my $line = <$fh>) {

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



More information about the Bps-public-commit mailing list