summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-06-05 07:01:30 +0800
committerGitHub <[email protected]>2024-06-05 07:01:30 +0800
commitab97f33e9a4bf38049c84ac03eafd3898f82ba3e (patch)
tree8af90181e0bb622253be454c55b25ddffc7cc5dd
parent868096f509b4af29e9d3f7a390ddf9f94f6eaa5b (diff)
parent9e4834331add22c39839e0f283dfce7a9bde4001 (diff)
Merge pull request #5190 from Chi-EEE/read_timeout
add read_timeout to net.http.download
-rw-r--r--xmake/modules/net/http/download.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/xmake/modules/net/http/download.lua b/xmake/modules/net/http/download.lua
index d622e75d9..b2802d219 100644
--- a/xmake/modules/net/http/download.lua
+++ b/xmake/modules/net/http/download.lua
@@ -105,6 +105,14 @@ function _curl_download(tool, url, outputfile, opt)
table.insert(argv, tostring(opt.timeout))
end
+ -- set read timeout
+ if opt.read_timeout then
+ table.insert(argv, "--speed-limit")
+ table.insert(argv, "0")
+ table.insert(argv, "--speed-time")
+ table.insert(argv, tostring(opt.read_timeout))
+ end
+
-- set url
table.insert(argv, url)
@@ -181,6 +189,11 @@ function _wget_download(tool, url, outputfile, opt)
table.insert(argv, "--timeout=" .. tostring(opt.timeout))
end
+ -- set read timeout
+ if opt.read_timeout then
+ table.insert(argv, "--read-timeout=" .. tostring(opt.read_timeout))
+ end
+
-- set outputfile
table.insert(argv, "-O")
table.insert(argv, outputfile)