mirror of
https://github.com/zenith391/OCEmu.git
synced 2025-09-30 00:28:05 -04:00
Completely fix internet patch?
Take 2 ... 3 ... 11? Remove the default port from the https library, preventing injection of port 443 Remove the default port from the http library, preventing injection of port 80 Check specifically for https, injecting port 443, else 80
This commit is contained in:
parent
b6aeb90d67
commit
618504f9cd
@ -11,6 +11,8 @@ local httpsok, http = pcall(require, "ssl.https")
|
||||
if not httpsok then
|
||||
cprint("Cannot use HTTPS: " .. http)
|
||||
http = require("socket.http")
|
||||
else
|
||||
http.PORT = nil
|
||||
end
|
||||
|
||||
component.connect("filesystem",gen_uuid(),nil,"lua/component/internet",true)
|
||||
|
@ -7,7 +7,9 @@ cprint("http_patch start")
|
||||
-- Patch data
|
||||
local patches = {
|
||||
{[[if headers[name] then headers[name] = headers[name] .. ", " .. value]],[[if headers[name] then if type(headers[name]) == "string" then headers[name] = {headers[name]} end headers[name][#headers[name]+1] = value]]},
|
||||
{[[local nreqt = adjustrequest(reqt)]],[[local nreqt = adjustrequest(reqt) if nreqt.scheme == "http" then nreqt.create = nil if nreqt.port == "443" then nreqt.port = "80" end end]]},
|
||||
{[[local nreqt = adjustrequest(reqt)]],[[local nreqt = adjustrequest(reqt) if nreqt.scheme == "http" then nreqt.create = nil end]]},
|
||||
{[[_M.PORT = 80]],[[]]},
|
||||
{[[if nreqt.port == "" then nreqt.port = 80 end]],[[if nreqt.port == "" or nreqt.port == nil then if nreqt.scheme == "https" then nreqt.port = "443" else nreqt.port = "80" end end]]}
|
||||
}
|
||||
package.loaded["socket.http"] = nil
|
||||
local path = package.searchpath("socket.http",package.path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user