summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-10-25 22:37:21 +0800
committerruki <[email protected]>2022-10-25 09:44:25 +0800
commit8323a4d3b7a656eed0aea8ef194d3f6eaaf89118 (patch)
tree4e28360101b8b448cabb403c10c885ac814d979a
parent125f6017739c012357b69382972dc849841e32ce (diff)
add insecure-ssl
-rw-r--r--xmake/actions/global/xmake.lua5
-rw-r--r--xmake/modules/net/http/download.lua10
-rw-r--r--xmake/modules/private/action/require/impl/actions/download.lua3
-rw-r--r--xmake/modules/private/action/require/impl/actions/download_resources.lua3
4 files changed, 17 insertions, 4 deletions
diff --git a/xmake/actions/global/xmake.lua b/xmake/actions/global/xmake.lua
index ab8fa1366..56f05dc65 100644
--- a/xmake/actions/global/xmake.lua
+++ b/xmake/actions/global/xmake.lua
@@ -41,9 +41,10 @@ task("global")
-- network configuration
{category = "Network Configuration"},
- {nil, "network", "kv", "public" , "Set the network mode."
+ {nil, "network", "kv", "public" , "Set the network mode."
, values = {"public", "private"} },
- {'x', "proxy", "kv", nil , "Use proxy on given port. [protocol://]host[:port]"
+ {nil, "insecure-ssl", "k", nil , "Disable to check ssl certificates for downloading." },
+ {'x', "proxy", "kv", nil , "Use proxy on given port. [protocol://]host[:port]"
, " e.g."
, " - xmake g --proxy='http://host:port'"
, " - xmake g --proxy='https://host:port'"
diff --git a/xmake/modules/net/http/download.lua b/xmake/modules/net/http/download.lua
index 7a90ac8bc..0b266a248 100644
--- a/xmake/modules/net/http/download.lua
+++ b/xmake/modules/net/http/download.lua
@@ -80,6 +80,11 @@ function _curl_download(tool, url, outputfile, opt)
table.insert(argv, user_agent)
end
+ -- ignore to check ssl certificates
+ if opt.insecure then
+ table.insert(argv, "-k")
+ end
+
-- continue to download?
if opt.continue then
table.insert(argv, "-C")
@@ -140,6 +145,11 @@ function _wget_download(tool, url, outputfile, opt)
table.insert(argv, user_agent)
end
+ -- ignore to check ssl certificates
+ if opt.insecure then
+ table.insert(argv, "--no-check-certificate")
+ end
+
-- continue to download?
if opt.continue then
table.insert(argv, "-c")
diff --git a/xmake/modules/private/action/require/impl/actions/download.lua b/xmake/modules/private/action/require/impl/actions/download.lua
index ddd596305..63dc57ba9 100644
--- a/xmake/modules/private/action/require/impl/actions/download.lua
+++ b/xmake/modules/private/action/require/impl/actions/download.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.base.global")
import("core.base.tty")
import("core.base.hashset")
import("core.project.config")
@@ -156,7 +157,7 @@ function _download(package, url, sourcedir, url_alias, url_excludes)
-- we can use local package from the search directories directly if network is too slow
os.cp(localfile, packagefile)
else
- http.download(url, packagefile)
+ http.download(url, packagefile, {insecure = global.get("insecure-ssl")})
end
end
diff --git a/xmake/modules/private/action/require/impl/actions/download_resources.lua b/xmake/modules/private/action/require/impl/actions/download_resources.lua
index b7aea15a7..5373fd81f 100644
--- a/xmake/modules/private/action/require/impl/actions/download_resources.lua
+++ b/xmake/modules/private/action/require/impl/actions/download_resources.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.base.global")
import("core.package.package", {alias = "core_package"})
import("lib.detect.find_file")
import("lib.detect.find_directory")
@@ -113,7 +114,7 @@ function _download(package, resource_name, resource_url, resource_hash)
-- we can use local resource from the search directories directly if network is too slow
os.cp(localfile, resource_file)
elseif resource_url:find(string.ipattern("https-://")) or resource_url:find(string.ipattern("ftps-://")) then
- http.download(resource_url, resource_file)
+ http.download(resource_url, resource_file, {insecure = global.get("insecure-ssl")})
else
raise("invalid resource url(%s)", resource_url)
end