Http requests

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
zalander
Citizen
Posts: 72
Joined: Mon Jan 09, 2023 5:58 am
Location: India

Http requests

Post 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
Attachments
Screenshot 2024-02-09 213410.png
Screenshot 2024-02-09 213410.png (2.57 KiB) Viewed 982 times
Using LOVE to make everything except games :crazy:

Code: Select all

astring = "pog"
print(astring)
--pog
User avatar
dusoft
Party member
Posts: 510
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Http requests

Post 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.
RNavega
Party member
Posts: 251
Joined: Sun Aug 16, 2020 1:28 pm

Re: Http requests

Post 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
Last edited by RNavega on Sat Feb 10, 2024 7:53 am, edited 1 time in total.
User avatar
zalander
Citizen
Posts: 72
Joined: Mon Jan 09, 2023 5:58 am
Location: India

Re: Http requests

Post by zalander »

Thanks for the help guys ! :3 Ill test the libs out.
Thanks one again !
Using LOVE to make everything except games :crazy:

Code: Select all

astring = "pog"
print(astring)
--pog
User avatar
zalander
Citizen
Posts: 72
Joined: Mon Jan 09, 2023 5:58 am
Location: India

Re: Http requests

Post 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)
Using LOVE to make everything except games :crazy:

Code: Select all

astring = "pog"
print(astring)
--pog
RNavega
Party member
Posts: 251
Joined: Sun Aug 16, 2020 1:28 pm

Re: Http requests

Post by RNavega »

Was there a reason why you didn't post the actual code that causes the error?
User avatar
pgimeno
Party member
Posts: 3550
Joined: Sun Oct 18, 2015 2:58 pm

Re: Http requests

Post 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.
User avatar
zalander
Citizen
Posts: 72
Joined: Mon Jan 09, 2023 5:58 am
Location: India

Re: Http requests

Post 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.
Using LOVE to make everything except games :crazy:

Code: Select all

astring = "pog"
print(astring)
--pog
Post Reply

Who is online

Users browsing this forum: No registered users and 58 guests