summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-06-04 21:44:53 +0800
committerGitHub <[email protected]>2024-06-04 21:44:53 +0800
commit38ae0ac6591f098f7ed47a69b9ec01e6723575ed (patch)
tree505824f879187c1b551dd029ca0c1ae49d8b12dd
parent13a5f11a85eff431f0254247da36ffeb3f6e6a17 (diff)
parent6b478b7c5acba7ff17a9ee3df2ee979e65e1a208 (diff)
Merge pull request #5187 from Chi-EEE/timeout
add timeout to net.http.download
-rw-r--r--xmake/modules/net/http/download.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/xmake/modules/net/http/download.lua b/xmake/modules/net/http/download.lua
index 9ef9ec0a0..d622e75d9 100644
--- a/xmake/modules/net/http/download.lua
+++ b/xmake/modules/net/http/download.lua
@@ -99,6 +99,12 @@ function _curl_download(tool, url, outputfile, opt)
table.insert(argv, "-")
end
+ -- set timeout
+ if opt.timeout then
+ table.insert(argv, "--max-time")
+ table.insert(argv, tostring(opt.timeout))
+ end
+
-- set url
table.insert(argv, url)
@@ -170,6 +176,11 @@ function _wget_download(tool, url, outputfile, opt)
table.insert(argv, "-c")
end
+ -- set timeout
+ if opt.timeout then
+ table.insert(argv, "--timeout=" .. tostring(opt.timeout))
+ end
+
-- set outputfile
table.insert(argv, "-O")
table.insert(argv, outputfile)