I found this strang behavior with ssl/https. Not sure what to make of it.
This works:
os.execute("curl -H 'HeaderName:HeaderValue' https://192.168.0.1")
… and the header added is passed with the request as expected.
This should do the exact same thing (right?):
local socket = require("socket")
local ltn12 = require('ltn12')
local https = require("ssl.https")
https.METHOD = "GET"
https.headers =
{
["HeaderName"] = "HeaderValue",
}
local result, status = https.request("https://192.168.0.1")
… except that it doesn’t. For some reason the header is not added to the GET request and I don’t understand why.
I could just go with first of the above, but now I’m getting subborn ![]()
Am I doing something wrong in the 2nd. Lua code example?
Please notice that this is a ssl/https request.