aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-03-20 20:04:45 +0000
committerJustin Clarke Casey2008-03-20 20:04:45 +0000
commitc1beb85315aad09197ca7ffaa8ec194346af82cb (patch)
tree2554ed107ef378a3fdab9ec23d6760a6962a92a0 /OpenSim/Framework
parentAdded back a fix that lbsa71 did aqes ago to fix a buffer overflow in the pac... (diff)
downloadopensim-SC-c1beb85315aad09197ca7ffaa8ec194346af82cb.zip
opensim-SC-c1beb85315aad09197ca7ffaa8ec194346af82cb.tar.gz
opensim-SC-c1beb85315aad09197ca7ffaa8ec194346af82cb.tar.bz2
opensim-SC-c1beb85315aad09197ca7ffaa8ec194346af82cb.tar.xz
* 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.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs11
-rw-r--r--OpenSim/Framework/IScene.cs2
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs19
-rw-r--r--OpenSim/Framework/Util.cs22
4 files changed, 28 insertions, 26 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index 878b0cc..fad4741 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -62,7 +62,12 @@ namespace OpenSim.Region.Capabilities
62 private string m_httpListenerHostName; 62 private string m_httpListenerHostName;
63 private uint m_httpListenPort; 63 private uint m_httpListenPort;
64 64
65 private string m_capsObjectPath = "00001-"; 65 /// <summary>
66 /// This is the uuid portion of every CAPS path. It is used to make capability urls private to the requester.
67 /// </summary>
68 private string m_capsObjectPath;
69 public string CapsObjectPath { get { return m_capsObjectPath; } }
70
66 private string m_requestPath = "0000/"; 71 private string m_requestPath = "0000/";
67 private string m_mapLayerPath = "0001/"; 72 private string m_mapLayerPath = "0001/";
68 private string m_newInventory = "0002/"; 73 private string m_newInventory = "0002/";
@@ -109,9 +114,12 @@ namespace OpenSim.Region.Capabilities
109 114
110 try 115 try
111 { 116 {
117 m_httpListener.RemoveStreamHandler("POST", capsBase + m_mapLayerPath);
112 m_httpListener.AddStreamHandler( 118 m_httpListener.AddStreamHandler(
113 new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, 119 new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath,
114 GetMapLayer)); 120 GetMapLayer));
121
122 m_httpListener.RemoveStreamHandler("POST", capsBase + m_newInventory);
115 m_httpListener.AddStreamHandler( 123 m_httpListener.AddStreamHandler(
116 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", 124 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
117 capsBase + m_newInventory, 125 capsBase + m_newInventory,
@@ -142,6 +150,7 @@ namespace OpenSim.Region.Capabilities
142 private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) 150 private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod)
143 { 151 {
144 string capsBase = "/CAPS/" + m_capsObjectPath; 152 string capsBase = "/CAPS/" + m_capsObjectPath;
153 httpListener.RemoveStreamHandler("POST", capsBase + path);
145 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); 154 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod));
146 } 155 }
147 156
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index 869ca60..cdf6257 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -63,5 +63,7 @@ namespace OpenSim.Framework
63 RegionStatus Region_Status { get; set; } 63 RegionStatus Region_Status { get; set; }
64 64
65 ClientManager ClientManager { get; } 65 ClientManager ClientManager { get; }
66
67 string GetCapsPath(LLUUID agentId);
66 } 68 }
67} 69}
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 0fb8314..0f6d79b 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -70,13 +70,22 @@ namespace OpenSim.Framework.Servers
70 m_port = port; 70 m_port = port;
71 } 71 }
72 72
73 /// <summary>
74 /// Add a stream handler to the http server. If the handler already exists, then nothing happens.
75 /// </summary>
76 /// <param name="handler"></param>
73 public void AddStreamHandler(IRequestHandler handler) 77 public void AddStreamHandler(IRequestHandler handler)
74 { 78 {
75 string httpMethod = handler.HttpMethod; 79 string httpMethod = handler.HttpMethod;
76 string path = handler.Path; 80 string path = handler.Path;
77 81
78 string handlerKey = GetHandlerKey(httpMethod, path); 82 string handlerKey = GetHandlerKey(httpMethod, path);
79 m_streamHandlers.Add(handlerKey, handler); 83
84 if (!m_streamHandlers.ContainsKey(handlerKey))
85 {
86 //m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey);
87 m_streamHandlers.Add(handlerKey, handler);
88 }
80 } 89 }
81 90
82 private static string GetHandlerKey(string httpMethod, string path) 91 private static string GetHandlerKey(string httpMethod, string path)
@@ -289,7 +298,7 @@ namespace OpenSim.Framework.Servers
289 } 298 }
290 else 299 else
291 { 300 {
292 System.Console.WriteLine("Handler not found for http request " + request.RawUrl); 301 m_log.ErrorFormat("[BASE HTTP SERVER] Handler not found for http request {0}", request.RawUrl);
293 responseString = "Error"; 302 responseString = "Error";
294 } 303 }
295 } 304 }
@@ -589,7 +598,11 @@ namespace OpenSim.Framework.Servers
589 598
590 public void RemoveStreamHandler(string httpMethod, string path) 599 public void RemoveStreamHandler(string httpMethod, string path)
591 { 600 {
592 m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); 601 string handlerKey = GetHandlerKey(httpMethod, path);
602
603 //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey);
604
605 m_streamHandlers.Remove(handlerKey);
593 } 606 }
594 607
595 public void RemoveHTTPHandler(string httpMethod, string path) 608 public void RemoveHTTPHandler(string httpMethod, string path)
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index e16d15e..6c95c88 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -45,7 +45,6 @@ namespace OpenSim.Framework
45 private static Random randomClass = new Random(); 45 private static Random randomClass = new Random();
46 private static uint nextXferID = 5000; 46 private static uint nextXferID = 5000;
47 private static object XferLock = new object(); 47 private static object XferLock = new object();
48 private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>();
49 48
50 // Get a list of invalid path characters (OS dependent) 49 // Get a list of invalid path characters (OS dependent)
51 private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]"; 50 private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
@@ -422,27 +421,6 @@ namespace OpenSim.Framework
422 return "."; 421 return ".";
423 } 422 }
424 423
425 public static string GetCapsURL(LLUUID userID)
426 {
427 if (capsURLS.ContainsKey(userID))
428 {
429 return capsURLS[userID];
430 }
431 return String.Empty;
432 }
433
434 public static void SetCapsURL(LLUUID userID, string url)
435 {
436 if (capsURLS.ContainsKey(userID))
437 {
438 capsURLS[userID] = url;
439 }
440 else
441 {
442 capsURLS.Add(userID, url);
443 }
444 }
445
446 // Nini (config) related Methods 424 // Nini (config) related Methods
447 public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName) 425 public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName)
448 { 426 {