aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
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/CoreModules/Scripting/LSLHttp/UrlModule.cs
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/CoreModules/Scripting/LSLHttp/UrlModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs37
1 files changed, 21 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.