At a loss with HttpService:RequestAsync() and luasocket server

I want to use my pc as a proxy. So far I’ve got luasocket installed and I am able to receive (and send back) http requests from and to Roblox.
The problem is that I am unable to get the body. All the server (my computer) receives is POST / HTTP/1.1, however when it times out, it (used to) print pretty much all the content sent by Roblox

Server code (luasocket)
-- // Requiring services and stuff here + the SecurityKey, which I did not include

local function HandleRequestSuccess(client, err)
    if err then 
      client:send("HTTP/1.1 400 Bad Request\r\nContent-type: text/plain\r\n\r\n"..err.."\r\n")
    return not err 

local function HandleClient(client)
-- Read and process data from the client
  local line, err = client:receive()
  local Success = HandleRequestSuccess(client, err)
  if not Success then return end

  local Data = {}

  while line do print(line)
    client:send("HTTP/1.1 100 Continue\r\n\r\n")

    local a = string.find(line,": ",1,true)
    if a then 
      local Index = string.sub(line,1,a -1)
      local Value = string.sub(line,a + 2)
      Data[Index] = Value

    local line, err = client:receive("*l")
    local Success = HandleRequestSuccess(client, err)
    if not Success then return end

  if SecurityKey ~= Data["Autorization"] then
    client:send("HTTP/1.1 403 Forbidden\r\nContent-type: text/plain\r\n\r\n403 Forbidden\r\n")

  -- Respond to the client
  client:send("HTTP/1.1 200 OK\r\nContent-type: application/json\r\n\r\nHello, World!\r\n")

local port = 80

local server = assert(socket.bind("*", port))

print("Server listening on port " .. port)

--while true do
  local client = server:accept()

  if client then
    print("Client connected!")


    print("Client disconnected.")

    print("Server closed")

At some point I think it was printing out the values, where they are being written to a table

Other thing, using “*a” with client:receive() makes it yeild until it times out (at 2 minutes, if I don’t set the 10 second timeout)

Roblox code
-- // Services and the SecurityKey once again

local Body = HttpService:JSONEncode({1283874238,12934723,1239478})

	Url = "",
	Method = "POST",
	Headers = {
		["Authorization"] = SecurityKey,
		["Content-Type"] = "application/json",
	Body = Body,

I am wondering if it could be an issue with um, the server not closing properly and that messing up things, but when the code is not running, says the port is closed so idk

I’ve looked around, found nothing, asked ChatGPT, it’s useless, documentation about luasocket is scarce, and I don’t really know what the f I am doing lol. I don’t really know how tcp works so yeah, I tried to put some HTTP/1.1 100 Continue send request to get roblox to send the rest of the data??

Anyway, if someone, for some reason, knows how to use luasocket… (or the issue could be unrelated to luasocket)
Please help…

1 Like


I took a sample from luasocket and remade my code from there, and it works perfectly. I still have yet to know what is problematic in my old code, giving it a quick look, nothing jumps to the eye. I’ll probably look up a bit closer later sometime

1 Like