diff options
Diffstat (limited to 'OpenSim/Services/Connectors')
8 files changed, 172 insertions, 29 deletions
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs index fdab254..d7b2ff8 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs | |||
@@ -100,6 +100,8 @@ namespace OpenSim.Services.Connectors | |||
100 | 100 | ||
101 | public AssetBase Get(string id) | 101 | public AssetBase Get(string id) |
102 | { | 102 | { |
103 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Synchronous get request for {0}", id); | ||
104 | |||
103 | string uri = m_ServerURI + "/assets/" + id; | 105 | string uri = m_ServerURI + "/assets/" + id; |
104 | 106 | ||
105 | AssetBase asset = null; | 107 | AssetBase asset = null; |
@@ -119,6 +121,8 @@ namespace OpenSim.Services.Connectors | |||
119 | 121 | ||
120 | public AssetBase GetCached(string id) | 122 | public AssetBase GetCached(string id) |
121 | { | 123 | { |
124 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id); | ||
125 | |||
122 | if (m_Cache != null) | 126 | if (m_Cache != null) |
123 | return m_Cache.Get(id); | 127 | return m_Cache.Get(id); |
124 | 128 | ||
@@ -177,6 +181,8 @@ namespace OpenSim.Services.Connectors | |||
177 | 181 | ||
178 | public bool Get(string id, Object sender, AssetRetrieved handler) | 182 | public bool Get(string id, Object sender, AssetRetrieved handler) |
179 | { | 183 | { |
184 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Potentially asynchronous get request for {0}", id); | ||
185 | |||
180 | string uri = m_ServerURI + "/assets/" + id; | 186 | string uri = m_ServerURI + "/assets/" + id; |
181 | 187 | ||
182 | AssetBase asset = null; | 188 | AssetBase asset = null; |
diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs index 5c31639..bb5d51f 100644 --- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs | |||
@@ -29,7 +29,9 @@ using log4net; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using System; | 30 | using System; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Collections.Specialized; | ||
32 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Web; | ||
33 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
34 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
35 | using OpenSim.Services.Connectors.Hypergrid; | 37 | using OpenSim.Services.Connectors.Hypergrid; |
@@ -73,11 +75,26 @@ namespace OpenSim.Services.Connectors | |||
73 | if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) && | 75 | if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) && |
74 | assetUri.Scheme == Uri.UriSchemeHttp) | 76 | assetUri.Scheme == Uri.UriSchemeHttp) |
75 | { | 77 | { |
76 | url = "http://" + assetUri.Authority; | 78 | // Simian |
77 | assetID = assetUri.LocalPath.Trim(new char[] {'/'}); | 79 | if (assetUri.Query != string.Empty) |
80 | { | ||
81 | NameValueCollection qscoll = HttpUtility.ParseQueryString(assetUri.Query); | ||
82 | assetID = qscoll["id"]; | ||
83 | if (assetID != null) | ||
84 | url = id.Replace(assetID, ""); // Malformed again, as simian expects | ||
85 | else | ||
86 | url = id; // !!! best effort | ||
87 | } | ||
88 | else // robust | ||
89 | { | ||
90 | url = "http://" + assetUri.Authority; | ||
91 | assetID = assetUri.LocalPath.Trim(new char[] { '/' }); | ||
92 | } | ||
93 | |||
78 | return true; | 94 | return true; |
79 | } | 95 | } |
80 | 96 | ||
97 | m_log.DebugFormat("[HG ASSET SERVICE]: Malformed URL {0}", id); | ||
81 | return false; | 98 | return false; |
82 | } | 99 | } |
83 | 100 | ||
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs index 7cfd6e8..c030bca 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs | |||
@@ -47,13 +47,36 @@ namespace OpenSim.Services.Connectors | |||
47 | 47 | ||
48 | public HeloServicesConnector(string serverURI) | 48 | public HeloServicesConnector(string serverURI) |
49 | { | 49 | { |
50 | m_ServerURI = serverURI.TrimEnd('/'); | 50 | if (!serverURI.EndsWith("=")) |
51 | m_ServerURI = serverURI.TrimEnd('/') + "/helo/"; | ||
52 | else | ||
53 | { | ||
54 | // Simian sends malformed urls like this: | ||
55 | // http://valley.virtualportland.org/simtest/Grid/?id= | ||
56 | // | ||
57 | try | ||
58 | { | ||
59 | Uri uri = new Uri(serverURI + "xxx"); | ||
60 | if (uri.Query == string.Empty) | ||
61 | m_ServerURI = serverURI.TrimEnd('/') + "/helo/"; | ||
62 | else | ||
63 | { | ||
64 | serverURI = serverURI + "xxx"; | ||
65 | m_ServerURI = serverURI.Replace(uri.Query, ""); | ||
66 | m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/"; | ||
67 | } | ||
68 | } | ||
69 | catch (UriFormatException e) | ||
70 | { | ||
71 | m_log.WarnFormat("[HELO SERVICE]: Malformed URL {0}", serverURI); | ||
72 | } | ||
73 | } | ||
51 | } | 74 | } |
52 | 75 | ||
53 | 76 | ||
54 | public virtual string Helo() | 77 | public virtual string Helo() |
55 | { | 78 | { |
56 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo"); | 79 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); |
57 | // Eventually we need to switch to HEAD | 80 | // Eventually we need to switch to HEAD |
58 | /* req.Method = "HEAD"; */ | 81 | /* req.Method = "HEAD"; */ |
59 | 82 | ||
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 0c55c2e..5b27cf6 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -334,6 +334,9 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
334 | UInt32.TryParse((string)hash["http_port"], out p); | 334 | UInt32.TryParse((string)hash["http_port"], out p); |
335 | region.HttpPort = p; | 335 | region.HttpPort = p; |
336 | } | 336 | } |
337 | if (hash.ContainsKey("server_uri") && hash["server_uri"] != null) | ||
338 | region.ServerURI = (string)hash["server_uri"]; | ||
339 | |||
337 | if (hash["internal_port"] != null) | 340 | if (hash["internal_port"] != null) |
338 | { | 341 | { |
339 | int p = 0; | 342 | int p = 0; |
@@ -558,6 +561,60 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
558 | return online; | 561 | return online; |
559 | } | 562 | } |
560 | 563 | ||
564 | public Dictionary<string,object> GetUserInfo (UUID userID) | ||
565 | { | ||
566 | Hashtable hash = new Hashtable(); | ||
567 | hash["userID"] = userID.ToString(); | ||
568 | |||
569 | IList paramList = new ArrayList(); | ||
570 | paramList.Add(hash); | ||
571 | |||
572 | XmlRpcRequest request = new XmlRpcRequest("get_user_info", paramList); | ||
573 | |||
574 | Dictionary<string, object> info = new Dictionary<string, object>(); | ||
575 | XmlRpcResponse response = null; | ||
576 | try | ||
577 | { | ||
578 | response = request.Send(m_ServerURL, 10000); | ||
579 | } | ||
580 | catch | ||
581 | { | ||
582 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL); | ||
583 | return info; | ||
584 | } | ||
585 | |||
586 | if (response.IsFault) | ||
587 | { | ||
588 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString); | ||
589 | return info; | ||
590 | } | ||
591 | |||
592 | hash = (Hashtable)response.Value; | ||
593 | try | ||
594 | { | ||
595 | if (hash == null) | ||
596 | { | ||
597 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUserInfo Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
598 | return info; | ||
599 | } | ||
600 | |||
601 | // Here is the actual response | ||
602 | foreach (object key in hash.Keys) | ||
603 | { | ||
604 | if (hash[key] != null) | ||
605 | { | ||
606 | info.Add(key.ToString(), hash[key]); | ||
607 | } | ||
608 | } | ||
609 | } | ||
610 | catch | ||
611 | { | ||
612 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); | ||
613 | } | ||
614 | |||
615 | return info; | ||
616 | } | ||
617 | |||
561 | public Dictionary<string, object> GetServerURLs(UUID userID) | 618 | public Dictionary<string, object> GetServerURLs(UUID userID) |
562 | { | 619 | { |
563 | Hashtable hash = new Hashtable(); | 620 | Hashtable hash = new Hashtable(); |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 9573e21..99523a1 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | |||
@@ -86,6 +86,8 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
86 | 86 | ||
87 | public SimianAssetServiceConnector(string url) | 87 | public SimianAssetServiceConnector(string url) |
88 | { | 88 | { |
89 | if (!url.EndsWith("/") && !url.EndsWith("=")) | ||
90 | url = url + '/'; | ||
89 | m_serverUrl = url; | 91 | m_serverUrl = url; |
90 | } | 92 | } |
91 | 93 | ||
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 918544f..67a65ff 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -341,26 +341,54 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
341 | 341 | ||
342 | public List<GridRegion> GetHyperlinks(UUID scopeID) | 342 | public List<GridRegion> GetHyperlinks(UUID scopeID) |
343 | { | 343 | { |
344 | // Hypergrid/linked regions are not supported | 344 | List<GridRegion> foundRegions = new List<GridRegion>(); |
345 | return new List<GridRegion>(); | 345 | |
346 | NameValueCollection requestArgs = new NameValueCollection | ||
347 | { | ||
348 | { "RequestMethod", "GetScenes" }, | ||
349 | { "HyperGrid", "true" }, | ||
350 | { "Enabled", "1" } | ||
351 | }; | ||
352 | |||
353 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | ||
354 | if (response["Success"].AsBoolean()) | ||
355 | { | ||
356 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); | ||
357 | |||
358 | OSDArray array = response["Scenes"] as OSDArray; | ||
359 | if (array != null) | ||
360 | { | ||
361 | for (int i = 0; i < array.Count; i++) | ||
362 | { | ||
363 | GridRegion region = ResponseToGridRegion(array[i] as OSDMap); | ||
364 | if (region != null) | ||
365 | foundRegions.Add(region); | ||
366 | } | ||
367 | } | ||
368 | } | ||
369 | |||
370 | return foundRegions; | ||
346 | } | 371 | } |
347 | 372 | ||
348 | public int GetRegionFlags(UUID scopeID, UUID regionID) | 373 | public int GetRegionFlags(UUID scopeID, UUID regionID) |
349 | { | 374 | { |
350 | const int REGION_ONLINE = 4; | ||
351 | |||
352 | NameValueCollection requestArgs = new NameValueCollection | 375 | NameValueCollection requestArgs = new NameValueCollection |
353 | { | 376 | { |
354 | { "RequestMethod", "GetScene" }, | 377 | { "RequestMethod", "GetScene" }, |
355 | { "SceneID", regionID.ToString() } | 378 | { "SceneID", regionID.ToString() } |
356 | }; | 379 | }; |
357 | 380 | ||
358 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); | 381 | m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); |
359 | 382 | ||
360 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 383 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); |
361 | if (response["Success"].AsBoolean()) | 384 | if (response["Success"].AsBoolean()) |
362 | { | 385 | { |
363 | return response["Enabled"].AsBoolean() ? REGION_ONLINE : 0; | 386 | OSDMap extraData = response["ExtraData"] as OSDMap; |
387 | int enabled = response["Enabled"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.RegionOnline : 0; | ||
388 | int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.Hyperlink : 0; | ||
389 | int flags = enabled | hypergrid; | ||
390 | m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags); | ||
391 | return flags; | ||
364 | } | 392 | } |
365 | else | 393 | else |
366 | { | 394 | { |
@@ -411,24 +439,27 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
411 | Vector3d minPosition = response["MinPosition"].AsVector3d(); | 439 | Vector3d minPosition = response["MinPosition"].AsVector3d(); |
412 | region.RegionLocX = (int)minPosition.X; | 440 | region.RegionLocX = (int)minPosition.X; |
413 | region.RegionLocY = (int)minPosition.Y; | 441 | region.RegionLocY = (int)minPosition.Y; |
414 | 442 | ||
415 | Uri httpAddress = response["Address"].AsUri(); | 443 | if ( ! extraData["HyperGrid"] ) { |
416 | region.ExternalHostName = httpAddress.Host; | 444 | Uri httpAddress = response["Address"].AsUri(); |
417 | region.HttpPort = (uint)httpAddress.Port; | 445 | region.ExternalHostName = httpAddress.Host; |
418 | 446 | region.HttpPort = (uint)httpAddress.Port; | |
419 | region.ServerURI = extraData["ServerURI"].AsString(); | 447 | |
420 | 448 | IPAddress internalAddress; | |
421 | IPAddress internalAddress; | 449 | IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress); |
422 | IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress); | 450 | if (internalAddress == null) |
423 | if (internalAddress == null) | 451 | internalAddress = IPAddress.Any; |
424 | internalAddress = IPAddress.Any; | 452 | |
425 | 453 | region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger()); | |
426 | region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger()); | 454 | region.TerrainImage = extraData["MapTexture"].AsUUID(); |
427 | region.TerrainImage = extraData["MapTexture"].AsUUID(); | 455 | region.Access = (byte)extraData["Access"].AsInteger(); |
428 | region.Access = (byte)extraData["Access"].AsInteger(); | 456 | region.RegionSecret = extraData["RegionSecret"].AsString(); |
429 | region.RegionSecret = extraData["RegionSecret"].AsString(); | 457 | region.EstateOwner = extraData["EstateOwner"].AsUUID(); |
430 | region.EstateOwner = extraData["EstateOwner"].AsUUID(); | 458 | region.Token = extraData["Token"].AsString(); |
431 | region.Token = extraData["Token"].AsString(); | 459 | region.ServerURI = extraData["ServerURI"].AsString(); |
460 | } else { | ||
461 | region.ServerURI = response["Address"]; | ||
462 | } | ||
432 | 463 | ||
433 | return region; | 464 | return region; |
434 | } | 465 | } |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 39df1f5..f828abb 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | |||
@@ -92,7 +92,10 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
92 | 92 | ||
93 | public SimianInventoryServiceConnector(string url) | 93 | public SimianInventoryServiceConnector(string url) |
94 | { | 94 | { |
95 | if (!url.EndsWith("/") && !url.EndsWith("=")) | ||
96 | url = url + '/'; | ||
95 | m_serverUrl = url; | 97 | m_serverUrl = url; |
98 | |||
96 | } | 99 | } |
97 | 100 | ||
98 | public void Initialise(IConfigSource source) | 101 | public void Initialise(IConfigSource source) |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 91e2976..4350749 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | |||
@@ -287,6 +287,10 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
287 | account.UserFlags = response["UserFlags"].AsInteger(); | 287 | account.UserFlags = response["UserFlags"].AsInteger(); |
288 | account.UserLevel = response["AccessLevel"].AsInteger(); | 288 | account.UserLevel = response["AccessLevel"].AsInteger(); |
289 | account.UserTitle = response["UserTitle"].AsString(); | 289 | account.UserTitle = response["UserTitle"].AsString(); |
290 | account.LocalToGrid = true; | ||
291 | if (response.ContainsKey("LocalToGrid")) | ||
292 | account.LocalToGrid = (response["LocalToGrid"].AsString() == "true" ? true : false); | ||
293 | |||
290 | GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); | 294 | GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); |
291 | 295 | ||
292 | // Cache the user account info | 296 | // Cache the user account info |