Unverified Commit 8947e129 authored by Magali Ruffier's avatar Magali Ruffier Committed by GitHub
Browse files

Merge pull request #71 from Ensembl/master_ftp_support

porting of PR 70 to master
parents 85a3c136 a3c68272
...@@ -65,7 +65,7 @@ sub chase_redirects { ...@@ -65,7 +65,7 @@ sub chase_redirects {
my $ua = LWP::UserAgent->new( max_redirect => $args->{'max_follow'} ); my $ua = LWP::UserAgent->new( max_redirect => $args->{'max_follow'} );
$ua->timeout(10); $ua->timeout(10);
$ua->env_proxy; $ua->env_proxy;
$ua->proxy([qw(http https)], $proxy) || (); $ua->proxy([qw(http https ftp)], $proxy) || ();
my $response = $ua->head($url); my $response = $ua->head($url);
if ($response->is_success) { if ($response->is_success) {
return $response->request->uri->as_string; return $response->request->uri->as_string;
...@@ -140,7 +140,7 @@ sub file_exists { ...@@ -140,7 +140,7 @@ sub file_exists {
my $ua = LWP::UserAgent->new(); my $ua = LWP::UserAgent->new();
$ua->timeout(10); $ua->timeout(10);
$ua->env_proxy; $ua->env_proxy;
$ua->proxy([qw(http https)], $proxy) || (); $ua->proxy([qw(http https ftp)], $proxy) || ();
my $response = $ua->head($url); my $response = $ua->head($url);
unless ($response->is_success) { unless ($response->is_success) {
$error = _get_lwp_useragent_error($response); $error = _get_lwp_useragent_error($response);
...@@ -213,7 +213,7 @@ sub read_file { ...@@ -213,7 +213,7 @@ sub read_file {
my $ua = LWP::UserAgent->new(); my $ua = LWP::UserAgent->new();
$ua->timeout(10); $ua->timeout(10);
$ua->env_proxy; $ua->env_proxy;
$ua->proxy([qw(http https)], $proxy) || (); $ua->proxy([qw(http https ftp)], $proxy) || ();
my $response = $ua->$method($url, %{$args->{'headers'}}); my $response = $ua->$method($url, %{$args->{'headers'}});
if ($response->is_success) { if ($response->is_success) {
$content = $response->content; $content = $response->content;
...@@ -337,7 +337,7 @@ sub fetch_file { ...@@ -337,7 +337,7 @@ sub fetch_file {
$ua->timeout(10); $ua->timeout(10);
$ua->env_proxy; $ua->env_proxy;
$ua->proxy([qw(http https)], $proxy) || (); $ua->proxy([qw(http https ftp)], $proxy) || ();
my $dest = $args->{'destination_path'} ? $args->{'destination_path'}."$filename" : "/tmp/$filename"; my $dest = $args->{'destination_path'} ? $args->{'destination_path'}."$filename" : "/tmp/$filename";
my $response = $ua->mirror($file_url, $dest); my $response = $ua->mirror($file_url, $dest);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment