Lua - Request works via curl, but not via Lua (Lua socket)?

I’m going to have to resign myself that I can’t get it to work this way via Vera,

01	01/21/21 20:19:36.375	luup_log interface 0x12debf8 args 3 <0x72b98520> 

The same chunk of code works on my Pi, running Lua 5.1, Lua-socket and luasec etc.

local https = require "ssl.https"
local mime = require "mime"
local http = require "socket.http"
local data = ""
local username = "user"
local password = "password"

local function collect(chunk)
  if chunk ~= nil then
    data = data .. chunk
    end
  return true
end

local ok, statusCode, headers, statusText = https.request {
  method = "GET",
  url = "https://api.sipgate.com/v2/account",
  headers = {
    ["Accept"] = "application/json",
    ["Authorization"] = "Basic " .. (mime.b64(username ..":" .. password)),
    },
  sink = collect
}

--debug --
print("enc64", mime.b64(username ..":" .. password))
print("ok\t",         ok);
print("statusCode", statusCode)
print("statusText", statusText)
print("headers:", headers)
print("data", data)

Hi @parkerc,

Don’t beat your self up. The Lua socket library used on the Veras is seriously old and simply does not work with some https targets, especially multi hosted.

Cheers Rene

So frustrating:-)

Thanks @reneboer