aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-02-26 23:36:36 +0000
committerJustin Clark-Casey (justincc)2013-02-26 23:36:36 +0000
commitb8a7c8b26f3005eed5b161c37509b06b1d604967 (patch)
tree67304ff03ac6331b33bfa75201da1a529feec0bd /OpenSim/Region
parentBulletSim: fix crash around race condition when a mesh asset cannot (diff)
downloadopensim-SC_OLD-b8a7c8b26f3005eed5b161c37509b06b1d604967.zip
opensim-SC_OLD-b8a7c8b26f3005eed5b161c37509b06b1d604967.tar.gz
opensim-SC_OLD-b8a7c8b26f3005eed5b161c37509b06b1d604967.tar.bz2
opensim-SC_OLD-b8a7c8b26f3005eed5b161c37509b06b1d604967.tar.xz
Add regression test for llRequestUrl()
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs37
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModule.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs1
3 files changed, 33 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index be617a5..79e633f 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -122,15 +122,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
122 /// </summary> 122 /// </summary>
123 private int m_TotalUrls = 100; 123 private int m_TotalUrls = 100;
124 124
125 private uint https_port = 0; 125 private uint m_HttpsPort = 0;
126 private IHttpServer m_HttpServer = null; 126 private IHttpServer m_HttpServer = null;
127 private IHttpServer m_HttpsServer = null; 127 private IHttpServer m_HttpsServer = null;
128 128
129 private string m_ExternalHostNameForLSL = ""; 129 public string ExternalHostNameForLSL { get; private set; }
130 public string ExternalHostNameForLSL
131 {
132 get { return m_ExternalHostNameForLSL; }
133 }
134 130
135 public Type ReplaceableInterface 131 public Type ReplaceableInterface
136 { 132 {
@@ -144,11 +140,20 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
144 140
145 public void Initialise(IConfigSource config) 141 public void Initialise(IConfigSource config)
146 { 142 {
147 m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); 143 IConfig networkConfig = config.Configs["Network"];
148 bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false); 144
145 if (networkConfig != null)
146 {
147 ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", null);
148
149 bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener", false);
150
151 if (ssl_enabled)
152 m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort);
153 }
149 154
150 if (ssl_enabled) 155 if (ExternalHostNameForLSL == null)
151 https_port = (uint) config.Configs["Network"].GetInt("https_port",0); 156 ExternalHostNameForLSL = System.Environment.MachineName;
152 157
153 IConfig llFunctionsConfig = config.Configs["LL-Functions"]; 158 IConfig llFunctionsConfig = config.Configs["LL-Functions"];
154 159
@@ -169,9 +174,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
169 m_HttpServer = MainServer.Instance; 174 m_HttpServer = MainServer.Instance;
170 // 175 //
171 // We can use the https if it is enabled 176 // We can use the https if it is enabled
172 if (https_port > 0) 177 if (m_HttpsPort > 0)
173 { 178 {
174 m_HttpsServer = MainServer.GetHttpServer(https_port); 179 m_HttpsServer = MainServer.GetHttpServer(m_HttpsPort);
175 } 180 }
176 } 181 }
177 182
@@ -209,7 +214,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
209 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); 214 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
210 return urlcode; 215 return urlcode;
211 } 216 }
212 string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; 217 string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";
213 218
214 UrlData urlData = new UrlData(); 219 UrlData urlData = new UrlData();
215 urlData.hostID = host.UUID; 220 urlData.hostID = host.UUID;
@@ -254,7 +259,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
254 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); 259 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
255 return urlcode; 260 return urlcode;
256 } 261 }
257 string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; 262 string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/";
258 263
259 UrlData urlData = new UrlData(); 264 UrlData urlData = new UrlData();
260 urlData.hostID = host.UUID; 265 urlData.hostID = host.UUID;
@@ -579,9 +584,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
579 string url; 584 string url;
580 585
581 if (is_ssl) 586 if (is_ssl)
582 url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; 587 url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp;
583 else 588 else
584 url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; 589 url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp;
585 590
586 // Avoid a race - the request URL may have been released via llRequestUrl() whilst this 591 // Avoid a race - the request URL may have been released via llRequestUrl() whilst this
587 // request was being processed. 592 // request was being processed.
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index 143af48..ced4e91 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -52,7 +52,18 @@ namespace OpenSim.Region.Framework.Interfaces
52 string GetXMLState(UUID itemID); 52 string GetXMLState(UUID itemID);
53 bool SetXMLState(UUID itemID, string xml); 53 bool SetXMLState(UUID itemID, string xml);
54 54
55 /// <summary>
56 /// Post a script event to a single script.
57 /// </summary>
58 /// <returns>true if the post suceeded, false if it did not</returns>
59 /// <param name='itemID'>The item ID of the script.</param>
60 /// <param name='name'>The name of the event.</param>
61 /// <param name='args'>
62 /// The arguments of the event. These are in the order in which they appear.
63 /// e.g. for http_request this will be an object array of key request_id, string method, string body
64 /// </param>
55 bool PostScriptEvent(UUID itemID, string name, Object[] args); 65 bool PostScriptEvent(UUID itemID, string name, Object[] args);
66
56 bool PostObjectEvent(UUID itemID, string name, Object[] args); 67 bool PostObjectEvent(UUID itemID, string name, Object[] args);
57 68
58 /// <summary> 69 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 96f650e..6a31568 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9423,6 +9423,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9423 return UUID.Zero.ToString(); 9423 return UUID.Zero.ToString();
9424 } 9424 }
9425 } 9425 }
9426
9426 public LSL_String llRequestURL() 9427 public LSL_String llRequestURL()
9427 { 9428 {
9428 m_host.AddScriptLPS(1); 9429 m_host.AddScriptLPS(1);