aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Server')
-rw-r--r--OpenSim/Server/Base/HttpServerBase.cs87
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs11
-rw-r--r--OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs4
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs3
-rw-r--r--OpenSim/Server/Handlers/Map/MapAddServerConnector.cs79
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs11
-rw-r--r--OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs2
-rw-r--r--OpenSim/Server/ServerMain.cs26
10 files changed, 127 insertions, 100 deletions
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs
index d471559..7ba0ca8 100644
--- a/OpenSim/Server/Base/HttpServerBase.cs
+++ b/OpenSim/Server/Base/HttpServerBase.cs
@@ -42,42 +42,9 @@ namespace OpenSim.Server.Base
42 { 42 {
43 // Logger 43 // Logger
44 // 44 //
45 private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 // The http server instance 47 private uint m_consolePort;
48 //
49 protected BaseHttpServer m_HttpServer = null;
50 protected uint m_Port = 0;
51 protected Dictionary<uint, BaseHttpServer> m_Servers =
52 new Dictionary<uint, BaseHttpServer>();
53 protected uint m_consolePort = 0;
54
55 public IHttpServer HttpServer
56 {
57 get { return m_HttpServer; }
58 }
59
60 public uint DefaultPort
61 {
62 get { return m_Port; }
63 }
64
65 public IHttpServer GetHttpServer(uint port)
66 {
67 m_Log.InfoFormat("[SERVER]: Requested port {0}", port);
68 if (port == m_Port)
69 return HttpServer;
70
71 if (m_Servers.ContainsKey(port))
72 return m_Servers[port];
73
74 m_Servers[port] = new BaseHttpServer(port);
75
76 m_Log.InfoFormat("[SERVER]: Starting new HTTP server on port {0}", port);
77 m_Servers[port].Start();
78
79 return m_Servers[port];
80 }
81 48
82 // Handle all the automagical stuff 49 // Handle all the automagical stuff
83 // 50 //
@@ -94,19 +61,21 @@ namespace OpenSim.Server.Base
94 System.Console.WriteLine("Section 'Network' not found, server can't start"); 61 System.Console.WriteLine("Section 'Network' not found, server can't start");
95 Thread.CurrentThread.Abort(); 62 Thread.CurrentThread.Abort();
96 } 63 }
64
97 uint port = (uint)networkConfig.GetInt("port", 0); 65 uint port = (uint)networkConfig.GetInt("port", 0);
98 66
99 if (port == 0) 67 if (port == 0)
100 { 68 {
101
102 Thread.CurrentThread.Abort(); 69 Thread.CurrentThread.Abort();
103 } 70 }
104 // 71
105 bool ssl_main = networkConfig.GetBoolean("https_main",false); 72 bool ssl_main = networkConfig.GetBoolean("https_main",false);
106 bool ssl_listener = networkConfig.GetBoolean("https_listener",false); 73 bool ssl_listener = networkConfig.GetBoolean("https_listener",false);
107 74
108 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); 75 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0);
109 m_Port = port; 76
77 BaseHttpServer httpServer = null;
78
110 // 79 //
111 // This is where to make the servers: 80 // This is where to make the servers:
112 // 81 //
@@ -118,8 +87,7 @@ namespace OpenSim.Server.Base
118 // 87 //
119 if ( !ssl_main ) 88 if ( !ssl_main )
120 { 89 {
121 m_HttpServer = new BaseHttpServer(port); 90 httpServer = new BaseHttpServer(port);
122
123 } 91 }
124 else 92 else
125 { 93 {
@@ -135,10 +103,12 @@ namespace OpenSim.Server.Base
135 System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); 103 System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
136 Thread.CurrentThread.Abort(); 104 Thread.CurrentThread.Abort();
137 } 105 }
138 m_HttpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass); 106
107 httpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass);
139 } 108 }
140 109
141 MainServer.Instance = m_HttpServer; 110 MainServer.AddHttpServer(httpServer);
111 MainServer.Instance = httpServer;
142 112
143 // If https_listener = true, then add an ssl listener on the https_port... 113 // If https_listener = true, then add an ssl listener on the https_port...
144 if ( ssl_listener == true ) { 114 if ( ssl_listener == true ) {
@@ -157,43 +127,24 @@ namespace OpenSim.Server.Base
157 System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); 127 System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
158 Thread.CurrentThread.Abort(); 128 Thread.CurrentThread.Abort();
159 } 129 }
160 // Add our https_server 130
161 BaseHttpServer server = null; 131 MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
162 server = new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass);
163 if (server != null)
164 {
165 m_Log.InfoFormat("[SERVER]: Starting HTTPS server on port {0}", https_port);
166 m_Servers.Add(https_port,server);
167 }
168 else
169 System.Console.WriteLine(String.Format("Failed to start HTTPS server on port {0}",https_port));
170 } 132 }
171 } 133 }
172 134
173 protected override void Initialise() 135 protected override void Initialise()
174 { 136 {
175 m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", m_HttpServer.Port); 137 foreach (BaseHttpServer s in MainServer.Servers.Values)
176 m_HttpServer.Start(); 138 s.Start();
177 139
178 if (m_Servers.Count > 0) 140 MainServer.RegisterHttpConsoleCommands(MainConsole.Instance);
179 {
180 foreach (BaseHttpServer s in m_Servers.Values)
181 {
182 if (!s.UseSSL)
183 m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", s.Port);
184 else
185 m_Log.InfoFormat("[SERVER]: Starting HTTPS server on port {0}", s.Port);
186
187 s.Start();
188 }
189 }
190 141
191 if (MainConsole.Instance is RemoteConsole) 142 if (MainConsole.Instance is RemoteConsole)
192 { 143 {
193 if (m_consolePort == 0) 144 if (m_consolePort == 0)
194 ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer); 145 ((RemoteConsole)MainConsole.Instance).SetServer(MainServer.Instance);
195 else 146 else
196 ((RemoteConsole)MainConsole.Instance).SetServer(GetHttpServer(m_consolePort)); 147 ((RemoteConsole)MainConsole.Instance).SetServer(MainServer.GetHttpServer(m_consolePort));
197 } 148 }
198 } 149 }
199 } 150 }
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index 8effdd2..42c82cf 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -117,7 +117,10 @@ namespace OpenSim.Server.Base
117 catch (Exception e) 117 catch (Exception e)
118 { 118 {
119 if (!(e is System.MissingMethodException)) 119 if (!(e is System.MissingMethodException))
120 m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException); 120 {
121 m_log.ErrorFormat("Error loading plugin {0} from {1}. Exception: {2}",
122 interfaceName, dllName, e.InnerException == null ? e.Message : e.InnerException.Message);
123 }
121 return null; 124 return null;
122 } 125 }
123 126
@@ -265,7 +268,7 @@ namespace OpenSim.Server.Base
265 continue; 268 continue;
266 269
267 XmlElement elem = parent.OwnerDocument.CreateElement("", 270 XmlElement elem = parent.OwnerDocument.CreateElement("",
268 kvp.Key, ""); 271 XmlConvert.EncodeLocalName(kvp.Key), "");
269 272
270 if (kvp.Value is Dictionary<string, object>) 273 if (kvp.Value is Dictionary<string, object>)
271 { 274 {
@@ -320,11 +323,11 @@ namespace OpenSim.Server.Base
320 XmlNode type = part.Attributes.GetNamedItem("type"); 323 XmlNode type = part.Attributes.GetNamedItem("type");
321 if (type == null || type.Value != "List") 324 if (type == null || type.Value != "List")
322 { 325 {
323 ret[part.Name] = part.InnerText; 326 ret[XmlConvert.DecodeName(part.Name)] = part.InnerText;
324 } 327 }
325 else 328 else
326 { 329 {
327 ret[part.Name] = ParseElement(part); 330 ret[XmlConvert.DecodeName(part.Name)] = ParseElement(part);
328 } 331 }
329 } 332 }
330 333
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
index dfed761..18cef15 100644
--- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
@@ -191,6 +191,8 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
191 191
192 #endregion HTML 192 #endregion HTML
193 193
194 public string Name { get { return "OpenId"; } }
195 public string Description { get { return null; } }
194 public string ContentType { get { return m_contentType; } } 196 public string ContentType { get { return m_contentType; } }
195 public string HttpMethod { get { return m_httpMethod; } } 197 public string HttpMethod { get { return m_httpMethod; } }
196 public string Path { get { return m_path; } } 198 public string Path { get { return m_path; } }
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
index 59420f5..ef9b96f 100644
--- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
@@ -95,7 +95,8 @@ namespace OpenSim.Server.Handlers.Friends
95 return DeleteFriendString(request); 95 return DeleteFriendString(request);
96 96
97 } 97 }
98 m_log.DebugFormat("[FRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); 98
99 m_log.DebugFormat("[FRIENDS HANDLER]: unknown method request {0}", method);
99 } 100 }
100 catch (Exception e) 101 catch (Exception e)
101 { 102 {
@@ -103,7 +104,6 @@ namespace OpenSim.Server.Handlers.Friends
103 } 104 }
104 105
105 return FailureResult(); 106 return FailureResult();
106
107 } 107 }
108 108
109 #region Method-specific handlers 109 #region Method-specific handlers
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index bebf482..91d14cb 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -116,7 +116,7 @@ namespace OpenSim.Server.Handlers.Grid
116 return GetRegionFlags(request); 116 return GetRegionFlags(request);
117 } 117 }
118 118
119 m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); 119 m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method);
120 } 120 }
121 catch (Exception e) 121 catch (Exception e)
122 { 122 {
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
index 8ef03e7..c2f127c 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
@@ -122,7 +122,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
122 return GrantRights(request); 122 return GrantRights(request);
123 */ 123 */
124 } 124 }
125 m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); 125
126 m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0}", method);
126 } 127 }
127 catch (Exception e) 128 catch (Exception e)
128 { 129 {
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
index 75dd711..4a61969 100644
--- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
@@ -33,17 +33,24 @@ using System.Xml;
33 33
34using Nini.Config; 34using Nini.Config;
35using log4net; 35using log4net;
36using OpenMetaverse;
36 37
38using OpenSim.Framework;
37using OpenSim.Server.Base; 39using OpenSim.Server.Base;
38using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
39using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Server.Handlers.Base; 42using OpenSim.Server.Handlers.Base;
41 43
44using GridRegion = OpenSim.Services.Interfaces.GridRegion;
45
42namespace OpenSim.Server.Handlers.MapImage 46namespace OpenSim.Server.Handlers.MapImage
43{ 47{
44 public class MapAddServiceConnector : ServiceConnector 48 public class MapAddServiceConnector : ServiceConnector
45 { 49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
46 private IMapImageService m_MapService; 52 private IMapImageService m_MapService;
53 private IGridService m_GridService;
47 private string m_ConfigName = "MapImageService"; 54 private string m_ConfigName = "MapImageService";
48 55
49 public MapAddServiceConnector(IConfigSource config, IHttpServer server, string configName) : 56 public MapAddServiceConnector(IConfigSource config, IHttpServer server, string configName) :
@@ -53,16 +60,27 @@ namespace OpenSim.Server.Handlers.MapImage
53 if (serverConfig == null) 60 if (serverConfig == null)
54 throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); 61 throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
55 62
56 string gridService = serverConfig.GetString("LocalServiceModule", 63 string mapService = serverConfig.GetString("LocalServiceModule",
57 String.Empty); 64 String.Empty);
58 65
59 if (gridService == String.Empty) 66 if (mapService == String.Empty)
60 throw new Exception("No LocalServiceModule in config file"); 67 throw new Exception("No LocalServiceModule in config file");
61 68
62 Object[] args = new Object[] { config }; 69 Object[] args = new Object[] { config };
63 m_MapService = ServerUtils.LoadPlugin<IMapImageService>(gridService, args); 70 m_MapService = ServerUtils.LoadPlugin<IMapImageService>(mapService, args);
71
72 string gridService = serverConfig.GetString("GridService", String.Empty);
73 if (gridService != string.Empty)
74 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
75
76 if (m_GridService != null)
77 m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is ON");
78 else
79 m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF");
80
81 bool proxy = serverConfig.GetBoolean("HasProxy", false);
82 server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy));
64 83
65 server.AddStreamHandler(new MapServerPostHandler(m_MapService));
66 } 84 }
67 } 85 }
68 86
@@ -70,11 +88,15 @@ namespace OpenSim.Server.Handlers.MapImage
70 { 88 {
71 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 89 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
72 private IMapImageService m_MapService; 90 private IMapImageService m_MapService;
91 private IGridService m_GridService;
92 bool m_Proxy;
73 93
74 public MapServerPostHandler(IMapImageService service) : 94 public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy) :
75 base("POST", "/map") 95 base("POST", "/map")
76 { 96 {
77 m_MapService = service; 97 m_MapService = service;
98 m_GridService = grid;
99 m_Proxy = proxy;
78 } 100 }
79 101
80 public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 102 public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
@@ -105,6 +127,27 @@ namespace OpenSim.Server.Handlers.MapImage
105// if (request.ContainsKey("TYPE")) 127// if (request.ContainsKey("TYPE"))
106// type = request["TYPE"].ToString(); 128// type = request["TYPE"].ToString();
107 129
130 if (m_GridService != null)
131 {
132 System.Net.IPAddress ipAddr = GetCallerIP(httpRequest);
133 GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize);
134 if (r != null)
135 {
136 if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString())
137 {
138 m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be trying to impersonate region in IP {1}", ipAddr, r.ExternalEndPoint.Address);
139 return FailureResult("IP address of caller does not match IP address of registered region");
140 }
141
142 }
143 else
144 {
145 m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}",
146 ipAddr, x, y);
147 return FailureResult("Region not found at given coordinates");
148 }
149 }
150
108 byte[] data = Convert.FromBase64String(request["DATA"].ToString()); 151 byte[] data = Convert.FromBase64String(request["DATA"].ToString());
109 152
110 string reason = string.Empty; 153 string reason = string.Empty;
@@ -183,5 +226,31 @@ namespace OpenSim.Server.Handlers.MapImage
183 226
184 return ms.ToArray(); 227 return ms.ToArray();
185 } 228 }
229
230 private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
231 {
232 if (!m_Proxy)
233 return request.RemoteIPEndPoint.Address;
234
235 // We're behind a proxy
236 string xff = "X-Forwarded-For";
237 string xffValue = request.Headers[xff.ToLower()];
238 if (xffValue == null || (xffValue != null && xffValue == string.Empty))
239 xffValue = request.Headers[xff];
240
241 if (xffValue == null || (xffValue != null && xffValue == string.Empty))
242 {
243 m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header");
244 return request.RemoteIPEndPoint.Address;
245 }
246
247 System.Net.IPEndPoint ep = Util.GetClientIPFromXFF(xffValue);
248 if (ep != null)
249 return ep.Address;
250
251 // Oops
252 return request.RemoteIPEndPoint.Address;
253 }
254
186 } 255 }
187} 256}
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 8f6fa52..d772c39 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -149,13 +149,16 @@ namespace OpenSim.Server.Handlers.Simulation
149 149
150 responsedata["int_response_code"] = HttpStatusCode.OK; 150 responsedata["int_response_code"] = HttpStatusCode.OK;
151 151
152 OSDMap resp = new OSDMap(2); 152 OSDMap resp = new OSDMap(3);
153 153
154 resp["success"] = OSD.FromBoolean(result); 154 resp["success"] = OSD.FromBoolean(result);
155 resp["reason"] = OSD.FromString(reason); 155 resp["reason"] = OSD.FromString(reason);
156 resp["version"] = OSD.FromString(version); 156 resp["version"] = OSD.FromString(version);
157 157
158 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); 158 // We must preserve defaults here, otherwise a false "success" will not be put into the JSON map!
159 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true);
160
161// Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]);
159 } 162 }
160 163
161 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) 164 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
@@ -569,7 +572,7 @@ namespace OpenSim.Server.Handlers.Simulation
569 AgentData agent = new AgentData(); 572 AgentData agent = new AgentData();
570 try 573 try
571 { 574 {
572 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); 575 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID));
573 } 576 }
574 catch (Exception ex) 577 catch (Exception ex)
575 { 578 {
@@ -589,7 +592,7 @@ namespace OpenSim.Server.Handlers.Simulation
589 AgentPosition agent = new AgentPosition(); 592 AgentPosition agent = new AgentPosition();
590 try 593 try
591 { 594 {
592 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); 595 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID));
593 } 596 }
594 catch (Exception ex) 597 catch (Exception ex)
595 { 598 {
diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
index f0d8f69..a4d03ba 100644
--- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
@@ -161,7 +161,7 @@ namespace OpenSim.Server.Handlers.Simulation
161 if (args.ContainsKey("extra") && args["extra"] != null) 161 if (args.ContainsKey("extra") && args["extra"] != null)
162 extraStr = args["extra"].AsString(); 162 extraStr = args["extra"].AsString();
163 163
164 IScene s = m_SimulationService.GetScene(destination.RegionHandle); 164 IScene s = m_SimulationService.GetScene(destination.RegionID);
165 ISceneObject sog = null; 165 ISceneObject sog = null;
166 try 166 try
167 { 167 {
diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs
index 9503c4c..21fb678 100644
--- a/OpenSim/Server/ServerMain.cs
+++ b/OpenSim/Server/ServerMain.cs
@@ -30,6 +30,7 @@ using log4net;
30using System.Reflection; 30using System.Reflection;
31using System; 31using System;
32using System.Collections.Generic; 32using System.Collections.Generic;
33using OpenSim.Framework.Servers;
33using OpenSim.Framework.Servers.HttpServer; 34using OpenSim.Framework.Servers.HttpServer;
34using OpenSim.Server.Base; 35using OpenSim.Server.Base;
35using OpenSim.Server.Handlers.Base; 36using OpenSim.Server.Handlers.Base;
@@ -92,27 +93,24 @@ namespace OpenSim.Server
92 if (parts.Length > 1) 93 if (parts.Length > 1)
93 friendlyName = parts[1]; 94 friendlyName = parts[1];
94 95
95 IHttpServer server = m_Server.HttpServer; 96 IHttpServer server;
96 if (port != 0)
97 server = m_Server.GetHttpServer(port);
98 97
99 if (port != m_Server.DefaultPort && port != 0) 98 if (port != 0)
100 m_log.InfoFormat("[SERVER]: Loading {0} on port {1}", friendlyName, port); 99 server = MainServer.GetHttpServer(port);
101 else 100 else
102 m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName); 101 server = MainServer.Instance;
102
103 m_log.InfoFormat("[SERVER]: Loading {0} on port {1}", friendlyName, server.Port);
103 104
104 IServiceConnector connector = null; 105 IServiceConnector connector = null;
105 106
106 Object[] modargs = new Object[] { m_Server.Config, server, 107 Object[] modargs = new Object[] { m_Server.Config, server, configName };
107 configName }; 108 connector = ServerUtils.LoadPlugin<IServiceConnector>(conn, modargs);
108 connector = ServerUtils.LoadPlugin<IServiceConnector>(conn, 109
109 modargs);
110 if (connector == null) 110 if (connector == null)
111 { 111 {
112 modargs = new Object[] { m_Server.Config, server }; 112 modargs = new Object[] { m_Server.Config, server };
113 connector = 113 connector = ServerUtils.LoadPlugin<IServiceConnector>(conn, modargs);
114 ServerUtils.LoadPlugin<IServiceConnector>(conn,
115 modargs);
116 } 114 }
117 115
118 if (connector != null) 116 if (connector != null)
@@ -132,4 +130,4 @@ namespace OpenSim.Server
132 return 0; 130 return 0;
133 } 131 }
134 } 132 }
135} 133} \ No newline at end of file