1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
--- modules/atoms/macros/atoms_internals/atomsDownload.sci.orig 2010-12-16 23:27:03.000000000 -0800
+++ modules/atoms/macros/atoms_internals/atomsDownload.sci 2010-12-16 23:41:40.000000000 -0800
@@ -71,6 +71,7 @@
CURL = %F;
WGET = %F;
HTTPDOWNLOAD = %F;
+ FETCH = %F;
// Maybe the detection has already been done
@@ -83,10 +84,16 @@
elseif atomsGetConfig("downloadTool") == "httpdownload" & getos() == 'Windows' then
HTTPDOWNLOAD=%T;
+ elseif atomsGetConfig("downloadTool") == "fetch" then
+ FETCH=%T;
+
else
// Default values according to platform
- if LINUX | SOLARIS | BSD then
+ if BSD then
+ FETCH = %T;
+
+ elseif LINUX | SOLARIS then
// Need to detect under Linux platforms
[rep,stat,err] = unix_g("wget --version");
@@ -125,9 +132,12 @@
if CURL then
// Curl
timeout_arg = " --connect-timeout ";
- else
+ elseif WGET then
// wget
timeout_arg = " --timeout=";
+ else
+ // fetch
+ timeout_arg = " -T ";
end
timeout = string(strtod(atomsGetConfig("downloadTimeout")));
@@ -141,6 +151,9 @@
timeout_arg = timeout_arg + " ";
// Proxy configuration
+ //
+ // fetch should set environment variables for proxy - see fetch(3)
+ //
if (atomsGetConfig("useProxy") == "True") & (atomsGetConfig("proxyHost") <> "") then
// Host
@@ -155,7 +168,7 @@
if CURL then
// Curl
proxy_host_arg = " --proxy "+ proxy_host;
- else
+ elseif WGET then
// wget
proxy_host_arg = " http_proxy="""+proxy_host+""" ";
end
@@ -165,7 +178,7 @@
if CURL then
// Curl
proxy_user_arg = " --proxy-user "+atomsGetConfig("proxyUser")+":"+atomsGetConfig("proxyPassword");
- else
+ elseif WGET then
// wget
proxy_user_arg = " --proxy-user="""+atomsGetConfig("proxyUser")+""" --proxy-password="""+atomsGetConfig("proxyPassword")+"""";
end
@@ -179,9 +192,12 @@
elseif CURL then
// curl
download_cmd = "curl "+proxy_host_arg+proxy_user_arg+timeout_arg+" -s "+url_in + " -o " + file_out;
- else
+ elseif WGET
// wget
download_cmd = proxy_host_arg+"wget"+proxy_user_arg+timeout_arg+" "+url_in + " -O " + file_out;
+ else
+ // fetch
+ download_cmd = "fetch " + timeout_arg + "-o " + file_out + " " + url_in;
end
[rep,stat,err] = unix_g(download_cmd);
|