* Made Seed CAP response respect the SSL setting.

0.6.0-stable
Teravus Ovares 2008-09-14 23:39:35 +00:00
parent dbbbec48df
commit cdced699fb
3 changed files with 82 additions and 5 deletions

View File

@ -104,6 +104,15 @@ namespace OpenSim.Framework.Communications.Capabilities
private bool m_dumpAssetsToFile; private bool m_dumpAssetsToFile;
private string m_regionName; 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 // These are callbacks which will be setup by the scene so that we can update scene data when we
// receive capability calls // receive capability calls
public NewInventoryItem AddNewInventoryItem = null; public NewInventoryItem AddNewInventoryItem = null;
@ -119,10 +128,19 @@ namespace OpenSim.Framework.Communications.Capabilities
m_capsObjectPath = capsPath; m_capsObjectPath = capsPath;
m_httpListener = httpServer; m_httpListener = httpServer;
m_httpListenerHostName = httpListen; m_httpListenerHostName = httpListen;
m_httpListenPort = httpPort; m_httpListenPort = httpPort;
if (httpServer.UseSSL)
{
m_httpListenPort = httpServer.SSLPort;
httpListen = httpServer.SSLCommonName;
httpPort = httpServer.SSLPort;
}
m_agentID = agent; m_agentID = agent;
m_dumpAssetsToFile = dumpAssetsToFile; m_dumpAssetsToFile = dumpAssetsToFile;
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort); m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, httpServer.UseSSL);
m_regionName = regionName; m_regionName = regionName;
} }
@ -541,7 +559,13 @@ namespace OpenSim.Framework.Communications.Capabilities
m_httpListener.AddStreamHandler( m_httpListener.AddStreamHandler(
new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 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; uploaderPath;
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
@ -587,7 +611,13 @@ namespace OpenSim.Framework.Communications.Capabilities
m_httpListener.AddStreamHandler( m_httpListener.AddStreamHandler(
new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 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; uploaderPath;
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
@ -646,7 +676,13 @@ namespace OpenSim.Framework.Communications.Capabilities
llsdRequest.asset_type, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile); llsdRequest.asset_type, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile);
m_httpListener.AddStreamHandler( m_httpListener.AddStreamHandler(
new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 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; uploaderPath;
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();

View File

@ -42,6 +42,7 @@ namespace OpenSim.Framework.Communications.Capabilities
private BaseHttpServer m_httpListener; private BaseHttpServer m_httpListener;
private string m_httpListenerHostName; private string m_httpListenerHostName;
private uint m_httpListenerPort; private uint m_httpListenerPort;
private bool m_useSSL = false;
/// <summary></summary> /// <summary></summary>
/// CapsHandlers is a cap handler container but also takes /// CapsHandlers is a cap handler container but also takes
@ -53,10 +54,30 @@ namespace OpenSim.Framework.Communications.Capabilities
/// server</param> /// server</param>
/// <param name="httpListenerPort">HTTP port</param> /// <param name="httpListenerPort">HTTP port</param>
public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort) public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort)
: this (httpListener,httpListenerHostname,httpListenerPort, false)
{
}
/// <summary></summary>
/// CapsHandlers is a cap handler container but also takes
/// care of adding and removing cap handlers to and from the
/// supplied BaseHttpServer.
/// </summary>
/// <param name="httpListener">base HTTP server</param>
/// <param name="httpListenerHostname">host name of the HTTP
/// server</param>
/// <param name="httpListenerPort">HTTP port</param>
public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort, bool https)
{ {
m_httpListener = httpListener; m_httpListener = httpListener;
m_httpListenerHostName = httpListenerHostname; m_httpListenerHostName = httpListenerHostname;
m_httpListenerPort = httpListenerPort; m_httpListenerPort = httpListenerPort;
m_useSSL = https;
if (m_useSSL)
{
m_httpListenerHostName = httpListener.SSLCommonName;
m_httpListenerPort = httpListener.SSLPort;
}
} }
/// <summary> /// <summary>
@ -130,7 +151,12 @@ namespace OpenSim.Framework.Communications.Capabilities
get get
{ {
Hashtable caps = new Hashtable(); 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) foreach (string capsName in m_capsHandlers.Keys)
{ {
// skip SEED cap // skip SEED cap

View File

@ -61,16 +61,28 @@ namespace OpenSim.Framework.Servers
protected uint m_sslport; protected uint m_sslport;
protected bool m_ssl = false; protected bool m_ssl = false;
protected bool m_firstcaps = true; protected bool m_firstcaps = true;
protected string m_SSLCommonName = "";
public uint SSLPort public uint SSLPort
{ {
get { return m_sslport; } get { return m_sslport; }
} }
public string SSLCommonName
{
get { return m_SSLCommonName; }
}
public uint Port public uint Port
{ {
get { return m_port; } get { return m_port; }
} }
public bool UseSSL
{
get { return m_ssl; }
}
public BaseHttpServer(uint port) public BaseHttpServer(uint port)
{ {
m_port = port; m_port = port;
@ -83,6 +95,7 @@ namespace OpenSim.Framework.Servers
} }
public BaseHttpServer(uint port, bool ssl, uint sslport, string CN) public BaseHttpServer(uint port, bool ssl, uint sslport, string CN)
{ {
m_ssl = ssl; m_ssl = ssl;
@ -103,6 +116,8 @@ namespace OpenSim.Framework.Servers
if (CN.Length > 0) if (CN.Length > 0)
searchCN = CN.ToUpper(); searchCN = CN.ToUpper();
m_SSLCommonName = searchCN;
Type t = Type.GetType("Mono.Runtime"); Type t = Type.GetType("Mono.Runtime");
if (t != null) if (t != null)
{ {