aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2015-08-09 00:47:35 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2015-08-09 00:47:35 +1000
commitb34f9c0fd6a815f498c03717384ba8dd543e75f7 (patch)
treedae19a751b0a6149af6a78e514be6fb7b44e421b /src
parent60fc10973eb348cb3d99d27f083437ddeab03f14 (diff)
downloadluaossl-b34f9c0fd6a815f498c03717384ba8dd543e75f7.tar.gz
luaossl-b34f9c0fd6a815f498c03717384ba8dd543e75f7.tar.bz2
luaossl-b34f9c0fd6a815f498c03717384ba8dd543e75f7.zip
Allow passing openssl.ssl.context:setCipherList a vararg of ciphers, or an array
Diffstat (limited to 'src')
-rw-r--r--src/openssl.ssl.context.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/openssl.ssl.context.lua b/src/openssl.ssl.context.lua
index 44a9163..2da84de 100644
--- a/src/openssl.ssl.context.lua
+++ b/src/openssl.ssl.context.lua
@@ -1,3 +1,16 @@
local ctx = require"_openssl.ssl.context"
+local pack = table.pack or function(...) return { n = select("#", ...); ... } end
+
+-- Allow passing a vararg of ciphers, or an array
+local setCipherList; setCipherList = ctx.interpose("setCipherList", function (self, ciphers, ...)
+ if (...) then
+ local ciphers_t = pack(...)
+ ciphers = table.concat(ciphers_t, ":", 1, ciphers_t.n)
+ elseif type(ciphers) == "table" then
+ ciphers = table.concat(ciphers, ":")
+ end
+ return setCipherList(self, ciphers)
+end)
+
return ctx