aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2011-05-08 19:50:35 +0200
committerMelanie2011-05-08 19:50:35 +0200
commit763666e2d6e82dac4ae1514df8dcbe376c6f4cac (patch)
tree87a29b0a8985b73052a2a7a4f065b4eb586a97eb /OpenSim
parentAllow attachments to track the user's camera (diff)
downloadopensim-SC_OLD-763666e2d6e82dac4ae1514df8dcbe376c6f4cac.zip
opensim-SC_OLD-763666e2d6e82dac4ae1514df8dcbe376c6f4cac.tar.gz
opensim-SC_OLD-763666e2d6e82dac4ae1514df8dcbe376c6f4cac.tar.bz2
opensim-SC_OLD-763666e2d6e82dac4ae1514df8dcbe376c6f4cac.tar.xz
Enable compressed (gzip) fatpack transfers.
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 e77b88b..4d486e6 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 edfc94f..8775ea1 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -329,6 +329,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
329 329
330 // Let's create an agent there if one doesn't exist yet. 330 // Let's create an agent there if one doesn't exist yet.
331 bool logout = false; 331 bool logout = false;
332 sp.ControllingClient.SendTeleportProgress(teleportFlags | (uint)TeleportFlags.DisableCancel, "Creating agent...");
332 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) 333 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
333 { 334 {
334 sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", 335 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 b51290d..55f011a 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);
@@ -132,111 +127,6 @@ namespace OpenSim.Server.Handlers.Simulation
132 127
133 } 128 }
134 129
135 protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id)
136 {
137 OSDMap args = Utils.GetOSDMap((string)request["body"]);
138 if (args == null)
139 {
140 responsedata["int_response_code"] = HttpStatusCode.BadRequest;
141 responsedata["str_response_string"] = "Bad request";
142 return;
143 }
144
145 // retrieve the input arguments
146 int x = 0, y = 0;
147 UUID uuid = UUID.Zero;
148 string regionname = string.Empty;
149 uint teleportFlags = 0;
150 if (args.ContainsKey("destination_x") && args["destination_x"] != null)
151 Int32.TryParse(args["destination_x"].AsString(), out x);
152 else
153 m_log.WarnFormat(" -- request didn't have destination_x");
154 if (args.ContainsKey("destination_y") && args["destination_y"] != null)
155 Int32.TryParse(args["destination_y"].AsString(), out y);
156 else
157 m_log.WarnFormat(" -- request didn't have destination_y");
158 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
159 UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
160 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
161 regionname = args["destination_name"].ToString();
162 if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null)
163 teleportFlags = args["teleport_flags"].AsUInteger();
164
165 GridRegion destination = new GridRegion();
166 destination.RegionID = uuid;
167 destination.RegionLocX = x;
168 destination.RegionLocY = y;
169 destination.RegionName = regionname;
170
171 AgentCircuitData aCircuit = new AgentCircuitData();
172 try
173 {
174 aCircuit.UnpackAgentCircuitData(args);
175 }
176 catch (Exception ex)
177 {
178 m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message);
179 responsedata["int_response_code"] = HttpStatusCode.BadRequest;
180 responsedata["str_response_string"] = "Bad request";
181 return;
182 }
183
184 OSDMap resp = new OSDMap(2);
185 string reason = String.Empty;
186
187 // This is the meaning of POST agent
188 //m_regionClient.AdjustUserInformation(aCircuit);
189 //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
190 bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason);
191
192 resp["reason"] = OSD.FromString(reason);
193 resp["success"] = OSD.FromBoolean(result);
194 // Let's also send out the IP address of the caller back to the caller (HG 1.5)
195 resp["your_ip"] = OSD.FromString(GetCallerIP(request));
196
197 // TODO: add reason if not String.Empty?
198 responsedata["int_response_code"] = HttpStatusCode.OK;
199 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
200 }
201
202 private string GetCallerIP(Hashtable request)
203 {
204 if (!m_Proxy)
205 return Util.GetCallerIP(request);
206
207 // We're behind a proxy
208 Hashtable headers = (Hashtable)request["headers"];
209
210 //// DEBUG
211 //foreach (object o in headers.Keys)
212 // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString()));
213
214 string xff = "X-Forwarded-For";
215 if (headers.ContainsKey(xff.ToLower()))
216 xff = xff.ToLower();
217
218 if (!headers.ContainsKey(xff) || headers[xff] == null)
219 {
220 m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
221 return Util.GetCallerIP(request);
222 }
223
224 m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
225
226 IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
227 if (ep != null)
228 return ep.Address.ToString();
229
230 // Oops
231 return Util.GetCallerIP(request);
232 }
233
234 // subclasses can override this
235 protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
236 {
237 return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
238 }
239
240 protected void DoAgentPut(Hashtable request, Hashtable responsedata) 130 protected void DoAgentPut(Hashtable request, Hashtable responsedata)
241 { 131 {
242 OSDMap args = Utils.GetOSDMap((string)request["body"]); 132 OSDMap args = Utils.GetOSDMap((string)request["body"]);
@@ -457,4 +347,189 @@ namespace OpenSim.Server.Handlers.Simulation
457 347
458 } 348 }
459 349
350 public class AgentPostHandler : BaseStreamHandler
351 {
352 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
353
354 private ISimulationService m_SimulationService;
355 protected bool m_Proxy = false;
356
357 public AgentPostHandler(ISimulationService service) :
358 base("POST", "/agent")
359 {
360 m_SimulationService = service;
361 }
362
363 public AgentPostHandler(string path) :
364 base("POST", path)
365 {
366 m_SimulationService = null;
367 }
368
369 public override byte[] Handle(string path, Stream request,
370 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
371 {
372 m_log.DebugFormat("[SIMULATION]: Stream handler called");
373
374 Hashtable keysvals = new Hashtable();
375 Hashtable headervals = new Hashtable();
376
377 string[] querystringkeys = httpRequest.QueryString.AllKeys;
378 string[] rHeaders = httpRequest.Headers.AllKeys;
379
380 keysvals.Add("uri", httpRequest.RawUrl);
381 keysvals.Add("content-type", httpRequest.ContentType);
382 keysvals.Add("http-method", httpRequest.HttpMethod);
383
384 foreach (string queryname in querystringkeys)
385 keysvals.Add(queryname, httpRequest.QueryString[queryname]);
386
387 foreach (string headername in rHeaders)
388 headervals[headername] = httpRequest.Headers[headername];
389
390 keysvals.Add("headers", headervals);
391 keysvals.Add("querystringkeys", querystringkeys);
392
393 Stream inputStream;
394 if (httpRequest.ContentType == "application/x-gzip")
395 inputStream = new GZipStream(request, CompressionMode.Decompress);
396 else
397 inputStream = request;
398
399 Encoding encoding = Encoding.UTF8;
400 StreamReader reader = new StreamReader(inputStream, encoding);
401
402 string requestBody = reader.ReadToEnd();
403 keysvals.Add("body", requestBody);
404
405 httpResponse.StatusCode = 200;
406 httpResponse.ContentType = "text/html";
407 httpResponse.KeepAlive = false;
408
409 Hashtable responsedata = new Hashtable();
410
411 UUID agentID;
412 UUID regionID;
413 string action;
414
415 if (!Utils.GetParams((string)keysvals["uri"], out agentID, out regionID, out action))
416 {
417 m_log.InfoFormat("[AGENT HANDLER]: Invalid parameters for agent message {0}", keysvals["uri"]);
418
419 httpResponse.StatusCode = 404;
420
421 return encoding.GetBytes("false");
422 }
423
424 DoAgentPost(keysvals, responsedata, agentID);
425
426 httpResponse.StatusCode = (int)responsedata["int_response_code"];
427 return encoding.GetBytes((string)responsedata["str_response_string"]);
428 }
429
430 protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id)
431 {
432 OSDMap args = Utils.GetOSDMap((string)request["body"]);
433 if (args == null)
434 {
435 responsedata["int_response_code"] = HttpStatusCode.BadRequest;
436 responsedata["str_response_string"] = "Bad request";
437 return;
438 }
439
440 // retrieve the input arguments
441 int x = 0, y = 0;
442 UUID uuid = UUID.Zero;
443 string regionname = string.Empty;
444 uint teleportFlags = 0;
445 if (args.ContainsKey("destination_x") && args["destination_x"] != null)
446 Int32.TryParse(args["destination_x"].AsString(), out x);
447 else
448 m_log.WarnFormat(" -- request didn't have destination_x");
449 if (args.ContainsKey("destination_y") && args["destination_y"] != null)
450 Int32.TryParse(args["destination_y"].AsString(), out y);
451 else
452 m_log.WarnFormat(" -- request didn't have destination_y");
453 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
454 UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
455 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
456 regionname = args["destination_name"].ToString();
457 if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null)
458 teleportFlags = args["teleport_flags"].AsUInteger();
459
460 GridRegion destination = new GridRegion();
461 destination.RegionID = uuid;
462 destination.RegionLocX = x;
463 destination.RegionLocY = y;
464 destination.RegionName = regionname;
465
466 AgentCircuitData aCircuit = new AgentCircuitData();
467 try
468 {
469 aCircuit.UnpackAgentCircuitData(args);
470 }
471 catch (Exception ex)
472 {
473 m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message);
474 responsedata["int_response_code"] = HttpStatusCode.BadRequest;
475 responsedata["str_response_string"] = "Bad request";
476 return;
477 }
478
479 OSDMap resp = new OSDMap(2);
480 string reason = String.Empty;
481
482 // This is the meaning of POST agent
483 //m_regionClient.AdjustUserInformation(aCircuit);
484 //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
485 bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason);
486
487 resp["reason"] = OSD.FromString(reason);
488 resp["success"] = OSD.FromBoolean(result);
489 // Let's also send out the IP address of the caller back to the caller (HG 1.5)
490 resp["your_ip"] = OSD.FromString(GetCallerIP(request));
491
492 // TODO: add reason if not String.Empty?
493 responsedata["int_response_code"] = HttpStatusCode.OK;
494 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
495 }
496
497 private string GetCallerIP(Hashtable request)
498 {
499 if (!m_Proxy)
500 return Util.GetCallerIP(request);
501
502 // We're behind a proxy
503 Hashtable headers = (Hashtable)request["headers"];
504
505 //// DEBUG
506 //foreach (object o in headers.Keys)
507 // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString()));
508
509 string xff = "X-Forwarded-For";
510 if (headers.ContainsKey(xff.ToLower()))
511 xff = xff.ToLower();
512
513 if (!headers.ContainsKey(xff) || headers[xff] == null)
514 {
515 m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
516 return Util.GetCallerIP(request);
517 }
518
519 m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
520
521 IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
522 if (ep != null)
523 return ep.Address.ToString();
524
525 // Oops
526 return Util.GetCallerIP(request);
527 }
528
529 // subclasses can override this
530 protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
531 {
532 return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
533 }
534 }
460} 535}
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 3b49ab7..0badbb9 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, 30000); 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 {
@@ -330,7 +339,7 @@ namespace OpenSim.Services.Connectors.Simulation
330 339
331 try 340 try
332 { 341 {
333 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000); 342 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false);
334 } 343 }
335 catch (Exception e) 344 catch (Exception e)
336 { 345 {
@@ -348,7 +357,7 @@ namespace OpenSim.Services.Connectors.Simulation
348 357
349 try 358 try
350 { 359 {
351 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000); 360 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false);
352 } 361 }
353 catch (Exception e) 362 catch (Exception e)
354 { 363 {