mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
* First draft resolution of mantis 777, 734, 389 - scripts do not save in non-home regions
* Should work in multi-region standalone and grid modes * This should also solve other non-home region caps issues (map requests, RC client inventory requests, etc) * We now pass CAPS information on to the destination region on region crossing, and set up a CAPS object when an agent becomes a master * Current limitation is that this will only work if your http_listener_port is 9000 * This is a very early code cut (lots of bad practice, hard coding and inefficiency). However, I wanted to get this out there for feedback and my own sanity. Next few patches will clean up the mess.
This commit is contained in:
@@ -62,7 +62,12 @@ namespace OpenSim.Region.Capabilities
|
||||
private string m_httpListenerHostName;
|
||||
private uint m_httpListenPort;
|
||||
|
||||
private string m_capsObjectPath = "00001-";
|
||||
/// <summary>
|
||||
/// This is the uuid portion of every CAPS path. It is used to make capability urls private to the requester.
|
||||
/// </summary>
|
||||
private string m_capsObjectPath;
|
||||
public string CapsObjectPath { get { return m_capsObjectPath; } }
|
||||
|
||||
private string m_requestPath = "0000/";
|
||||
private string m_mapLayerPath = "0001/";
|
||||
private string m_newInventory = "0002/";
|
||||
@@ -109,9 +114,12 @@ namespace OpenSim.Region.Capabilities
|
||||
|
||||
try
|
||||
{
|
||||
m_httpListener.RemoveStreamHandler("POST", capsBase + m_mapLayerPath);
|
||||
m_httpListener.AddStreamHandler(
|
||||
new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath,
|
||||
GetMapLayer));
|
||||
|
||||
m_httpListener.RemoveStreamHandler("POST", capsBase + m_newInventory);
|
||||
m_httpListener.AddStreamHandler(
|
||||
new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
|
||||
capsBase + m_newInventory,
|
||||
@@ -142,6 +150,7 @@ namespace OpenSim.Region.Capabilities
|
||||
private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod)
|
||||
{
|
||||
string capsBase = "/CAPS/" + m_capsObjectPath;
|
||||
httpListener.RemoveStreamHandler("POST", capsBase + path);
|
||||
httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod));
|
||||
}
|
||||
|
||||
|
||||
@@ -63,5 +63,7 @@ namespace OpenSim.Framework
|
||||
RegionStatus Region_Status { get; set; }
|
||||
|
||||
ClientManager ClientManager { get; }
|
||||
|
||||
string GetCapsPath(LLUUID agentId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,13 +70,22 @@ namespace OpenSim.Framework.Servers
|
||||
m_port = port;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a stream handler to the http server. If the handler already exists, then nothing happens.
|
||||
/// </summary>
|
||||
/// <param name="handler"></param>
|
||||
public void AddStreamHandler(IRequestHandler handler)
|
||||
{
|
||||
string httpMethod = handler.HttpMethod;
|
||||
string path = handler.Path;
|
||||
|
||||
string handlerKey = GetHandlerKey(httpMethod, path);
|
||||
m_streamHandlers.Add(handlerKey, handler);
|
||||
|
||||
if (!m_streamHandlers.ContainsKey(handlerKey))
|
||||
{
|
||||
//m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey);
|
||||
m_streamHandlers.Add(handlerKey, handler);
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetHandlerKey(string httpMethod, string path)
|
||||
@@ -289,7 +298,7 @@ namespace OpenSim.Framework.Servers
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Console.WriteLine("Handler not found for http request " + request.RawUrl);
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER] Handler not found for http request {0}", request.RawUrl);
|
||||
responseString = "Error";
|
||||
}
|
||||
}
|
||||
@@ -589,7 +598,11 @@ namespace OpenSim.Framework.Servers
|
||||
|
||||
public void RemoveStreamHandler(string httpMethod, string path)
|
||||
{
|
||||
m_streamHandlers.Remove(GetHandlerKey(httpMethod, path));
|
||||
string handlerKey = GetHandlerKey(httpMethod, path);
|
||||
|
||||
//m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey);
|
||||
|
||||
m_streamHandlers.Remove(handlerKey);
|
||||
}
|
||||
|
||||
public void RemoveHTTPHandler(string httpMethod, string path)
|
||||
|
||||
@@ -45,7 +45,6 @@ namespace OpenSim.Framework
|
||||
private static Random randomClass = new Random();
|
||||
private static uint nextXferID = 5000;
|
||||
private static object XferLock = new object();
|
||||
private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>();
|
||||
|
||||
// Get a list of invalid path characters (OS dependent)
|
||||
private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
|
||||
@@ -422,27 +421,6 @@ namespace OpenSim.Framework
|
||||
return ".";
|
||||
}
|
||||
|
||||
public static string GetCapsURL(LLUUID userID)
|
||||
{
|
||||
if (capsURLS.ContainsKey(userID))
|
||||
{
|
||||
return capsURLS[userID];
|
||||
}
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
public static void SetCapsURL(LLUUID userID, string url)
|
||||
{
|
||||
if (capsURLS.ContainsKey(userID))
|
||||
{
|
||||
capsURLS[userID] = url;
|
||||
}
|
||||
else
|
||||
{
|
||||
capsURLS.Add(userID, url);
|
||||
}
|
||||
}
|
||||
|
||||
// Nini (config) related Methods
|
||||
public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user