* 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,22 +28,25 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
public void Initialise(OpenSimMain openSim) public void Initialise(OpenSimMain openSim)
{ {
IConfig remoteConfig = openSim.ConfigSource.Configs["RemoteAdmin"]; try
if (remoteConfig != null) {
{ if (openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
if (remoteConfig.GetBoolean("enabled", false)) {
{ OpenSim.Framework.Console.MainLog.Instance.Verbose("RADMIN", "Remote Admin Plugin Enabled");
System.Console.WriteLine("RADMIN", "Remote Admin Plugin Enabled");
m_app = openSim; m_app = openSim;
m_httpd = openSim.HttpServer; m_httpd = openSim.HttpServer;
m_httpd.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod); m_httpd.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod);
m_httpd.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod); m_httpd.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod);
m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod); m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod);
m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod); m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod);
} }
} }
catch (NullReferenceException)
{
// Ignore.
}
} }
public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) 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, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>(); protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
protected int m_port; protected int m_port;
protected bool m_ssl = false;
protected bool m_firstcaps = true; protected bool m_firstcaps = true;
public int Port public int Port
@ -57,6 +58,12 @@ namespace OpenSim.Framework.Servers
m_port = port; m_port = port;
} }
public BaseHttpServer(int port, bool ssl)
{
m_ssl = ssl;
BaseHttpServer(port);
}
public void AddStreamHandler(IRequestHandler handler) public void AddStreamHandler(IRequestHandler handler)
{ {
string httpMethod = handler.HttpMethod; string httpMethod = handler.HttpMethod;
@ -252,7 +259,14 @@ namespace OpenSim.Framework.Servers
MainLog.Instance.Verbose("HTTPD", "Spawned main thread OK"); MainLog.Instance.Verbose("HTTPD", "Spawned main thread OK");
m_httpListener = new HttpListener(); m_httpListener = new HttpListener();
m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); if (!m_ssl)
{
m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
}
else
{
m_httpListener.Prefixes.Add("https://+:" + m_port + "/");
}
m_httpListener.Start(); m_httpListener.Start();
HttpListenerContext context; HttpListenerContext context;

View File

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

View File

@ -143,15 +143,22 @@ namespace libTerrain
public double Get(int x, int y) public double Get(int x, int y)
{ {
if (x >= w) try
x = w - 1; {
if (y >= h) return map[x, y];
y = h - 1; }
if (x < 0) catch (IndexOutOfRangeException)
x = 0; {
if (y < 0) if (x >= w)
y = 0; x = w - 1;
return map[x, y]; if (y >= h)
y = h - 1;
if (x < 0)
x = 0;
if (y < 0)
y = 0;
return map[x, y];
}
} }
public void SetWrap(int x, int y, double val) public void SetWrap(int x, int y, double val)