aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs62
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs16
2 files changed, 47 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index be617a5..c9cd412 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -117,20 +117,21 @@ 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> 120 private uint m_HttpsPort = 0;
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 https_port = 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 private string m_ExternalHostNameForLSL = ""; 124 public string ExternalHostNameForLSL { get; private set; }
130 public string ExternalHostNameForLSL 125
131 { 126 /// <summary>
132 get { return m_ExternalHostNameForLSL; } 127 /// The default maximum number of urls
133 } 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; }
134 135
135 public Type ReplaceableInterface 136 public Type ReplaceableInterface
136 { 137 {
@@ -144,16 +145,27 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
144 145
145 public void Initialise(IConfigSource config) 146 public void Initialise(IConfigSource config)
146 { 147 {
147 m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); 148 IConfig networkConfig = config.Configs["Network"];
148 bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false); 149
150 if (networkConfig != null)
151 {
152 ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", null);
153
154 bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener", false);
155
156 if (ssl_enabled)
157 m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort);
158 }
149 159
150 if (ssl_enabled) 160 if (ExternalHostNameForLSL == null)
151 https_port = (uint) config.Configs["Network"].GetInt("https_port",0); 161 ExternalHostNameForLSL = System.Environment.MachineName;
152 162
153 IConfig llFunctionsConfig = config.Configs["LL-Functions"]; 163 IConfig llFunctionsConfig = config.Configs["LL-Functions"];
154 164
155 if (llFunctionsConfig != null) 165 if (llFunctionsConfig != null)
156 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;
157 } 169 }
158 170
159 public void PostInitialise() 171 public void PostInitialise()
@@ -169,9 +181,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
169 m_HttpServer = MainServer.Instance; 181 m_HttpServer = MainServer.Instance;
170 // 182 //
171 // We can use the https if it is enabled 183 // We can use the https if it is enabled
172 if (https_port > 0) 184 if (m_HttpsPort > 0)
173 { 185 {
174 m_HttpsServer = MainServer.GetHttpServer(https_port); 186 m_HttpsServer = MainServer.GetHttpServer(m_HttpsPort);
175 } 187 }
176 } 188 }
177 189
@@ -204,12 +216,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
204 216
205 lock (m_UrlMap) 217 lock (m_UrlMap)
206 { 218 {
207 if (m_UrlMap.Count >= m_TotalUrls) 219 if (m_UrlMap.Count >= TotalUrls)
208 { 220 {
209 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", "" });
210 return urlcode; 222 return urlcode;
211 } 223 }
212 string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; 224 string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";
213 225
214 UrlData urlData = new UrlData(); 226 UrlData urlData = new UrlData();
215 urlData.hostID = host.UUID; 227 urlData.hostID = host.UUID;
@@ -249,12 +261,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
249 261
250 lock (m_UrlMap) 262 lock (m_UrlMap)
251 { 263 {
252 if (m_UrlMap.Count >= m_TotalUrls) 264 if (m_UrlMap.Count >= TotalUrls)
253 { 265 {
254 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", "" });
255 return urlcode; 267 return urlcode;
256 } 268 }
257 string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; 269 string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/";
258 270
259 UrlData urlData = new UrlData(); 271 UrlData urlData = new UrlData();
260 urlData.hostID = host.UUID; 272 urlData.hostID = host.UUID;
@@ -377,7 +389,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
377 public int GetFreeUrls() 389 public int GetFreeUrls()
378 { 390 {
379 lock (m_UrlMap) 391 lock (m_UrlMap)
380 return m_TotalUrls - m_UrlMap.Count; 392 return TotalUrls - m_UrlMap.Count;
381 } 393 }
382 394
383 public void ScriptRemoved(UUID itemID) 395 public void ScriptRemoved(UUID itemID)
@@ -579,9 +591,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
579 string url; 591 string url;
580 592
581 if (is_ssl) 593 if (is_ssl)
582 url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; 594 url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp;
583 else 595 else
584 url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; 596 url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp;
585 597
586 // Avoid a race - the request URL may have been released via llRequestUrl() whilst this 598 // Avoid a race - the request URL may have been released via llRequestUrl() whilst this
587 // request was being processed. 599 // request was being processed.
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 689e8a7..f04fabe 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -838,13 +838,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
838 try 838 try
839 { 839 {
840 WebRequest request = HttpWebRequest.Create(url); 840 WebRequest request = HttpWebRequest.Create(url);
841//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. 841
842//Ckrinke Stream str = null; 842 using (HttpWebResponse response = (HttpWebResponse)(request).GetResponse())
843 HttpWebResponse response = (HttpWebResponse)(request).GetResponse();
844 if (response.StatusCode == HttpStatusCode.OK)
845 { 843 {
846 Bitmap image = new Bitmap(response.GetResponseStream()); 844 if (response.StatusCode == HttpStatusCode.OK)
847 return image; 845 {
846 using (Stream s = response.GetResponseStream())
847 {
848 Bitmap image = new Bitmap(s);
849 return image;
850 }
851 }
848 } 852 }
849 } 853 }
850 catch { } 854 catch { }