-function create_context(host, mode, user_ssl_config)
- user_ssl_config = user_ssl_config or {}
- user_ssl_config.mode = mode;
-
- if not ssl then return nil, "LuaSec (required for encryption) was not found"; end
-
- if global_ssl_config then
- for option,default_value in pairs(global_ssl_config) do
- if not user_ssl_config[option] then
- user_ssl_config[option] = default_value;
- end
- end
- end
- for option,default_value in pairs(core_defaults) do
- if not user_ssl_config[option] then
- user_ssl_config[option] = default_value;
- end
+ if mode == "server" then
+ if not user_ssl_config.key then return nil, "No key present in SSL/TLS configuration for "..host; end
+ if not user_ssl_config.certificate then return nil, "No certificate present in SSL/TLS configuration for "..host; end