summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-08-25 01:43:37 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-08-25 01:43:37 +0000
commitfd7ff9fec44844ef23e4dc1693dc778cb32cf166 (patch)
tree86cd4e26fd61a9e688152b0531d2bf6614e46ecc
parent703ba7bcc9fa59f456ff20ec3dfd6f13d7df5569 (diff)
downloadurpmi-fd7ff9fec44844ef23e4dc1693dc778cb32cf166.tar
urpmi-fd7ff9fec44844ef23e4dc1693dc778cb32cf166.tar.gz
urpmi-fd7ff9fec44844ef23e4dc1693dc778cb32cf166.tar.bz2
urpmi-fd7ff9fec44844ef23e4dc1693dc778cb32cf166.tar.xz
urpmi-fd7ff9fec44844ef23e4dc1693dc778cb32cf166.zip
Add a time out for connection establishment in curl download routine
-rw-r--r--urpm/download.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/urpm/download.pm b/urpm/download.pm
index 539438e0..603adaf0 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -9,6 +9,9 @@ use Cwd;
our $PROXY_CFG = '/etc/urpmi/proxy.cfg';
my $proxy_config;
+#- Timeout for curl connection (in seconds)
+our $CONNECT_TIMEOUT = 30;
+
sub basename { local $_ = shift; s|/*\s*$||; s|.*/||; $_ }
sub import () {
@@ -247,6 +250,7 @@ sub sync_curl {
($options->{proxy} ? set_proxy({ type => "curl", proxy => $options->{proxy} }) : ()),
"--stderr", "-", # redirect everything to stdout
"--disable-epsv",
+ "--connect-timeout", $CONNECT_TIMEOUT,
"-s", "-I", @ftp_files) . " |";
while (<$curl>) {
if (/Content-Length:\s*(\d+)/) {
@@ -307,6 +311,7 @@ sub sync_curl {
"-R",
"-f",
"--disable-epsv",
+ "--connect-timeout", $CONNECT_TIMEOUT,
"--stderr", "-", # redirect everything to stdout
@all_files) . " |";
local $/ = \1; #- read input by only one char, this is slow but very nice (and it works!).