16 local default_ssl_ctx_in_mt = { __index = default_ssl_ctx_in }; |
16 local default_ssl_ctx_in_mt = { __index = default_ssl_ctx_in }; |
17 |
17 |
18 -- Global SSL options if not overridden per-host |
18 -- Global SSL options if not overridden per-host |
19 local default_ssl_config = configmanager.get("*", "core", "ssl"); |
19 local default_ssl_config = configmanager.get("*", "core", "ssl"); |
20 |
20 |
21 function get_context(host, mode, config) |
21 function create_context(host, mode, config) |
22 local ssl_config = config and config.core.ssl or default_ssl_config; |
22 local ssl_config = config and config.core.ssl or default_ssl_config; |
23 if ssl and ssl_config then |
23 if ssl and ssl_config then |
24 return ssl_newcontext(setmetatable(ssl_config, mode == "client" and default_ssl_ctx_mt or default_ssl_ctx_in_mt)); |
24 return ssl_newcontext(setmetatable(ssl_config, mode == "client" and default_ssl_ctx_mt or default_ssl_ctx_in_mt)); |
25 end |
25 end |
26 return nil; |
26 return nil; |