lua - How can i use LuaSec for sending in HTTPS -
lua - How can i use LuaSec for sending in HTTPS -
in script, utilize library luasocket send xml-code. works fine next code:
local request_body = (xmlheader..xmlbody); local response_body = {} local res, code, response_headers = socket.http.request { url = "http://blabla.com/v01/authenticatie.svc"; method = "post"; headers = { ["content-type"] = "application/soap+xml; charset=utf-8"; ["content-length"] = string.len(request_body); ["accept-encoding"] = "gzip, deflate"; ["connection"] = "keep-alive"; }; source = ltn12.source.string(request_body); sink = ltn12.sink.table(response_body); } but i'll send xml protocoll https certificate. know can utilize luasec how? can tell me, how can modify code working code https?
just add:
local https = require("ssl.https") and replace:
local res, code, response_headers = socket.http.request with
local res, code, response_headers = https.request { url = "https://blabla.com/v01/authenticatie.svc"; be sure have installed luasec:
luarocks --local install luasec openssl_libdir=/usr/lib64/ #centos # or luarocks --local install luasec openssl_libdir=/usr/lib/x86_64-linux-gnu # ubuntu https lua luasocket luasec
Comments
Post a Comment