diff options
author | daurnimator <quae@daurnimator.com> | 2018-10-31 15:30:24 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2018-10-31 15:33:18 +1100 |
commit | 4da94eb5c92dc5ac7c86bb047a927a014e6bc760 (patch) | |
tree | d6ce9b4a846b4392c8f2bd87167ba0d434b0fdd6 /src/openssl.ssl.context.lua | |
parent | b52f98282470289cdd94aca46882347e35cb17a3 (diff) | |
download | luaossl-4da94eb5c92dc5ac7c86bb047a927a014e6bc760.tar.gz luaossl-4da94eb5c92dc5ac7c86bb047a927a014e6bc760.tar.bz2 luaossl-4da94eb5c92dc5ac7c86bb047a927a014e6bc760.zip |
Add ssl:setCipherSuites() and context:setCipherSuites()
Diffstat (limited to 'src/openssl.ssl.context.lua')
-rw-r--r-- | src/openssl.ssl.context.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/openssl.ssl.context.lua b/src/openssl.ssl.context.lua index 3263fb1..54cbad7 100644 --- a/src/openssl.ssl.context.lua +++ b/src/openssl.ssl.context.lua @@ -27,4 +27,18 @@ if setCurvesList then end) end +-- Allow passing a vararg of ciphersuites, or an array +local setCipherSuites = ctx.interpose("setCipherSuites", nil) +if setCipherSuites then + ctx.interpose("setCipherSuites", function (self, ciphers, ...) + if (...) then + local ciphers_t = pack(ciphers, ...) + ciphers = table.concat(ciphers_t, ":", 1, ciphers_t.n) + elseif type(ciphers) == "table" then + ciphers = table.concat(ciphers, ":") + end + return setCipherSuites(self, ciphers) + end) +end + return ctx |