[Bps-public-commit] plient branch, master, updated. fa20c641876fb78e5807849d9d110ddeea47de76
? sunnavy
sunnavy at bestpractical.com
Mon Apr 19 10:37:59 EDT 2010
The branch, master has been updated
via fa20c641876fb78e5807849d9d110ddeea47de76 (commit)
from 168c8d06158ae344af43ada16d6f9aafc54b36f0 (commit)
Summary of changes:
lib/Plient/Handler/wget.pm | 36 +++++++++++++++---------------------
1 files changed, 15 insertions(+), 21 deletions(-)
- Log -----------------------------------------------------------------
commit fa20c641876fb78e5807849d9d110ddeea47de76
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Apr 16 06:07:31 2010 +0800
no elegant way to find if https is supported in wget, enable it for now
diff --git a/lib/Plient/Handler/wget.pm b/lib/Plient/Handler/wget.pm
index 58b70c6..eb2f5b9 100644
--- a/lib/Plient/Handler/wget.pm
+++ b/lib/Plient/Handler/wget.pm
@@ -7,12 +7,11 @@ use Plient::Util 'which';
my ( $wget, %protocol, %all_protocol, %method );
-%all_protocol =
- map { $_ => undef } qw/http https ftp/;
sub all_protocol { return \%all_protocol }
#XXX TODO get the real protocols wget supports
- at protocol{qw/http https ftp/} = ();
+# too sad that there's no wget-config stuff
+ at all_protocol{qw/http https ftp/} = ();
sub protocol { return \%protocol }
sub method { return \%method }
@@ -22,25 +21,20 @@ sub init {
return if $inited;
$inited = 1;
- $wget = $ENV{PLIENT_WGET} || which('wget');
+ $wget = $ENV{PLIENT_WGET} || which('wget');
return unless $wget;
-
- if ( exists $protocol{http} ) {
- $method{http_get} = sub {
- my ( $uri, $args ) = @_;
- if ( open my $fh, "$wget -q -O - $uri |" ) {
- local $/;
- <$fh>;
- }
- else {
- warn "failed to get $uri with wget: $!";
- return;
- }
- };
- }
-
- # have you seen https is available while http is not?
- $method{https_get} = $method{http_get} if exists $protocol{https};
+ @protocol{qw/http https ftp/} = ();
+ $method{http_get} = $method{https_get} = sub {
+ my ( $uri, $args ) = @_;
+ if ( open my $fh, "$wget -q -O - $uri |" ) {
+ local $/;
+ <$fh>;
+ }
+ else {
+ warn "failed to get $uri with wget: $!";
+ return;
+ }
+ };
return 1;
}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list