Comparison

util/sslconfig.lua @ 6777:5de6b93d0190

util.*: Remove use of module() function, make all module functions local and return them in a table at the end
author Kim Alvefur <zash@zash.se>
date Sat, 21 Feb 2015 10:36:37 +0100
parent 6671:2d5e2ed44c22
child 7004:ddb03cc4ce04
comparison
equal deleted inserted replaced
6774:3965662ae091 6777:5de6b93d0190
1 local type = type;
2 local pairs = pairs;
3 local rawset = rawset;
4 local t_concat = table.concat;
5 local t_insert = table.insert;
6 local setmetatable = setmetatable;
7
8 local _ENV = nil;
1 9
2 local handlers = { }; 10 local handlers = { };
3 local finalisers = { }; 11 local finalisers = { };
4 local id = function (v) return v end 12 local id = function (v) return v end
5 13
32 finalisers.verify = finalisers.options; 40 finalisers.verify = finalisers.options;
33 finalisers.verifyext = finalisers.options; 41 finalisers.verifyext = finalisers.options;
34 42
35 function finalisers.ciphers(a) 43 function finalisers.ciphers(a)
36 if type(a) == "table" then 44 if type(a) == "table" then
37 return table.concat(a, ":"); 45 return t_concat(a, ":");
38 end 46 end
39 return a; 47 return a;
40 end 48 end
41 49
42 local protocols = { "sslv2", "sslv3", "tlsv1", "tlsv1_1", "tlsv1_2" }; 50 local protocols = { "sslv2", "sslv3", "tlsv1", "tlsv1_1", "tlsv1_2" };
45 local function protocol(a) 53 local function protocol(a)
46 local min_protocol = protocols[a.protocol]; 54 local min_protocol = protocols[a.protocol];
47 if min_protocol then 55 if min_protocol then
48 a.protocol = "sslv23"; 56 a.protocol = "sslv23";
49 for i = 1, min_protocol do 57 for i = 1, min_protocol do
50 table.insert(a.options, "no_"..protocols[i]); 58 t_insert(a.options, "no_"..protocols[i]);
51 end 59 end
52 end 60 end
53 end 61 end
54 62
55 local function apply(a, b) 63 local function apply(a, b)