Doing some tests with ssl

This commit is contained in:
= 2022-06-16 21:22:51 -04:00
parent e2503cf103
commit fbd63a9aea
2 changed files with 33 additions and 13 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
# lua-env
luajit/*
# Compiled Lua sources # Compiled Lua sources
luac.out luac.out

View File

@ -2,20 +2,36 @@ package.path = "./?/init.lua;./?.lua;"..package.path
local net = require("lnet.tcp") local net = require("lnet.tcp")
local multi, thread = require("multi"):init() local multi, thread = require("multi"):init()
local http = require("lnet.http") -- local http = require("lnet.http")
-- local http_ = require("socket.http")
multi:newThread("Download Test",function() -- download = thread:newFunction(function(url,fn)
local data = http.request("http://zjcdn.mangafox.me/store/manga/14765/01-001.0/compressed/t001.jpg") -- print(1)
local file = io.open("test.jpg","wb") -- local t = multi:newTimer()
file:write(data) -- print(2)
file:flush() -- t:Start()
file:close() -- print(3,url)
os.exit() -- local data,b = http.request(url)
end) -- print(data,b)
-- local file = io.open(fn,"wb")
-- print(5)
-- file:write(data)
-- print(6)
-- file:flush()
-- print(7)
-- file:close()
-- print(fn.." Finished downloading: ".. t:Get())
-- end)
multi:newThread("Timer",function() -- multi:newThread("Timer",function()
-- while true do
-- thread.sleep(8)
-- print("...")
-- end
-- end)
--download("http://212.183.159.230/5MB.zip","test1.bin")
--download("http://212.183.159.230/50MB.zip","test2.bin").OnError(print)
end)
-- local client = net.newCastedClient("Test")--net:newTCPClient("localhost",12345) -- local client = net.newCastedClient("Test")--net:newTCPClient("localhost",12345)
-- client:send("Test!") -- client:send("Test!")
@ -23,4 +39,5 @@ end)
-- client.OnDataRecieved(function(c,data) -- client.OnDataRecieved(function(c,data)
-- print("Response: ",data) -- print("Response: ",data)
-- end) -- end)
multi:mainloop()
--multi:mainloop()