Page 1 of 1

Http requests

Posted: Fri Feb 09, 2024 4:10 pm
by zalander
Sup,
Working on some thing
And I need help with socket.http, i need to get some files from pastebin but when ever i send a req i always get a 301.
Here is the code

Code: Select all

local http = require("socket.http")
local body, statusCode, headers, statusText = http.request("https://pastebin.com/raw/fZFhsBcr") -- paste bin file to be changed 
print(body, statusCode, headers, statusText)
if statusCode == 200 then
else
    error("Unable to check for updates !")
end
(Might be a noob question its my first time using socket.http :nyu: )
I have also attached the screenshot of the console output

Re: Http requests

Posted: Fri Feb 09, 2024 5:28 pm
by dusoft
A bit of searching:
https://stackoverflow.com/questions/375 ... 301-or-302

It seems that library is highly outdated.

Use Lua CURL or something similar.

Re: Http requests

Posted: Sat Feb 10, 2024 3:04 am
by RNavega
There's a module in Löve 12:
https://love2d.org/wiki/lua-https

(It's a standalone HTTP and HTTPS library made by the Löve team themselves by the way: https://github.com/love2d/lua-https)

I couldn't find Löve 12 artefacts (binaries) to test, so you'd have to build from source.
Ah, here it is, you go to an Action, then go to its Summary, then scroll to the bottom of the viewer area to find the Artefacts section with binaries (love.exe for 12).
Note that you have to be logged in to Github, or else they won't be links but just plaintext:
https://github.com/love2d/love/actions/runs/7779119519

Re: Http requests

Posted: Sat Feb 10, 2024 4:51 am
by zalander
Thanks for the help guys ! :3 Ill test the libs out.
Thanks one again !

Re: Http requests

Posted: Sun Feb 11, 2024 12:31 pm
by zalander
Found this: https://github.com/26F-Studio/love-luas ... tag/v1.0.3
And finally a new error.
Here is the error

Code: Select all

Error

error loading module 'ssl' from file 'C:\Program Files\LOVE\ssl.dll':
The specified procedure could not be found.



Traceback

[love "callbacks.lua"]:228: in function 'handler'
[C]: at 0x7ff81ab9a280
[C]: in function 'require'
libs/verify.lua:75: in main chunk
[C]: in function 'require'
main.lua:3: in function 'load'
[love "callbacks.lua"]:136: in function <[love "callbacks.lua"]:135>
[C]: in function 'xpcall'
[C]: in function 'xpcall'
I searched a lil bit on google cant find something like this. (Or im just a idiot)

Re: Http requests

Posted: Wed Feb 14, 2024 8:26 am
by RNavega
Was there a reason why you didn't post the actual code that causes the error?

Re: Http requests

Posted: Wed Feb 14, 2024 4:58 pm
by pgimeno
It sounds like a wrong DLL. Either wrong bits (32 vs 64) or this ssl.dll is not the one expected by LuaSec.

Re: Http requests

Posted: Thu Feb 15, 2024 2:16 pm
by zalander
pgimeno wrote: Wed Feb 14, 2024 4:58 pm It sounds like a wrong DLL. Either wrong bits (32 vs 64) or this ssl.dll is not the one expected by LuaSec.
Thanks for the help ill look for another DLL.