diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-28 18:32:09 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-28 23:01:12 +0000 |
| commit | 361d96f856fd2de89ef835c2a6c3e30020deefbe (patch) | |
| tree | 13076ea919f0eef86e23dcca0cb792bfdb3ea0b9 /src | |
| parent | 95c6d47d8997257ef37fb856ae1a90df80a16d8d (diff) | |
| download | luarocks-361d96f856fd2de89ef835c2a6c3e30020deefbe.tar.gz luarocks-361d96f856fd2de89ef835c2a6c3e30020deefbe.tar.bz2 luarocks-361d96f856fd2de89ef835c2a6c3e30020deefbe.zip | |
fix: refuse to use luasec < 1.1
This can happen if a distro-installed luasec is too old.
See #1302 #1309 #1316 #1360 #1422 #1500
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/fs/lua.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index 29ffb255..71695701 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
| @@ -9,6 +9,7 @@ local fs = require("luarocks.fs") | |||
| 9 | local cfg = require("luarocks.core.cfg") | 9 | local cfg = require("luarocks.core.cfg") |
| 10 | local dir = require("luarocks.dir") | 10 | local dir = require("luarocks.dir") |
| 11 | local util = require("luarocks.util") | 11 | local util = require("luarocks.util") |
| 12 | local vers = require("luarocks.core.vers") | ||
| 12 | 13 | ||
| 13 | local pack = table.pack or function(...) return { n = select("#", ...), ... } end | 14 | local pack = table.pack or function(...) return { n = select("#", ...), ... } end |
| 14 | 15 | ||
| @@ -732,6 +733,11 @@ if socket_ok then | |||
| 732 | local ltn12 = require("ltn12") | 733 | local ltn12 = require("ltn12") |
| 733 | local luasec_ok, https = pcall(require, "ssl.https") | 734 | local luasec_ok, https = pcall(require, "ssl.https") |
| 734 | 735 | ||
| 736 | if luasec_ok and not vers.compare_versions(https._VERSION, "1.0.3") then | ||
| 737 | luasec_ok = false | ||
| 738 | https = nil | ||
| 739 | end | ||
| 740 | |||
| 735 | local redirect_protocols = { | 741 | local redirect_protocols = { |
| 736 | http = http, | 742 | http = http, |
| 737 | https = luasec_ok and https, | 743 | https = luasec_ok and https, |
| @@ -796,7 +802,7 @@ local function request(url, method, http, loop_control) -- luacheck: ignore 431 | |||
| 796 | loop_control[url] = true | 802 | loop_control[url] = true |
| 797 | return request(location, method, redirect_protocols[protocol], loop_control) | 803 | return request(location, method, redirect_protocols[protocol], loop_control) |
| 798 | else | 804 | else |
| 799 | return nil, "URL redirected to unsupported protocol - install luasec to get HTTPS support.", "https" | 805 | return nil, "URL redirected to unsupported protocol - install luasec >= 1.1 to get HTTPS support.", "https" |
| 800 | end | 806 | end |
| 801 | end | 807 | end |
| 802 | return nil, err | 808 | return nil, err |
| @@ -946,7 +952,7 @@ function fs_lua.download(url, filename, cache) | |||
| 946 | return nil, err | 952 | return nil, err |
| 947 | end | 953 | end |
| 948 | if not downloader_warning then | 954 | if not downloader_warning then |
| 949 | util.warning("falling back to "..downloader.." - install luasec to get native HTTPS support") | 955 | util.warning("falling back to "..downloader.." - install luasec >= 1.1 to get native HTTPS support") |
| 950 | downloader_warning = true | 956 | downloader_warning = true |
| 951 | end | 957 | end |
| 952 | return fs.use_downloader(url, filename, cache) | 958 | return fs.use_downloader(url, filename, cache) |
