aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Base/HttpServerBase.cs89
-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.cs50
-rw-r--r--OpenSim/Server/ServerMain.cs26
10 files changed, 127 insertions, 150 deletions
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs
index d471559..29b1c00 100644
--- a/OpenSim/Server/Base/HttpServerBase.cs
+++ b/OpenSim/Server/Base/HttpServerBase.cs
@@ -40,44 +40,9 @@ namespace OpenSim.Server.Base
40{ 40{
41 public class HttpServerBase : ServicesServerBase 41 public class HttpServerBase : ServicesServerBase
42 { 42 {
43 // Logger 43// private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 //
45 private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
47 // The http server instance
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 44
74 m_Servers[port] = new BaseHttpServer(port); 45 private uint m_consolePort;
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 46
82 // Handle all the automagical stuff 47 // Handle all the automagical stuff
83 // 48 //
@@ -94,19 +59,21 @@ namespace OpenSim.Server.Base
94 System.Console.WriteLine("Section 'Network' not found, server can't start"); 59 System.Console.WriteLine("Section 'Network' not found, server can't start");
95 Thread.CurrentThread.Abort(); 60 Thread.CurrentThread.Abort();
96 } 61 }
62
97 uint port = (uint)networkConfig.GetInt("port", 0); 63 uint port = (uint)networkConfig.GetInt("port", 0);
98 64
99 if (port == 0) 65 if (port == 0)
100 { 66 {
101
102 Thread.CurrentThread.Abort(); 67 Thread.CurrentThread.Abort();
103 } 68 }
104 // 69
105 bool ssl_main = networkConfig.GetBoolean("https_main",false); 70 bool ssl_main = networkConfig.GetBoolean("https_main",false);
106 bool ssl_listener = networkConfig.GetBoolean("https_listener",false); 71 bool ssl_listener = networkConfig.GetBoolean("https_listener",false);
107 72
108 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); 73 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0);
109 m_Port = port; 74
75 BaseHttpServer httpServer = null;
76
110 // 77 //
111 // This is where to make the servers: 78 // This is where to make the servers:
112 // 79 //
@@ -118,8 +85,7 @@ namespace OpenSim.Server.Base
118 // 85 //
119 if ( !ssl_main ) 86 if ( !ssl_main )
120 { 87 {
121 m_HttpServer = new BaseHttpServer(port); 88 httpServer = new BaseHttpServer(port);
122
123 } 89 }
124 else 90 else
125 { 91 {
@@ -135,10 +101,12 @@ namespace OpenSim.Server.Base
135 System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); 101 System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
136 Thread.CurrentThread.Abort(); 102 Thread.CurrentThread.Abort();
137 } 103 }
138 m_HttpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass); 104
105 httpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass);
139 } 106 }
140 107
141 MainServer.Instance = m_HttpServer; 108 MainServer.AddHttpServer(httpServer);
109 MainServer.Instance = httpServer;
142 110
143 // If https_listener = true, then add an ssl listener on the https_port... 111 // If https_listener = true, then add an ssl listener on the https_port...
144 if ( ssl_listener == true ) { 112 if ( ssl_listener == true ) {
@@ -157,43 +125,24 @@ namespace OpenSim.Server.Base
157 System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); 125 System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
158 Thread.CurrentThread.Abort(); 126 Thread.CurrentThread.Abort();
159 } 127 }
160 // Add our https_server 128
161 BaseHttpServer server = null; 129 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 } 130 }
171 } 131 }
172 132
173 protected override void Initialise() 133 protected override void Initialise()
174 { 134 {
175 m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", m_HttpServer.Port); 135 foreach (BaseHttpServer s in MainServer.Servers.Values)
176 m_HttpServer.Start(); 136 s.Start();
177 137
178 if (m_Servers.Count > 0) 138 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 139
191 if (MainConsole.Instance is RemoteConsole) 140 if (MainConsole.Instance is RemoteConsole)
192 { 141 {
193 if (m_consolePort == 0) 142 if (m_consolePort == 0)
194 ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer); 143 ((RemoteConsole)MainConsole.Instance).SetServer(MainServer.Instance);
195 else 144 else
196 ((RemoteConsole)MainConsole.Instance).SetServer(GetHttpServer(m_consolePort)); 145 ((RemoteConsole)MainConsole.Instance).SetServer(MainServer.GetHttpServer(m_consolePort));
197 } 146 }
198 } 147 }
199 } 148 }
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..dbb1a15 100644
--- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
@@ -93,11 +93,6 @@ namespace OpenSim.Server.Handlers.Simulation
93 DoObjectPost(request, responsedata, regionID); 93 DoObjectPost(request, responsedata, regionID);
94 return responsedata; 94 return responsedata;
95 } 95 }
96 else if (method.Equals("PUT"))
97 {
98 DoObjectPut(request, responsedata, regionID);
99 return responsedata;
100 }
101 //else if (method.Equals("DELETE")) 96 //else if (method.Equals("DELETE"))
102 //{ 97 //{
103 // DoObjectDelete(request, responsedata, agentID, action, regionHandle); 98 // DoObjectDelete(request, responsedata, agentID, action, regionHandle);
@@ -161,7 +156,7 @@ namespace OpenSim.Server.Handlers.Simulation
161 if (args.ContainsKey("extra") && args["extra"] != null) 156 if (args.ContainsKey("extra") && args["extra"] != null)
162 extraStr = args["extra"].AsString(); 157 extraStr = args["extra"].AsString();
163 158
164 IScene s = m_SimulationService.GetScene(destination.RegionHandle); 159 IScene s = m_SimulationService.GetScene(destination.RegionID);
165 ISceneObject sog = null; 160 ISceneObject sog = null;
166 try 161 try
167 { 162 {
@@ -219,48 +214,5 @@ namespace OpenSim.Server.Handlers.Simulation
219 { 214 {
220 return m_SimulationService.CreateObject(destination, newPosition, sog, false); 215 return m_SimulationService.CreateObject(destination, newPosition, sog, false);
221 } 216 }
222
223 protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID)
224 {
225 OSDMap args = Utils.GetOSDMap((string)request["body"]);
226 if (args == null)
227 {
228 responsedata["int_response_code"] = 400;
229 responsedata["str_response_string"] = "false";
230 return;
231 }
232
233 // retrieve the input arguments
234 int x = 0, y = 0;
235 UUID uuid = UUID.Zero;
236 string regionname = string.Empty;
237 if (args.ContainsKey("destination_x") && args["destination_x"] != null)
238 Int32.TryParse(args["destination_x"].AsString(), out x);
239 if (args.ContainsKey("destination_y") && args["destination_y"] != null)
240 Int32.TryParse(args["destination_y"].AsString(), out y);
241 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
242 UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
243 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
244 regionname = args["destination_name"].ToString();
245
246 GridRegion destination = new GridRegion();
247 destination.RegionID = uuid;
248 destination.RegionLocX = x;
249 destination.RegionLocY = y;
250 destination.RegionName = regionname;
251
252 UUID userID = UUID.Zero, itemID = UUID.Zero;
253 if (args.ContainsKey("userid") && args["userid"] != null)
254 userID = args["userid"].AsUUID();
255 if (args.ContainsKey("itemid") && args["itemid"] != null)
256 itemID = args["itemid"].AsUUID();
257
258 // This is the meaning of PUT object
259 bool result = m_SimulationService.CreateObject(destination, userID, itemID);
260
261 responsedata["int_response_code"] = 200;
262 responsedata["str_response_string"] = result.ToString();
263 }
264
265 } 217 }
266} 218}
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