aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/WebUtil.cs43
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs1
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs6
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs299
-rw-r--r--OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs23
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs19
7 files changed, 244 insertions, 149 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 4734fc1..18e50a2 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.Collections.Specialized; 31using System.Collections.Specialized;
32using System.Globalization; 32using System.Globalization;
33using System.IO; 33using System.IO;
34using System.IO.Compression;
34using System.Net; 35using System.Net;
35using System.Net.Security; 36using System.Net.Security;
36using System.Reflection; 37using System.Reflection;
@@ -142,20 +143,25 @@ namespace OpenSim.Framework
142 /// </summary> 143 /// </summary>
143 public static OSDMap PutToService(string url, OSDMap data, int timeout) 144 public static OSDMap PutToService(string url, OSDMap data, int timeout)
144 { 145 {
145 return ServiceOSDRequest(url,data, "PUT", timeout); 146 return ServiceOSDRequest(url,data, "PUT", timeout, false);
146 } 147 }
147 148
148 public static OSDMap PostToService(string url, OSDMap data, int timeout) 149 public static OSDMap PostToService(string url, OSDMap data, int timeout)
149 { 150 {
150 return ServiceOSDRequest(url, data, "POST", timeout); 151 return ServiceOSDRequest(url, data, "POST", timeout, false);
152 }
153
154 public static OSDMap PostToServiceCompressed(string url, OSDMap data, int timeout)
155 {
156 return ServiceOSDRequest(url, data, "POST", timeout, true);
151 } 157 }
152 158
153 public static OSDMap GetFromService(string url, int timeout) 159 public static OSDMap GetFromService(string url, int timeout)
154 { 160 {
155 return ServiceOSDRequest(url, null, "GET", timeout); 161 return ServiceOSDRequest(url, null, "GET", timeout, false);
156 } 162 }
157 163
158 public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout) 164 public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed)
159 { 165 {
160 int reqnum = m_requestNumber++; 166 int reqnum = m_requestNumber++;
161 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); 167 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
@@ -180,10 +186,31 @@ namespace OpenSim.Framework
180 string strBuffer = OSDParser.SerializeJsonString(data); 186 string strBuffer = OSDParser.SerializeJsonString(data);
181 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); 187 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer);
182 188
183 request.ContentType = "application/json"; 189 if (compressed)
184 request.ContentLength = buffer.Length; //Count bytes to send 190 {
185 using (Stream requestStream = request.GetRequestStream()) 191 request.ContentType = "application/x-gzip";
186 requestStream.Write(buffer, 0, buffer.Length); //Send it 192 using (MemoryStream ms = new MemoryStream())
193 {
194 using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress))
195 {
196 comp.Write(buffer, 0, buffer.Length);
197 comp.Flush();
198
199 ms.Seek(0, SeekOrigin.Begin);
200
201 request.ContentLength = ms.Length; //Count bytes to send
202 using (Stream requestStream = request.GetRequestStream())
203 requestStream.Write(ms.ToArray(), 0, (int)ms.Length);
204 }
205 }
206 }
207 else
208 {
209 request.ContentType = "application/json";
210 request.ContentLength = buffer.Length; //Count bytes to send
211 using (Stream requestStream = request.GetRequestStream())
212 requestStream.Write(buffer, 0, buffer.Length); //Send it
213 }
187 } 214 }
188 215
189 // capture how much time was spent writing, this may seem silly 216 // capture how much time was spent writing, this may seem silly
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index e380067..73f07ba 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -328,6 +328,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
328 328
329 // Let's create an agent there if one doesn't exist yet. 329 // Let's create an agent there if one doesn't exist yet.
330 bool logout = false; 330 bool logout = false;
331 sp.ControllingClient.SendTeleportProgress(teleportFlags | (uint)TeleportFlags.DisableCancel, "Creating agent...");
331 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) 332 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
332 { 333 {
333 sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", 334 sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}",
diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
index f3f81b0..cf1af15 100644
--- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
@@ -49,13 +49,13 @@ using log4net;
49 49
50namespace OpenSim.Server.Handlers.Hypergrid 50namespace OpenSim.Server.Handlers.Hypergrid
51{ 51{
52 public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentHandler 52 public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentPostHandler
53 { 53 {
54// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 private IGatekeeperService m_GatekeeperService; 56 private IGatekeeperService m_GatekeeperService;
57 57
58 public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy) 58 public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy) : base("/foreignagent")
59 { 59 {
60 m_GatekeeperService = gatekeeper; 60 m_GatekeeperService = gatekeeper;
61 m_Proxy = proxy; 61 m_Proxy = proxy;
@@ -65,7 +65,5 @@ namespace OpenSim.Server.Handlers.Hypergrid
65 { 65 {
66 return m_GatekeeperService.LoginAgent(aCircuit, destination, out reason); 66 return m_GatekeeperService.LoginAgent(aCircuit, destination, out reason);
67 } 67 }
68
69 } 68 }
70
71} 69}
diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs
index 3d0967f..0d4990a 100644
--- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
73 server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); 73 server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false);
74 server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); 74 server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false);
75 75
76 server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy).Handler); 76 server.AddStreamHandler(new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy));
77 } 77 }
78 78
79 public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) 79 public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server)
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 8b6fb4f..d52750b 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.IO; 30using System.IO;
31using System.IO.Compression;
31using System.Reflection; 32using System.Reflection;
32using System.Net; 33using System.Net;
33using System.Text; 34using System.Text;
@@ -53,8 +54,6 @@ namespace OpenSim.Server.Handlers.Simulation
53 54
54 private ISimulationService m_SimulationService; 55 private ISimulationService m_SimulationService;
55 56
56 protected bool m_Proxy = false;
57
58 public AgentHandler() { } 57 public AgentHandler() { }
59 58
60 public AgentHandler(ISimulationService sim) 59 public AgentHandler(ISimulationService sim)
@@ -91,16 +90,12 @@ namespace OpenSim.Server.Handlers.Simulation
91 90
92 // Next, let's parse the verb 91 // Next, let's parse the verb
93 string method = (string)request["http-method"]; 92 string method = (string)request["http-method"];
93 m_log.DebugFormat("[SIMULATION]: Got verb {0} in HTTP handler", method);
94 if (method.Equals("PUT")) 94 if (method.Equals("PUT"))
95 { 95 {
96 DoAgentPut(request, responsedata); 96 DoAgentPut(request, responsedata);
97 return responsedata; 97 return responsedata;
98 } 98 }
99 else if (method.Equals("POST"))
100 {
101 DoAgentPost(request, responsedata, agentID);
102 return responsedata;
103 }
104 else if (method.Equals("GET")) 99 else if (method.Equals("GET"))
105 { 100 {
106 DoAgentGet(request, responsedata, agentID, regionID); 101 DoAgentGet(request, responsedata, agentID, regionID);
@@ -127,111 +122,6 @@ namespace OpenSim.Server.Handlers.Simulation
127 122
128 } 123 }
129 124
130 protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id)
131 {
132 OSDMap args = Utils.GetOSDMap((string)request["body"]);
133 if (args == null)
134 {
135 responsedata["int_response_code"] = HttpStatusCode.BadRequest;
136 responsedata["str_response_string"] = "Bad request";
137 return;
138 }
139
140 // retrieve the input arguments
141 int x = 0, y = 0;
142 UUID uuid = UUID.Zero;
143 string regionname = string.Empty;
144 uint teleportFlags = 0;
145 if (args.ContainsKey("destination_x") && args["destination_x"] != null)
146 Int32.TryParse(args["destination_x"].AsString(), out x);
147 else
148 m_log.WarnFormat(" -- request didn't have destination_x");
149 if (args.ContainsKey("destination_y") && args["destination_y"] != null)
150 Int32.TryParse(args["destination_y"].AsString(), out y);
151 else
152 m_log.WarnFormat(" -- request didn't have destination_y");
153 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
154 UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
155 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
156 regionname = args["destination_name"].ToString();
157 if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null)
158 teleportFlags = args["teleport_flags"].AsUInteger();
159
160 GridRegion destination = new GridRegion();
161 destination.RegionID = uuid;
162 destination.RegionLocX = x;
163 destination.RegionLocY = y;
164 destination.RegionName = regionname;
165
166 AgentCircuitData aCircuit = new AgentCircuitData();
167 try
168 {
169 aCircuit.UnpackAgentCircuitData(args);
170 }
171 catch (Exception ex)
172 {
173 m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message);
174 responsedata["int_response_code"] = HttpStatusCode.BadRequest;
175 responsedata["str_response_string"] = "Bad request";
176 return;
177 }
178
179 OSDMap resp = new OSDMap(2);
180 string reason = String.Empty;
181
182 // This is the meaning of POST agent
183 //m_regionClient.AdjustUserInformation(aCircuit);
184 //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
185 bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason);
186
187 resp["reason"] = OSD.FromString(reason);
188 resp["success"] = OSD.FromBoolean(result);
189 // Let's also send out the IP address of the caller back to the caller (HG 1.5)
190 resp["your_ip"] = OSD.FromString(GetCallerIP(request));
191
192 // TODO: add reason if not String.Empty?
193 responsedata["int_response_code"] = HttpStatusCode.OK;
194 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
195 }
196
197 private string GetCallerIP(Hashtable request)
198 {
199 if (!m_Proxy)
200 return Util.GetCallerIP(request);
201
202 // We're behind a proxy
203 Hashtable headers = (Hashtable)request["headers"];
204
205 //// DEBUG
206 //foreach (object o in headers.Keys)
207 // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString()));
208
209 string xff = "X-Forwarded-For";
210 if (headers.ContainsKey(xff.ToLower()))
211 xff = xff.ToLower();
212
213 if (!headers.ContainsKey(xff) || headers[xff] == null)
214 {
215 m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
216 return Util.GetCallerIP(request);
217 }
218
219 m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
220
221 IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
222 if (ep != null)
223 return ep.Address.ToString();
224
225 // Oops
226 return Util.GetCallerIP(request);
227 }
228
229 // subclasses can override this
230 protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
231 {
232 return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
233 }
234
235 protected void DoAgentPut(Hashtable request, Hashtable responsedata) 125 protected void DoAgentPut(Hashtable request, Hashtable responsedata)
236 { 126 {
237 OSDMap args = Utils.GetOSDMap((string)request["body"]); 127 OSDMap args = Utils.GetOSDMap((string)request["body"]);
@@ -434,4 +324,189 @@ namespace OpenSim.Server.Handlers.Simulation
434 324
435 } 325 }
436 326
327 public class AgentPostHandler : BaseStreamHandler
328 {
329 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
330
331 private ISimulationService m_SimulationService;
332 protected bool m_Proxy = false;
333
334 public AgentPostHandler(ISimulationService service) :
335 base("POST", "/agent")
336 {
337 m_SimulationService = service;
338 }
339
340 public AgentPostHandler(string path) :
341 base("POST", path)
342 {
343 m_SimulationService = null;
344 }
345
346 public override byte[] Handle(string path, Stream request,
347 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
348 {
349 m_log.DebugFormat("[SIMULATION]: Stream handler called");
350
351 Hashtable keysvals = new Hashtable();
352 Hashtable headervals = new Hashtable();
353
354 string[] querystringkeys = httpRequest.QueryString.AllKeys;
355 string[] rHeaders = httpRequest.Headers.AllKeys;
356
357 keysvals.Add("uri", httpRequest.RawUrl);
358 keysvals.Add("content-type", httpRequest.ContentType);
359 keysvals.Add("http-method", httpRequest.HttpMethod);
360
361 foreach (string queryname in querystringkeys)
362 keysvals.Add(queryname, httpRequest.QueryString[queryname]);
363
364 foreach (string headername in rHeaders)
365 headervals[headername] = httpRequest.Headers[headername];
366
367 keysvals.Add("headers", headervals);
368 keysvals.Add("querystringkeys", querystringkeys);
369
370 Stream inputStream;
371 if (httpRequest.ContentType == "application/x-gzip")
372 inputStream = new GZipStream(request, CompressionMode.Decompress);
373 else
374 inputStream = request;
375
376 Encoding encoding = Encoding.UTF8;
377 StreamReader reader = new StreamReader(inputStream, encoding);
378
379 string requestBody = reader.ReadToEnd();
380 keysvals.Add("body", requestBody);
381
382 httpResponse.StatusCode = 200;
383 httpResponse.ContentType = "text/html";
384 httpResponse.KeepAlive = false;
385
386 Hashtable responsedata = new Hashtable();
387
388 UUID agentID;
389 UUID regionID;
390 string action;
391
392 if (!Utils.GetParams((string)keysvals["uri"], out agentID, out regionID, out action))
393 {
394 m_log.InfoFormat("[AGENT HANDLER]: Invalid parameters for agent message {0}", keysvals["uri"]);
395
396 httpResponse.StatusCode = 404;
397
398 return encoding.GetBytes("false");
399 }
400
401 DoAgentPost(keysvals, responsedata, agentID);
402
403 httpResponse.StatusCode = (int)responsedata["int_response_code"];
404 return encoding.GetBytes((string)responsedata["str_response_string"]);
405 }
406
407 protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id)
408 {
409 OSDMap args = Utils.GetOSDMap((string)request["body"]);
410 if (args == null)
411 {
412 responsedata["int_response_code"] = HttpStatusCode.BadRequest;
413 responsedata["str_response_string"] = "Bad request";
414 return;
415 }
416
417 // retrieve the input arguments
418 int x = 0, y = 0;
419 UUID uuid = UUID.Zero;
420 string regionname = string.Empty;
421 uint teleportFlags = 0;
422 if (args.ContainsKey("destination_x") && args["destination_x"] != null)
423 Int32.TryParse(args["destination_x"].AsString(), out x);
424 else
425 m_log.WarnFormat(" -- request didn't have destination_x");
426 if (args.ContainsKey("destination_y") && args["destination_y"] != null)
427 Int32.TryParse(args["destination_y"].AsString(), out y);
428 else
429 m_log.WarnFormat(" -- request didn't have destination_y");
430 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
431 UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
432 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
433 regionname = args["destination_name"].ToString();
434 if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null)
435 teleportFlags = args["teleport_flags"].AsUInteger();
436
437 GridRegion destination = new GridRegion();
438 destination.RegionID = uuid;
439 destination.RegionLocX = x;
440 destination.RegionLocY = y;
441 destination.RegionName = regionname;
442
443 AgentCircuitData aCircuit = new AgentCircuitData();
444 try
445 {
446 aCircuit.UnpackAgentCircuitData(args);
447 }
448 catch (Exception ex)
449 {
450 m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message);
451 responsedata["int_response_code"] = HttpStatusCode.BadRequest;
452 responsedata["str_response_string"] = "Bad request";
453 return;
454 }
455
456 OSDMap resp = new OSDMap(2);
457 string reason = String.Empty;
458
459 // This is the meaning of POST agent
460 //m_regionClient.AdjustUserInformation(aCircuit);
461 //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
462 bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason);
463
464 resp["reason"] = OSD.FromString(reason);
465 resp["success"] = OSD.FromBoolean(result);
466 // Let's also send out the IP address of the caller back to the caller (HG 1.5)
467 resp["your_ip"] = OSD.FromString(GetCallerIP(request));
468
469 // TODO: add reason if not String.Empty?
470 responsedata["int_response_code"] = HttpStatusCode.OK;
471 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
472 }
473
474 private string GetCallerIP(Hashtable request)
475 {
476 if (!m_Proxy)
477 return Util.GetCallerIP(request);
478
479 // We're behind a proxy
480 Hashtable headers = (Hashtable)request["headers"];
481
482 //// DEBUG
483 //foreach (object o in headers.Keys)
484 // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString()));
485
486 string xff = "X-Forwarded-For";
487 if (headers.ContainsKey(xff.ToLower()))
488 xff = xff.ToLower();
489
490 if (!headers.ContainsKey(xff) || headers[xff] == null)
491 {
492 m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
493 return Util.GetCallerIP(request);
494 }
495
496 m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
497
498 IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
499 if (ep != null)
500 return ep.Address.ToString();
501
502 // Oops
503 return Util.GetCallerIP(request);
504 }
505
506 // subclasses can override this
507 protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
508 {
509 return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
510 }
511 }
437} 512}
diff --git a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs
index f33eda7..42d8eca 100644
--- a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs
+++ b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs
@@ -43,30 +43,15 @@ namespace OpenSim.Server.Handlers.Simulation
43 public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : 43 public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
44 base(config, server, String.Empty) 44 base(config, server, String.Empty)
45 { 45 {
46 //IConfig serverConfig = config.Configs["SimulationService"];
47 //if (serverConfig == null)
48 // throw new Exception("No section 'SimulationService' in config file");
49
50 //string simService = serverConfig.GetString("LocalServiceModule",
51 // String.Empty);
52
53 //if (simService == String.Empty)
54 // throw new Exception("No SimulationService in config file");
55
56 //Object[] args = new Object[] { config };
57 m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>(); 46 m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>();
58 m_LocalSimulationService = m_LocalSimulationService.GetInnerService(); 47 m_LocalSimulationService = m_LocalSimulationService.GetInnerService();
59 //ServerUtils.LoadPlugin<ISimulationService>(simService, args);
60 48
61 //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no")); 49 // This one MUST be a stream handler because compressed fatpacks
62 //server.AddStreamHandler(new AgentGetHandler(m_SimulationService, m_AuthenticationService)); 50 // are pure binary and shoehorning that into a string with UTF-8
63 //server.AddStreamHandler(new AgentPostHandler(m_SimulationService, m_AuthenticationService)); 51 // encoding breaks it
64 //server.AddStreamHandler(new AgentPutHandler(m_SimulationService, m_AuthenticationService)); 52 server.AddStreamHandler(new AgentPostHandler(m_LocalSimulationService));
65 //server.AddStreamHandler(new AgentDeleteHandler(m_SimulationService, m_AuthenticationService));
66 server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler); 53 server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler);
67 server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler); 54 server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler);
68
69 //server.AddStreamHandler(new ObjectPostHandler(m_SimulationService, authentication));
70 } 55 }
71 } 56 }
72} 57}
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index cef6473..3a00c2b 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -102,12 +102,21 @@ namespace OpenSim.Services.Connectors.Simulation
102 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 102 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
103 args["teleport_flags"] = OSD.FromString(flags.ToString()); 103 args["teleport_flags"] = OSD.FromString(flags.ToString());
104 104
105 OSDMap result = WebUtil.PostToService(uri, args, 20000); 105 OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000);
106 if (result["Success"].AsBoolean()) 106 if (result["Success"].AsBoolean())
107 return true; 107 return true;
108 108
109 result = WebUtil.PostToService(uri, args, 30000);
110
111 if (result["Success"].AsBoolean())
112 {
113 m_log.WarnFormat(
114 "[REMOTE SIMULATION CONNECTOR]: Remote simulator {0} did not accept compressed transfer, suggest updating it.", destination.RegionName);
115 return true;
116 }
117
109 m_log.WarnFormat( 118 m_log.WarnFormat(
110 "[REMOTE SIMULATION CONNECTOR]: Failed to create agent {0} {1} at remote simulator {1}", 119 "[REMOTE SIMULATION CONNECTOR]: Failed to create agent {0} {1} at remote simulator {2}",
111 aCircuit.firstname, aCircuit.lastname, destination.RegionName); 120 aCircuit.firstname, aCircuit.lastname, destination.RegionName);
112 reason = result["Message"] != null ? result["Message"].AsString() : "error"; 121 reason = result["Message"] != null ? result["Message"].AsString() : "error";
113 return false; 122 return false;
@@ -274,7 +283,7 @@ namespace OpenSim.Services.Connectors.Simulation
274 283
275 try 284 try
276 { 285 {
277 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000); 286 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000, false);
278 bool success = result["success"].AsBoolean(); 287 bool success = result["success"].AsBoolean();
279 if (result.ContainsKey("_Result")) 288 if (result.ContainsKey("_Result"))
280 { 289 {
@@ -326,7 +335,7 @@ namespace OpenSim.Services.Connectors.Simulation
326 335
327 try 336 try
328 { 337 {
329 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000); 338 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false);
330 } 339 }
331 catch (Exception e) 340 catch (Exception e)
332 { 341 {
@@ -346,7 +355,7 @@ namespace OpenSim.Services.Connectors.Simulation
346 355
347 try 356 try
348 { 357 {
349 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000); 358 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false);
350 } 359 }
351 catch (Exception e) 360 catch (Exception e)
352 { 361 {