module Falcon::Environment::Proxy

def host_context(socket, hostname)

@parameter hostname [String] The negotiated hostname.
@parameter socket [OpenSSL::SSL::SSLSocket] The incoming connection.
Look up the host context for the given hostname, and update the socket hostname if necessary.
def host_context(socket, hostname)
	hosts = self.hosts
	
	if host = hosts[hostname]
		Console.logger.debug(self) {"Resolving #{hostname} -> #{host}"}
		
		socket.hostname = hostname
		
		return host.ssl_context
	else
		Console.logger.warn(self, hosts: hosts.keys) {"Unable to resolve #{hostname}!"}
		
		return nil
	end
end