Skip to content

Commit 042a4b7

Browse files
authored
Added a launch option for disabling SSL verification (#1513)
1 parent f78c686 commit 042a4b7

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

src/Launch.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ end
254254
function launch:DownloadPage(url, callback, params)
255255
params = params or {}
256256
local script = [[
257-
local url, requestHeader, requestBody, connectionProtocol, proxyURL = ...
257+
local url, requestHeader, requestBody, connectionProtocol, proxyURL, noSSL = ...
258258
local responseHeader = ""
259259
local responseBody = ""
260260
ConPrintf("Downloading page at: %s", url)
@@ -281,6 +281,10 @@ function launch:DownloadPage(url, callback, params)
281281
if proxyURL then
282282
easy:setopt(curl.OPT_PROXY, proxyURL)
283283
end
284+
if noSSL then
285+
easy:setopt(curl.OPT_SSL_VERIFYPEER, 0)
286+
easy:setopt(curl.OPT_SSL_VERIFYHOST, 0)
287+
end
284288
easy:setopt_headerfunction(function(data)
285289
responseHeader = responseHeader .. data
286290
return true
@@ -303,7 +307,7 @@ function launch:DownloadPage(url, callback, params)
303307
ConPrintf("Download complete. Status: %s", errMsg or "OK")
304308
return responseBody, errMsg, responseHeader
305309
]]
306-
local id = LaunchSubScript(script, "", "ConPrintf", url, params.header, params.body, self.connectionProtocol, self.proxyURL)
310+
local id = LaunchSubScript(script, "", "ConPrintf", url, params.header, params.body, self.connectionProtocol, self.proxyURL, self.noSSL or false)
307311
if id then
308312
self.subScripts[id] = {
309313
type = "DOWNLOAD",
@@ -337,7 +341,7 @@ function launch:CheckForUpdate(inBackground)
337341
self.updateProgress = "Checking..."
338342
self.lastUpdateCheck = GetTime()
339343
local update = io.open("UpdateCheck.lua", "r")
340-
local id = LaunchSubScript(update:read("*a"), "GetScriptPath,GetRuntimePath,GetWorkDir,MakeDir", "ConPrintf,UpdateProgress", self.connectionProtocol, self.proxyURL)
344+
local id = LaunchSubScript(update:read("*a"), "GetScriptPath,GetRuntimePath,GetWorkDir,MakeDir", "ConPrintf,UpdateProgress", self.connectionProtocol, self.proxyURL, self.noSSL or false)
341345
if id then
342346
self.subScripts[id] = {
343347
type = "UPDATE"

src/Modules/Main.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ if arg and isValueInTable(arg, "--no-jit") then
3838
ConPrintf("JIT Disabled")
3939
end
4040

41+
if arg and isValueInTable(arg, "--no-ssl") then
42+
launch.noSSL = true
43+
ConPrintf("SSL verification disabled")
44+
end
45+
4146
local tempTable1 = { }
4247
local tempTable2 = { }
4348

src/UpdateCheck.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- Module: Update Check
55
-- Checks for updates
66
--
7-
local connectionProtocol, proxyURL = ...
7+
local connectionProtocol, proxyURL, noSSL = ...
88

99
local xml = require("xml")
1010
local sha1 = require("sha1")
@@ -28,6 +28,11 @@ local function downloadFileText(source, file)
2828
if proxyURL then
2929
easy:setopt(curl.OPT_PROXY, proxyURL)
3030
end
31+
if noSSL then
32+
easy:setopt(curl.OPT_SSL_VERIFYPEER, 0)
33+
easy:setopt(curl.OPT_SSL_VERIFYHOST, 0)
34+
ConPrintf("SSL verification disabled")
35+
end
3136
easy:setopt_writefunction(function(data)
3237
text = text..data
3338
return true
@@ -59,6 +64,11 @@ local function downloadFile(source, file, outName)
5964
if proxyURL then
6065
easy:setopt(curl.OPT_PROXY, proxyURL)
6166
end
67+
if noSSL then
68+
easy:setopt(curl.OPT_SSL_VERIFYPEER, 0)
69+
easy:setopt(curl.OPT_SSL_VERIFYHOST, 0)
70+
ConPrintf("SSL verification disabled")
71+
end
6272
local file = io.open(outName, "wb+")
6373
easy:setopt_writefunction(file)
6474
local _, error = easy:perform()

0 commit comments

Comments
 (0)