Software /
code /
prosody
Changeset
1939:2c295826a96d
componentmanager: Use ssl_ctx of 'parent' host (should fix TLS for components)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 08 Oct 2009 23:51:55 +0100 |
parents | 1938:82342e7f1b84 |
children | 1940:85d51cea2c4c |
files | core/componentmanager.lua |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/core/componentmanager.lua Thu Oct 08 23:41:59 2009 +0100 +++ b/core/componentmanager.lua Thu Oct 08 23:51:55 2009 +0100 @@ -70,7 +70,18 @@ function create_component(host, component, events) -- TODO check for host well-formedness - return { type = "component", host = host, connected = true, s2sout = {}, events = events or events_new() }; + local ssl_ctx; + if host then + -- We need to find SSL context to use... + -- Discussion in prosody@ concluded that + -- 1 level back is usually enough by default + local base_host = host:gsub("^[^%.]+", ""); + if hosts[base_host] then + ssl_ctx = hosts[base_host].ssl_ctx; + end + end + return { type = "component", host = host, connected = true, s2sout = {}, + ssl_ctx = ssl_ctx, events = events or events_new() }; end function register_component(host, component, session)