aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2007-12-04 05:47:51 +0000
committerAdam Frisby2007-12-04 05:47:51 +0000
commit7d5f03220384092ed2cb8a86d489e0151774f496 (patch)
tree2f1ba749891a828d32d3959aa7a5877314b2f051
parent* Flying with ODE and got that sinking feeling? This should help (diff)
downloadopensim-SC-7d5f03220384092ed2cb8a86d489e0151774f496.zip
opensim-SC-7d5f03220384092ed2cb8a86d489e0151774f496.tar.gz
opensim-SC-7d5f03220384092ed2cb8a86d489e0151774f496.tar.bz2
opensim-SC-7d5f03220384092ed2cb8a86d489e0151774f496.tar.xz
* 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.
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs35
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs16
-rw-r--r--OpenSim/Framework/UserConfig.cs7
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs25
4 files changed, 57 insertions, 26 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index c37fcba..b9559c0 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -28,22 +28,25 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
28 28
29 public void Initialise(OpenSimMain openSim) 29 public void Initialise(OpenSimMain openSim)
30 { 30 {
31 IConfig remoteConfig = openSim.ConfigSource.Configs["RemoteAdmin"]; 31 try
32 if (remoteConfig != null) 32 {
33 { 33 if (openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
34 if (remoteConfig.GetBoolean("enabled", false)) 34 {
35 { 35 OpenSim.Framework.Console.MainLog.Instance.Verbose("RADMIN", "Remote Admin Plugin Enabled");
36 System.Console.WriteLine("RADMIN", "Remote Admin Plugin Enabled"); 36
37 37 m_app = openSim;
38 m_app = openSim; 38 m_httpd = openSim.HttpServer;
39 m_httpd = openSim.HttpServer; 39
40 40 m_httpd.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod);
41 m_httpd.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod); 41 m_httpd.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod);
42 m_httpd.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod); 42 m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod);
43 m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod); 43 m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod);
44 m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod); 44 }
45 } 45 }
46 } 46 catch (NullReferenceException)
47 {
48 // Ignore.
49 }
47 } 50 }
48 51
49 public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) 52 public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request)
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index aa6d315..81829c4 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -45,6 +45,7 @@ namespace OpenSim.Framework.Servers
45 protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); 45 protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
46 protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>(); 46 protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
47 protected int m_port; 47 protected int m_port;
48 protected bool m_ssl = false;
48 protected bool m_firstcaps = true; 49 protected bool m_firstcaps = true;
49 50
50 public int Port 51 public int Port
@@ -57,6 +58,12 @@ namespace OpenSim.Framework.Servers
57 m_port = port; 58 m_port = port;
58 } 59 }
59 60
61 public BaseHttpServer(int port, bool ssl)
62 {
63 m_ssl = ssl;
64 BaseHttpServer(port);
65 }
66
60 public void AddStreamHandler(IRequestHandler handler) 67 public void AddStreamHandler(IRequestHandler handler)
61 { 68 {
62 string httpMethod = handler.HttpMethod; 69 string httpMethod = handler.HttpMethod;
@@ -252,7 +259,14 @@ namespace OpenSim.Framework.Servers
252 MainLog.Instance.Verbose("HTTPD", "Spawned main thread OK"); 259 MainLog.Instance.Verbose("HTTPD", "Spawned main thread OK");
253 m_httpListener = new HttpListener(); 260 m_httpListener = new HttpListener();
254 261
255 m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); 262 if (!m_ssl)
263 {
264 m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
265 }
266 else
267 {
268 m_httpListener.Prefixes.Add("https://+:" + m_port + "/");
269 }
256 m_httpListener.Start(); 270 m_httpListener.Start();
257 271
258 HttpListenerContext context; 272 HttpListenerContext context;
diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs
index 4c6b3b8..1cc00c7 100644
--- a/OpenSim/Framework/UserConfig.cs
+++ b/OpenSim/Framework/UserConfig.cs
@@ -43,7 +43,9 @@ namespace OpenSim.Framework
43 public string DatabaseProvider = ""; 43 public string DatabaseProvider = "";
44 44
45 public static uint DefaultHttpPort = 8002; 45 public static uint DefaultHttpPort = 8002;
46 public static bool DefaultHttpSSL = false;
46 public uint HttpPort = DefaultHttpPort; 47 public uint HttpPort = DefaultHttpPort;
48 public bool HttpSSL = DefaultHttpSSL;
47 public uint DefaultX = 1000; 49 public uint DefaultX = 1000;
48 public uint DefaultY = 1000; 50 public uint DefaultY = 1000;
49 51
@@ -80,6 +82,8 @@ namespace OpenSim.Framework
80 82
81 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 83 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
82 "Http Listener port", DefaultHttpPort.ToString(), false); 84 "Http Listener port", DefaultHttpPort.ToString(), false);
85 configMember.addConfigurationOption("http_ssl", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
86 "Use SSL? true/false", DefaultHttpSSL.ToString(), false);
83 configMember.addConfigurationOption("default_X", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 87 configMember.addConfigurationOption("default_X", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
84 "Known good region X", "1000", false); 88 "Known good region X", "1000", false);
85 configMember.addConfigurationOption("default_Y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 89 configMember.addConfigurationOption("default_Y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
@@ -111,6 +115,9 @@ namespace OpenSim.Framework
111 case "http_port": 115 case "http_port":
112 HttpPort = (uint) configuration_result; 116 HttpPort = (uint) configuration_result;
113 break; 117 break;
118 case "http_ssl":
119 HttpSSL = (bool)configuration_result;
120 break;
114 case "default_X": 121 case "default_X":
115 DefaultX = (uint)configuration_result; 122 DefaultX = (uint)configuration_result;
116 break; 123 break;
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
index 2ad784b..55ed90b 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
@@ -143,15 +143,22 @@ namespace libTerrain
143 143
144 public double Get(int x, int y) 144 public double Get(int x, int y)
145 { 145 {
146 if (x >= w) 146 try
147 x = w - 1; 147 {
148 if (y >= h) 148 return map[x, y];
149 y = h - 1; 149 }
150 if (x < 0) 150 catch (IndexOutOfRangeException)
151 x = 0; 151 {
152 if (y < 0) 152 if (x >= w)
153 y = 0; 153 x = w - 1;
154 return map[x, y]; 154 if (y >= h)
155 y = h - 1;
156 if (x < 0)
157 x = 0;
158 if (y < 0)
159 y = 0;
160 return map[x, y];
161 }
155 } 162 }
156 163
157 public void SetWrap(int x, int y, double val) 164 public void SetWrap(int x, int y, double val)