From 309eb712a32fe14f593941b9f0a5ce41f10bcd7f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Mar 2011 19:34:55 -0700 Subject: Improvement over 2 commits ago: make the hyperlink check understand port 80. --- OpenSim/Services/GridService/HypergridLinker.cs | 33 ++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 585d088..c539047 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -66,6 +66,7 @@ namespace OpenSim.Services.GridService protected bool m_Check4096 = true; protected string m_MapTileDirectory = string.Empty; protected string m_ThisGatekeeper = string.Empty; + protected Uri m_ThisGatekeeperURI = null; // Hyperlink regions are hyperlinks on the map public readonly Dictionary m_HyperlinkRegions = new Dictionary(); @@ -125,6 +126,14 @@ namespace OpenSim.Services.GridService m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty); + try + { + m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper); + } + catch + { + m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); + } m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); @@ -249,6 +258,8 @@ namespace OpenSim.Services.GridService remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); reason = string.Empty; + Uri uri = null; + regInfo = new GridRegion(); if ( externalPort > 0) regInfo.HttpPort = externalPort; @@ -259,8 +270,17 @@ namespace OpenSim.Services.GridService else regInfo.ExternalHostName = "0.0.0.0"; if ( serverURI != null) + { regInfo.ServerURI = serverURI; - + try + { + uri = new Uri(serverURI); + regInfo.ExternalHostName = uri.Host; + regInfo.HttpPort = (uint)uri.Port; + } + catch {} + } + if ( remoteRegionName != string.Empty ) regInfo.RegionName = remoteRegionName; @@ -270,11 +290,16 @@ namespace OpenSim.Services.GridService regInfo.EstateOwner = ownerID; // Make sure we're not hyperlinking to regions on this grid! - if (regInfo.ServerURI.Trim(new char[]{'/', ' '}) == m_ThisGatekeeper.Trim(new char[]{'/', ' '})) + if (m_ThisGatekeeperURI != null) { - reason = "Cannot hyperlink to regions on the same grid"; - return false; + if (regInfo.ExternalHostName == m_ThisGatekeeperURI.Host && regInfo.HttpPort == m_ThisGatekeeperURI.Port) + { + reason = "Cannot hyperlink to regions on the same grid"; + return false; + } } + else + m_log.WarnFormat("[HYPERGRID LINKER]: Please set this grid's Gatekeeper's address in [GridService]!"); // Check for free coordinates GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); -- cgit v1.1