* Added SSL Support to HttpListener

* Added SSL Option to User Server to allow logins to be done via SSL.
* Added sane handling for when Remote Admin Plugin configuration is not found
* Added some performance boosts to an area of libTerrain which was highlighted in profiling.
afrisby
Adam Frisby 2007-12-04 05:47:51 +00:00
parent 90b66f8509
commit 7d5f032203
4 changed files with 55 additions and 24 deletions

View File

@ -28,12 +28,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
public void Initialise(OpenSimMain openSim)
{
IConfig remoteConfig = openSim.ConfigSource.Configs["RemoteAdmin"];
if (remoteConfig != null)
try
{
if (remoteConfig.GetBoolean("enabled", false))
if (openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
{
System.Console.WriteLine("RADMIN", "Remote Admin Plugin Enabled");
OpenSim.Framework.Console.MainLog.Instance.Verbose("RADMIN", "Remote Admin Plugin Enabled");
m_app = openSim;
m_httpd = openSim.HttpServer;
@ -44,6 +43,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod);
}
}
catch (NullReferenceException)
{
// Ignore.
}
}
public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request)

View File

@ -45,6 +45,7 @@ namespace OpenSim.Framework.Servers
protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
protected int m_port;
protected bool m_ssl = false;
protected bool m_firstcaps = true;
public int Port
@ -57,6 +58,12 @@ namespace OpenSim.Framework.Servers
m_port = port;
}
public BaseHttpServer(int port, bool ssl)
{
m_ssl = ssl;
BaseHttpServer(port);
}
public void AddStreamHandler(IRequestHandler handler)
{
string httpMethod = handler.HttpMethod;
@ -252,7 +259,14 @@ namespace OpenSim.Framework.Servers
MainLog.Instance.Verbose("HTTPD", "Spawned main thread OK");
m_httpListener = new HttpListener();
if (!m_ssl)
{
m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
}
else
{
m_httpListener.Prefixes.Add("https://+:" + m_port + "/");
}
m_httpListener.Start();
HttpListenerContext context;

View File

@ -43,7 +43,9 @@ namespace OpenSim.Framework
public string DatabaseProvider = "";
public static uint DefaultHttpPort = 8002;
public static bool DefaultHttpSSL = false;
public uint HttpPort = DefaultHttpPort;
public bool HttpSSL = DefaultHttpSSL;
public uint DefaultX = 1000;
public uint DefaultY = 1000;
@ -80,6 +82,8 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Http Listener port", DefaultHttpPort.ToString(), false);
configMember.addConfigurationOption("http_ssl", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"Use SSL? true/false", DefaultHttpSSL.ToString(), false);
configMember.addConfigurationOption("default_X", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Known good region X", "1000", false);
configMember.addConfigurationOption("default_Y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
@ -111,6 +115,9 @@ namespace OpenSim.Framework
case "http_port":
HttpPort = (uint) configuration_result;
break;
case "http_ssl":
HttpSSL = (bool)configuration_result;
break;
case "default_X":
DefaultX = (uint)configuration_result;
break;

View File

@ -142,6 +142,12 @@ namespace libTerrain
}
public double Get(int x, int y)
{
try
{
return map[x, y];
}
catch (IndexOutOfRangeException)
{
if (x >= w)
x = w - 1;
@ -153,6 +159,7 @@ namespace libTerrain
y = 0;
return map[x, y];
}
}
public void SetWrap(int x, int y, double val)
{