Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
v2.0.5 (2013-xx-xx)
v2.0.5 (2023-xx-xx)
* New commands added: `BITOP`, `BITCOUNT`, `SCAN`, `SSCAN`, `ZSCAN`, `HSCAN`.

* Added the ability to specify a socket timeout in the connection parameters.
Expand All @@ -7,6 +7,8 @@ v2.0.5 (2013-xx-xx)

* Fixed command serialization when command arguments contain nil values.

* Added the possibility to connect to a redis server with TLS enabled.

v2.0.4 (2012-07-15)
* The library is now fully compatible with Lua 5.2.

Expand Down
18 changes: 17 additions & 1 deletion src/redis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,23 @@ local function create_connection(parameters)
perform_connection, socket = connect_tcp, require('socket').tcp
end

return perform_connection(socket(), parameters)
local conn = perform_connection(socket(), parameters)

if parameters.tls then
local ssl = require("ssl")
local params = {
mode = parameters.mode or "client",
protocol = parameters.protocol or "any",
key = parameters.key,
certificate = parameters.certificate,
cafile = parameters.cafile,
verify = parameters.verify or "peer",
options = parameters.options or "all",
}
conn = ssl.wrap(conn, params)
conn:dohandshake()
end
return conn
end

-- ############################################################################
Expand Down