From b6cfe15c7c0b3697709179cbbf32818576919642 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 24 Dec 2011 07:44:26 -0800 Subject: HG: more / love for Xmas --- .../Connectors/Hypergrid/HeloServiceConnector.cs | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/Connectors/Hypergrid') diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs index ff1dd5f..8ac89cc 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs @@ -47,13 +47,36 @@ namespace OpenSim.Services.Connectors public HeloServicesConnector(string serverURI) { - m_ServerURI = serverURI.TrimEnd('/'); + if (!serverURI.EndsWith("=")) + m_ServerURI = serverURI.TrimEnd('/') + "/helo/"; + else + { + // Simian sends malformed urls like this: + // http://valley.virtualportland.org/simtest/Grid/?id= + // + try + { + Uri uri = new Uri(serverURI + "xxx"); + if (uri.Query == string.Empty) + m_ServerURI = serverURI.TrimEnd('/') + "/helo/"; + else + { + serverURI = serverURI + "xxx"; + m_ServerURI = serverURI.Replace("?" + uri.Query, ""); + m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/"; + } + } + catch (UriFormatException e) + { + m_log.WarnFormat("[HELO SERVICE]: Malformed URL {0}", serverURI); + } + } } public virtual string Helo() { - HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo/"); + HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); // Eventually we need to switch to HEAD /* req.Method = "HEAD"; */ -- cgit v1.1