diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index 05d54f03a2..38633a0e6d 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -119,15 +119,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
///
private int m_TotalUrls = 100;
- private uint https_port = 0;
+ private uint m_HttpsPort = 0;
private IHttpServer m_HttpServer = null;
private IHttpServer m_HttpsServer = null;
- private string m_ExternalHostNameForLSL = "";
- public string ExternalHostNameForLSL
- {
- get { return m_ExternalHostNameForLSL; }
- }
+ public string ExternalHostNameForLSL { get; private set; }
public Type ReplaceableInterface
{
@@ -141,11 +137,20 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
public void Initialise(IConfigSource config)
{
- m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName);
- bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false);
+ IConfig networkConfig = config.Configs["Network"];
- if (ssl_enabled)
- https_port = (uint) config.Configs["Network"].GetInt("https_port",0);
+ if (networkConfig != null)
+ {
+ ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", null);
+
+ bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener", false);
+
+ if (ssl_enabled)
+ m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort);
+ }
+
+ if (ExternalHostNameForLSL == null)
+ ExternalHostNameForLSL = System.Environment.MachineName;
IConfig llFunctionsConfig = config.Configs["LL-Functions"];
@@ -166,9 +171,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
m_HttpServer = MainServer.Instance;
//
// We can use the https if it is enabled
- if (https_port > 0)
+ if (m_HttpsPort > 0)
{
- m_HttpsServer = MainServer.GetHttpServer(https_port);
+ m_HttpsServer = MainServer.GetHttpServer(m_HttpsPort);
}
}
@@ -206,7 +211,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
return urlcode;
}
- string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";
+ string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";
UrlData urlData = new UrlData();
urlData.hostID = host.UUID;
@@ -251,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
return urlcode;
}
- string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/";
+ string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/";
UrlData urlData = new UrlData();
urlData.hostID = host.UUID;
@@ -545,9 +550,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
string url;
if (is_ssl)
- url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp;
+ url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp;
else
- url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp;
+ url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp;
// Avoid a race - the request URL may have been released via llRequestUrl() whilst this
// request was being processed.
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index 143af48d99..ced4e91e6d 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -52,7 +52,18 @@ namespace OpenSim.Region.Framework.Interfaces
string GetXMLState(UUID itemID);
bool SetXMLState(UUID itemID, string xml);
+ ///
+ /// Post a script event to a single script.
+ ///
+ /// true if the post suceeded, false if it did not
+ /// The item ID of the script.
+ /// The name of the event.
+ ///
+ /// The arguments of the event. These are in the order in which they appear.
+ /// e.g. for http_request this will be an object array of key request_id, string method, string body
+ ///
bool PostScriptEvent(UUID itemID, string name, Object[] args);
+
bool PostObjectEvent(UUID itemID, string name, Object[] args);
///
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c2c025bbb7..a4a4b9480c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9317,6 +9317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return UUID.Zero.ToString();
}
}
+
public LSL_String llRequestURL()
{
m_host.AddScriptLPS(1);
diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs
index 78bab5b8fe..6a53fe7810 100644
--- a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs
+++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs
@@ -40,10 +40,33 @@ namespace OpenSim.Tests.Common
{
public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine
{
+ public IConfigSource ConfigSource { get; private set; }
+
+ public IConfig Config { get; private set; }
+
private Scene m_scene;
+ ///
+ /// Expose posted events to tests.
+ ///
+ public Dictionary> PostedEvents { get; private set; }
+
+ ///
+ /// A very primitive way of hooking text cose to a posed event.
+ ///
+ ///
+ /// May be replaced with something that uses more original code in the future.
+ ///
+ public event Action PostEventHook;
+
public void Initialise(IConfigSource source)
{
+ ConfigSource = source;
+
+ // Can set later on if required
+ Config = new IniConfig("MockScriptEngine", ConfigSource);
+
+ PostedEvents = new Dictionary>();
}
public void Close()
@@ -85,7 +108,28 @@ namespace OpenSim.Tests.Common
public bool PostScriptEvent(UUID itemID, string name, object[] args)
{
- return false;
+// Console.WriteLine("Posting event {0} for {1}", name, itemID);
+
+ EventParams evParams = new EventParams(name, args, null);
+
+ List eventsForItem;
+
+ if (!PostedEvents.ContainsKey(itemID))
+ {
+ eventsForItem = new List();
+ PostedEvents.Add(itemID, eventsForItem);
+ }
+ else
+ {
+ eventsForItem = PostedEvents[itemID];
+ }
+
+ eventsForItem.Add(evParams);
+
+ if (PostEventHook != null)
+ PostEventHook(itemID, evParams);
+
+ return true;
}
public bool PostObjectEvent(UUID itemID, string name, object[] args)
@@ -195,11 +239,7 @@ namespace OpenSim.Tests.Common
public Scene World { get { return m_scene; } }
- public IScriptModule ScriptModule { get { throw new System.NotImplementedException(); } }
-
- public IConfig Config { get { throw new System.NotImplementedException (); } }
-
- public IConfigSource ConfigSource { get { throw new System.NotImplementedException (); } }
+ public IScriptModule ScriptModule { get { return this; } }
public string ScriptEnginePath { get { throw new System.NotImplementedException (); }}
@@ -210,5 +250,10 @@ namespace OpenSim.Tests.Common
public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } }
public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } }
+
+ public void ClearPostedEvents()
+ {
+ PostedEvents.Clear();
+ }
}
}
\ No newline at end of file
diff --git a/prebuild.xml b/prebuild.xml
index e6f8353902..ab2d6d5c6a 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -3276,6 +3276,8 @@
+
+