diff options
author | Justin Clark-Casey (justincc) | 2013-02-27 20:12:58 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-27 20:12:58 +0000 |
commit | 59bd099b0385cc79bba751e168ef26c923c9f003 (patch) | |
tree | 163203a0ffa27de0ddb15fb86401c65eb2155fe8 /OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |
parent | Improve description of GenerateMapTiles config option (diff) | |
download | opensim-SC_OLD-59bd099b0385cc79bba751e168ef26c923c9f003.zip opensim-SC_OLD-59bd099b0385cc79bba751e168ef26c923c9f003.tar.gz opensim-SC_OLD-59bd099b0385cc79bba751e168ef26c923c9f003.tar.bz2 opensim-SC_OLD-59bd099b0385cc79bba751e168ef26c923c9f003.tar.xz |
Add regression test for llReleaseUrl() (and for llRequestUrl)
Forgot to add file for llRequestUrl() test in commit b8a7c8b
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 79e633f..c9cd412 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -117,17 +117,22 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
117 | /// </summary> | 117 | /// </summary> |
118 | private Dictionary<string, UrlData> m_UrlMap = new Dictionary<string, UrlData>(); | 118 | private Dictionary<string, UrlData> m_UrlMap = new Dictionary<string, UrlData>(); |
119 | 119 | ||
120 | /// <summary> | ||
121 | /// Maximum number of external urls that can be set up by this module. | ||
122 | /// </summary> | ||
123 | private int m_TotalUrls = 100; | ||
124 | |||
125 | private uint m_HttpsPort = 0; | 120 | private uint m_HttpsPort = 0; |
126 | private IHttpServer m_HttpServer = null; | 121 | private IHttpServer m_HttpServer = null; |
127 | private IHttpServer m_HttpsServer = null; | 122 | private IHttpServer m_HttpsServer = null; |
128 | 123 | ||
129 | public string ExternalHostNameForLSL { get; private set; } | 124 | public string ExternalHostNameForLSL { get; private set; } |
130 | 125 | ||
126 | /// <summary> | ||
127 | /// The default maximum number of urls | ||
128 | /// </summary> | ||
129 | public const int DefaultTotalUrls = 100; | ||
130 | |||
131 | /// <summary> | ||
132 | /// Maximum number of external urls that can be set up by this module. | ||
133 | /// </summary> | ||
134 | public int TotalUrls { get; set; } | ||
135 | |||
131 | public Type ReplaceableInterface | 136 | public Type ReplaceableInterface |
132 | { | 137 | { |
133 | get { return null; } | 138 | get { return null; } |
@@ -158,7 +163,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
158 | IConfig llFunctionsConfig = config.Configs["LL-Functions"]; | 163 | IConfig llFunctionsConfig = config.Configs["LL-Functions"]; |
159 | 164 | ||
160 | if (llFunctionsConfig != null) | 165 | if (llFunctionsConfig != null) |
161 | m_TotalUrls = llFunctionsConfig.GetInt("max_external_urls_per_simulator", m_TotalUrls); | 166 | TotalUrls = llFunctionsConfig.GetInt("max_external_urls_per_simulator", DefaultTotalUrls); |
167 | else | ||
168 | TotalUrls = DefaultTotalUrls; | ||
162 | } | 169 | } |
163 | 170 | ||
164 | public void PostInitialise() | 171 | public void PostInitialise() |
@@ -209,7 +216,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
209 | 216 | ||
210 | lock (m_UrlMap) | 217 | lock (m_UrlMap) |
211 | { | 218 | { |
212 | if (m_UrlMap.Count >= m_TotalUrls) | 219 | if (m_UrlMap.Count >= TotalUrls) |
213 | { | 220 | { |
214 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 221 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
215 | return urlcode; | 222 | return urlcode; |
@@ -254,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
254 | 261 | ||
255 | lock (m_UrlMap) | 262 | lock (m_UrlMap) |
256 | { | 263 | { |
257 | if (m_UrlMap.Count >= m_TotalUrls) | 264 | if (m_UrlMap.Count >= TotalUrls) |
258 | { | 265 | { |
259 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 266 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
260 | return urlcode; | 267 | return urlcode; |
@@ -382,7 +389,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
382 | public int GetFreeUrls() | 389 | public int GetFreeUrls() |
383 | { | 390 | { |
384 | lock (m_UrlMap) | 391 | lock (m_UrlMap) |
385 | return m_TotalUrls - m_UrlMap.Count; | 392 | return TotalUrls - m_UrlMap.Count; |
386 | } | 393 | } |
387 | 394 | ||
388 | public void ScriptRemoved(UUID itemID) | 395 | public void ScriptRemoved(UUID itemID) |