equal
deleted
inserted
replaced
51 local fp, cb |
51 local fp, cb |
52 local st = type ( a ) |
52 local st = type ( a ) |
53 if st == "table" then |
53 if st == "table" then |
54 fp = a.fingerprint |
54 fp = a.fingerprint |
55 cb = a.callback |
55 cb = a.callback |
|
56 ut = a.tls |
|
57 rt = a.require_tls |
56 elseif st == "function" then |
58 elseif st == "function" then |
57 cb = a |
59 cb = a |
58 elseif st == "string" then |
60 elseif st == "string" then |
59 fp = a |
61 fp = a |
60 elseif st ~= "nil" then |
62 elseif st ~= "nil" then |
61 error "unexpected type of argument" |
63 error "unexpected type of argument" |
62 end |
64 end |
|
65 local ssl |
63 if fp then |
66 if fp then |
64 if cb then |
67 if cb then |
65 return lm.ssl.new ( fp, cb ) |
68 ssl = lm.ssl.new ( fp, cb ) |
66 else |
69 else |
67 return lm.ssl.new ( fp ) |
70 ssl = lm.ssl.new ( fp ) |
68 end |
71 end |
69 else |
72 else |
70 if cb then |
73 if cb then |
71 return lm.ssl.new ( cb ) |
74 ssl = lm.ssl.new ( cb ) |
72 else |
75 else |
73 return lm.ssl.new () |
76 ssl = lm.ssl.new () |
74 end |
77 end |
75 end |
78 end |
|
79 if ut ~= nil then |
|
80 ssl:tls ( ut, rt ) |
|
81 end |
|
82 return ssl |
76 end |
83 end |
77 |
84 |
78 -- basically, it just provides a way |
85 -- basically, it just provides a way |
79 -- to initialize many parameters at once. |
86 -- to initialize many parameters at once. |
80 -- keys in a table correspond to methods |
87 -- keys in a table correspond to methods |