[Bps-public-commit] plient branch, master, updated. 7c12af7741eb7846415a542f5d1754d855ba5464

? sunnavy sunnavy at bestpractical.com
Tue May 4 04:39:53 EDT 2010


The branch, master has been updated
       via  7c12af7741eb7846415a542f5d1754d855ba5464 (commit)
      from  f16175bed2e400893e967c1283b65cab45cdf691 (commit)

Summary of changes:
 lib/Plient/Handler.pm          |    8 +++-----
 lib/Plient/Handler/HTTPLite.pm |   12 ++++++++++++
 lib/Plient/Handler/wget.pm     |   12 ++++++++++++
 3 files changed, 27 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 7c12af7741eb7846415a542f5d1754d855ba5464
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue May 4 16:40:03 2010 +0800

    declare that wget and HTTPLite do *not* support form-data

diff --git a/lib/Plient/Handler.pm b/lib/Plient/Handler.pm
index 1fbf627..affc28f 100644
--- a/lib/Plient/Handler.pm
+++ b/lib/Plient/Handler.pm
@@ -20,12 +20,10 @@ sub support_protocol {
     exists $class->protocol->{$protocol};
 }
 
+# subclass this method to check $args if
+# the handler is not *full fledged*
 sub support_method {
-    my $class = shift;
-    my $method = shift;
-    # TODO we should check args to do more serioud check
-    # e.g. proxy, auth, etc.
-    my $args = shift;
+    my ( $class, $method, $args ) = @_;
     $class->method->{ $method };
 }
 
diff --git a/lib/Plient/Handler/HTTPLite.pm b/lib/Plient/Handler/HTTPLite.pm
index c08e3c0..d5d86f5 100644
--- a/lib/Plient/Handler/HTTPLite.pm
+++ b/lib/Plient/Handler/HTTPLite.pm
@@ -11,6 +11,18 @@ sub all_protocol { return \%all_protocol }
 sub protocol { return \%protocol }
 sub method { return \%method }
 
+sub support_method {
+    my ( $class, $method, $args ) = @_;
+    if (   $args
+        && $args->{content_type}
+        && $args->{content_type} =~ 'form-data' )
+    {
+        return;
+    }
+
+    return $class->SUPER::support_method(@_);
+}
+
 my $inited;
 sub init {
     return if $inited;
diff --git a/lib/Plient/Handler/wget.pm b/lib/Plient/Handler/wget.pm
index fb39822..51dc276 100644
--- a/lib/Plient/Handler/wget.pm
+++ b/lib/Plient/Handler/wget.pm
@@ -17,6 +17,18 @@ sub all_protocol { return \%all_protocol }
 sub protocol { return \%protocol }
 sub method { return \%method }
 
+sub support_method {
+    my ( $class, $method, $args ) = @_;
+    if (   $args
+        && $args->{content_type}
+        && $args->{content_type} =~ 'form-data' )
+    {
+        return;
+    }
+
+    return $class->SUPER::support_method(@_);
+}
+
 my $inited;
 sub init {
     return if $inited;

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



More information about the Bps-public-commit mailing list