HG: more / love for Xmas

iar_mods
Diva Canto 2011-12-24 07:44:26 -08:00
parent f9a1fd5748
commit b6cfe15c7c
4 changed files with 50 additions and 6 deletions

View File

@ -385,8 +385,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
string assetServerURL = string.Empty; string assetServerURL = string.Empty;
if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL)) if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL))
{ {
m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id); if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("="))
AssetService.Get(assetServerURL + "/" + id, InventoryAccessModule, AssetReceived); assetServerURL = assetServerURL + "/";
m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", assetServerURL + id);
AssetService.Get(assetServerURL + id, InventoryAccessModule, AssetReceived);
return; return;
} }
} }

View File

@ -29,7 +29,9 @@ using log4net;
using Nini.Config; using Nini.Config;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Reflection; using System.Reflection;
using System.Web;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors.Hypergrid; using OpenSim.Services.Connectors.Hypergrid;
@ -72,12 +74,27 @@ namespace OpenSim.Services.Connectors
if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) && if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) &&
assetUri.Scheme == Uri.UriSchemeHttp) assetUri.Scheme == Uri.UriSchemeHttp)
{
// Simian
if (assetUri.Query != string.Empty)
{
NameValueCollection qscoll = HttpUtility.ParseQueryString(assetUri.Query);
assetID = qscoll["id"];
if (assetID != null)
url = id.Replace(assetID, ""); // Malformed again, as simian expects
else
url = id; // !!! best effort
}
else // robust
{ {
url = "http://" + assetUri.Authority; url = "http://" + assetUri.Authority;
assetID = assetUri.LocalPath.Trim(new char[] { '/' }); assetID = assetUri.LocalPath.Trim(new char[] { '/' });
}
return true; return true;
} }
m_log.DebugFormat("[HG ASSET SERVICE]: Malformed URL {0}", id);
return false; return false;
} }

View File

@ -47,13 +47,36 @@ namespace OpenSim.Services.Connectors
public HeloServicesConnector(string serverURI) 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() 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 // Eventually we need to switch to HEAD
/* req.Method = "HEAD"; */ /* req.Method = "HEAD"; */

View File

@ -926,6 +926,7 @@
<ReferencePath>../../../bin/</ReferencePath> <ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Core"/> <Reference name="System.Core"/>
<Reference name="System.Web"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../bin/"/>