From cdced699fb497ebf3ecbbd306269dbbda337aadc Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 14 Sep 2008 23:39:35 +0000 Subject: * Made Seed CAP response respect the SSL setting. --- .../Framework/Communications/Capabilities/Caps.cs | 44 ++++++++++++++++++++-- .../Communications/Capabilities/CapsHandlers.cs | 28 +++++++++++++- 2 files changed, 67 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework/Communications/Capabilities') diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index e82a5e9..a0c59ad 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -104,6 +104,15 @@ namespace OpenSim.Framework.Communications.Capabilities private bool m_dumpAssetsToFile; private string m_regionName; + public bool SSLCaps + { + get { return m_httpListener.UseSSL; } + } + public string SSLCommonName + { + get { return m_httpListener.SSLCommonName; } + } + // These are callbacks which will be setup by the scene so that we can update scene data when we // receive capability calls public NewInventoryItem AddNewInventoryItem = null; @@ -119,10 +128,19 @@ namespace OpenSim.Framework.Communications.Capabilities m_capsObjectPath = capsPath; m_httpListener = httpServer; m_httpListenerHostName = httpListen; + m_httpListenPort = httpPort; + + if (httpServer.UseSSL) + { + m_httpListenPort = httpServer.SSLPort; + httpListen = httpServer.SSLCommonName; + httpPort = httpServer.SSLPort; + } + m_agentID = agent; m_dumpAssetsToFile = dumpAssetsToFile; - m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort); + m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, httpServer.UseSSL); m_regionName = regionName; } @@ -541,7 +559,13 @@ namespace OpenSim.Framework.Communications.Capabilities m_httpListener.AddStreamHandler( new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); - string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + + + string protocol = "http://"; + + if (m_httpListener.UseSSL) + protocol = "https://"; + + string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); @@ -587,7 +611,13 @@ namespace OpenSim.Framework.Communications.Capabilities m_httpListener.AddStreamHandler( new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); - string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + + + string protocol = "http://"; + + if (m_httpListener.UseSSL) + protocol = "https://"; + + string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); @@ -646,7 +676,13 @@ namespace OpenSim.Framework.Communications.Capabilities llsdRequest.asset_type, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile); m_httpListener.AddStreamHandler( new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); - string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + + + string protocol = "http://"; + + if (m_httpListener.UseSSL) + protocol = "https://"; + + string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); diff --git a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs index 4a3d00f..ed31c45 100644 --- a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs +++ b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs @@ -42,6 +42,7 @@ namespace OpenSim.Framework.Communications.Capabilities private BaseHttpServer m_httpListener; private string m_httpListenerHostName; private uint m_httpListenerPort; + private bool m_useSSL = false; /// /// CapsHandlers is a cap handler container but also takes @@ -53,10 +54,30 @@ namespace OpenSim.Framework.Communications.Capabilities /// server /// HTTP port public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort) + : this (httpListener,httpListenerHostname,httpListenerPort, false) + { + } + + /// + /// CapsHandlers is a cap handler container but also takes + /// care of adding and removing cap handlers to and from the + /// supplied BaseHttpServer. + /// + /// base HTTP server + /// host name of the HTTP + /// server + /// HTTP port + public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort, bool https) { m_httpListener = httpListener; m_httpListenerHostName = httpListenerHostname; m_httpListenerPort = httpListenerPort; + m_useSSL = https; + if (m_useSSL) + { + m_httpListenerHostName = httpListener.SSLCommonName; + m_httpListenerPort = httpListener.SSLPort; + } } /// @@ -130,7 +151,12 @@ namespace OpenSim.Framework.Communications.Capabilities get { Hashtable caps = new Hashtable(); - string baseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenerPort.ToString(); + string protocol = "http://"; + + if (m_useSSL) + protocol = "https://"; + + string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString(); foreach (string capsName in m_capsHandlers.Keys) { // skip SEED cap -- cgit v1.1