* Move common string aggregation for caps seed path to a method in CapsUtil

0.6.2-post-fixes
Justin Clarke Casey 2009-01-06 18:06:53 +00:00
parent e8dba51247
commit 715a776f7d
6 changed files with 33 additions and 15 deletions

View File

@ -35,6 +35,16 @@ namespace OpenSim.Framework.Communications.Capabilities
/// </summary>
public class CapsUtil
{
/// <summary>
/// Generate a CAPS seed path using a previously generated CAPS object path component
/// </summary>
/// <param name="capsKey"></param>
/// <returns></returns>
public static string GetCapsSeedPath(string capsObjectPath)
{
return "/CAPS/" + capsKey + "0000/";
}
public static string GetRandomCapsPath()
{
UUID caps = UUID.Random();

View File

@ -309,9 +309,8 @@ namespace OpenSim.Grid.UserServer
response.RegionX = regionInfo.regionLocX;
response.RegionY = regionInfo.regionLocY;
//Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
string capsPath = CapsUtil.GetRandomCapsPath();
response.SeedCapability = regionInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
response.SeedCapability = regionInfo.httpServerURI + CapsUtil.GetCapsSeedPath(capsPath);
// Notify the target of an incoming user
m_log.InfoFormat(

View File

@ -297,20 +297,21 @@ namespace OpenSim.Region.Communications.Local
response.RegionY = regionInfo.RegionLocY;
string capsPath = CapsUtil.GetRandomCapsPath();
string capsSeedPath = CapsUtil.GetCapsSeedPath(capsPath);
// Don't use the following! It Fails for logging into any region not on the same port as the http server!
// Kept here so it doesn't happen again!
// response.SeedCapability = regionInfo.ServerURI + "/CAPS/" + capsPath + "0000/";
// response.SeedCapability = regionInfo.ServerURI + capsSeedPath;
string seedcap = "http://";
if (serversInfo.HttpUsesSSL)
{
seedcap = "https://" + serversInfo.HttpSSLCN + ":" + serversInfo.httpSSLPort + "/CAPS/" + capsPath + "0000/";
seedcap = "https://" + serversInfo.HttpSSLCN + ":" + serversInfo.httpSSLPort + capsSeedPath;
}
else
{
seedcap = "http://" + regionInfo.ExternalHostName + ":" + serversInfo.HttpListenerPort + "/CAPS/" + capsPath + "0000/";
seedcap = "http://" + regionInfo.ExternalHostName + ":" + serversInfo.HttpListenerPort + capsSeedPath;
}
response.SeedCapability = seedcap;

View File

@ -576,10 +576,14 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
}
// DEPRECIATED
responseMap["seed_capability"] = OSD.FromString(regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/CAPS/" + userCap.CapsObjectPath + "0000/");
responseMap["seed_capability"]
= OSD.FromString(
regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath));
// REPLACEMENT
responseMap["region_seed_capability"] = OSD.FromString(regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/CAPS/" + userCap.CapsObjectPath + "0000/");
responseMap["region_seed_capability"]
= OSD.FromString(
regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath));
responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath);
responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath);

View File

@ -210,10 +210,12 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink)
{
// TODO Should construct this behind a method
capsPath =
"http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + agentCircuit.CapsPath + "0000/";
capsPath
= "http://"
+ reg.ExternalHostName
+ ":"
+ reg.HttpPort
+ CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
if (eq != null)
{

View File

@ -801,10 +801,12 @@ namespace OpenSim.Region.Environment.Scenes
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
{
// TODO Should construct this behind a method
capsPath =
"http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + agentCircuit.CapsPath + "0000/";
capsPath
= "http://"
+ reg.ExternalHostName
+ ":"
+ reg.HttpPort
+ CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
if (eq != null)
{