Module ssl.https

HTTPS wrapper to provide high level https capability.

It is based internally onto socket.http, please refer to that doc to have more details on the API

Type ssl.https

ssl.https.request(url, body)

This is a simple HTTPS client built on top of LuaSocket's HTTP module.

Type ssl.https

Field(s)

ssl.https.request(url, body)

This is a simple HTTPS client built on top of LuaSocket's HTTP module.

This function creates a custom create function, that performs the secure connection with the server, and passes it to LuaSocket.

If url is a table, it should contain an union of LuaSocket's HTTP options and LuaSec configuration. However, the current implementation does not support proxy nor URL redirection, so the fields redirect and proxy are not supported in url. Also, setting http.PROXY is not permitted.

In the case url is a string, the module uses the following default configuration to establish the connection:

default = {
protocol = "tlsv1",
options = "all",
verify = "none",
}

The parameter body is an optional string sent as request body.

In case of failure, https.requet returns nil followed by an error message. In case of success, if url is a string, the function returns the response's body, status code, headers, and status line. If url is a table, the function returns the same results, except the response's body is replaced by the value 1.

For example:

local res, code, headers, status = https.request("https://www.site.com.br")

local one, code, headers, status = https.request {
url = "https://www.site.com.br",
sink = ltn12.sink.file(io.stdout),
protocol = "tlsv1",
options = "all",
verify = "none",
}

Parameters

Return value

see socket.http