diff options
author | Melanie Thielker | 2016-03-16 20:04:52 +0100 |
---|---|---|
committer | Melanie Thielker | 2016-03-16 20:04:52 +0100 |
commit | e8b46023e47399e9dcc0057a4380ca4fe49908ee (patch) | |
tree | aa384c79130605f8e5740f689a81226cc47f9335 /OpenSim/Region/ScriptEngine | |
parent | Implement Access-Control-Allow-Origin for HTTP LSL server (diff) | |
download | opensim-SC-e8b46023e47399e9dcc0057a4380ca4fe49908ee.zip opensim-SC-e8b46023e47399e9dcc0057a4380ca4fe49908ee.tar.gz opensim-SC-e8b46023e47399e9dcc0057a4380ca4fe49908ee.tar.bz2 opensim-SC-e8b46023e47399e9dcc0057a4380ca4fe49908ee.tar.xz |
Add osRequestURL and osRequestSecureURL with an options list.
Only currently supported option is "allowXss" which will send the needed
Access-control-allow-origin: * header to allow xss scripting against
the LSL http server.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
4 files changed, 51 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a2abbeb..f48d42d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -12039,7 +12039,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12039 | { | 12039 | { |
12040 | m_host.AddScriptLPS(1); | 12040 | m_host.AddScriptLPS(1); |
12041 | if (m_UrlModule != null) | 12041 | if (m_UrlModule != null) |
12042 | return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID).ToString(); | 12042 | return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, null).ToString(); |
12043 | return UUID.Zero.ToString(); | 12043 | return UUID.Zero.ToString(); |
12044 | } | 12044 | } |
12045 | 12045 | ||
@@ -12157,7 +12157,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12157 | m_host.AddScriptLPS(1); | 12157 | m_host.AddScriptLPS(1); |
12158 | 12158 | ||
12159 | if (m_UrlModule != null) | 12159 | if (m_UrlModule != null) |
12160 | return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID).ToString(); | 12160 | return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, null).ToString(); |
12161 | return UUID.Zero.ToString(); | 12161 | return UUID.Zero.ToString(); |
12162 | } | 12162 | } |
12163 | 12163 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index bda323a..7e88365 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -4134,5 +4134,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4134 | return 0; | 4134 | return 0; |
4135 | } | 4135 | } |
4136 | } | 4136 | } |
4137 | |||
4138 | public LSL_String osRequestURL(LSL_List options) | ||
4139 | { | ||
4140 | CheckThreatLevel(ThreatLevel.Moderate, "osRequestSecureURL"); | ||
4141 | m_host.AddScriptLPS(1); | ||
4142 | |||
4143 | Hashtable opts = new Hashtable(); | ||
4144 | for (int i = 0 ; i < options.Length ; i++) | ||
4145 | { | ||
4146 | object opt = options.Data[i]; | ||
4147 | if (opt.ToString() == "allowXss") | ||
4148 | opts["allowXss"] = true; | ||
4149 | } | ||
4150 | |||
4151 | if (m_UrlModule != null) | ||
4152 | return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, opts).ToString(); | ||
4153 | return UUID.Zero.ToString(); | ||
4154 | } | ||
4155 | |||
4156 | public LSL_String osRequestSecureURL(LSL_List options) | ||
4157 | { | ||
4158 | CheckThreatLevel(ThreatLevel.Moderate, "osRequestSecureURL"); | ||
4159 | m_host.AddScriptLPS(1); | ||
4160 | |||
4161 | Hashtable opts = new Hashtable(); | ||
4162 | for (int i = 0 ; i < options.Length ; i++) | ||
4163 | { | ||
4164 | object opt = options.Data[i]; | ||
4165 | if (opt.ToString() == "allowXss") | ||
4166 | opts["allowXss"] = true; | ||
4167 | } | ||
4168 | |||
4169 | if (m_UrlModule != null) | ||
4170 | return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, opts).ToString(); | ||
4171 | return UUID.Zero.ToString(); | ||
4172 | } | ||
4137 | } | 4173 | } |
4138 | } | 4174 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 4e567e6..6fc5db4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -468,5 +468,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
468 | /// <param name="regex">string to use as pattern</param> | 468 | /// <param name="regex">string to use as pattern</param> |
469 | /// <returns>boolean</returns> | 469 | /// <returns>boolean</returns> |
470 | LSL_Integer osRegexIsMatch(string input, string pattern); | 470 | LSL_Integer osRegexIsMatch(string input, string pattern); |
471 | |||
472 | LSL_String osRequestURL(LSL_List options); | ||
473 | LSL_String osRequestSecureURL(LSL_List options); | ||
471 | } | 474 | } |
472 | } | 475 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 31393bb..ee07eee 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -1054,5 +1054,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1054 | { | 1054 | { |
1055 | return m_OSSL_Functions.osRegexIsMatch(input, pattern); | 1055 | return m_OSSL_Functions.osRegexIsMatch(input, pattern); |
1056 | } | 1056 | } |
1057 | |||
1058 | public LSL_String osRequestURL(LSL_List options) | ||
1059 | { | ||
1060 | return m_OSSL_Functions.osRequestURL(options); | ||
1061 | } | ||
1062 | |||
1063 | public LSL_String osRequestSecureURL(LSL_List options) | ||
1064 | { | ||
1065 | return m_OSSL_Functions.osRequestSecureURL(options); | ||
1066 | } | ||
1057 | } | 1067 | } |
1058 | } | 1068 | } |