aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs38
1 files changed, 21 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index 60b7190..b9c373b 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -88,15 +88,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
88 /// </summary> 88 /// </summary>
89 private int m_TotalUrls = 15000; 89 private int m_TotalUrls = 15000;
90 90
91 private uint https_port = 0; 91 private uint m_HttpsPort = 0;
92 private IHttpServer m_HttpServer = null; 92 private IHttpServer m_HttpServer = null;
93 private IHttpServer m_HttpsServer = null; 93 private IHttpServer m_HttpsServer = null;
94 94
95 private string m_ExternalHostNameForLSL = ""; 95 public string ExternalHostNameForLSL { get; private set; }
96 public string ExternalHostNameForLSL
97 {
98 get { return m_ExternalHostNameForLSL; }
99 }
100 96
101 public Type ReplaceableInterface 97 public Type ReplaceableInterface
102 { 98 {
@@ -110,13 +106,21 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
110 106
111 public void Initialise(IConfigSource config) 107 public void Initialise(IConfigSource config)
112 { 108 {
113 m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); 109 IConfig networkConfig = config.Configs["Network"];
114 bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false); 110
115 if (ssl_enabled) 111 if (networkConfig != null)
116 { 112 {
117 https_port = (uint) config.Configs["Network"].GetInt("https_port",0); 113 ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", null);
114
115 bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener", false);
116
117 if (ssl_enabled)
118 m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort);
118 } 119 }
119 120
121 if (ExternalHostNameForLSL == null)
122 ExternalHostNameForLSL = System.Environment.MachineName;
123
120 IConfig llFunctionsConfig = config.Configs["LL-Functions"]; 124 IConfig llFunctionsConfig = config.Configs["LL-Functions"];
121 125
122 if (llFunctionsConfig != null) 126 if (llFunctionsConfig != null)
@@ -136,9 +140,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
136 m_HttpServer = MainServer.Instance; 140 m_HttpServer = MainServer.Instance;
137 // 141 //
138 // We can use the https if it is enabled 142 // We can use the https if it is enabled
139 if (https_port > 0) 143 if (m_HttpsPort > 0)
140 { 144 {
141 m_HttpsServer = MainServer.GetHttpServer(https_port); 145 m_HttpsServer = MainServer.GetHttpServer(m_HttpsPort);
142 } 146 }
143 } 147 }
144 148
@@ -176,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
176 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); 180 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
177 return urlcode; 181 return urlcode;
178 } 182 }
179 string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString(); 183 string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString();
180 184
181 UrlData urlData = new UrlData(); 185 UrlData urlData = new UrlData();
182 urlData.hostID = host.UUID; 186 urlData.hostID = host.UUID;
@@ -221,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
221 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); 225 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
222 return urlcode; 226 return urlcode;
223 } 227 }
224 string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString(); 228 string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString();
225 229
226 UrlData urlData = new UrlData(); 230 UrlData urlData = new UrlData();
227 urlData.hostID = host.UUID; 231 urlData.hostID = host.UUID;
@@ -542,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
542 { 546 {
543 Hashtable headers = (Hashtable)request["headers"]; 547 Hashtable headers = (Hashtable)request["headers"];
544 548
545// string uri_full = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/"; 549// string uri_full = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/";
546 550
547 int pos1 = uri.IndexOf("/");// /lslhttp 551 int pos1 = uri.IndexOf("/");// /lslhttp
548 int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ 552 int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/
@@ -558,10 +562,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
558 UrlData url = null; 562 UrlData url = null;
559 string urlkey; 563 string urlkey;
560 if (!is_ssl) 564 if (!is_ssl)
561 urlkey = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; 565 urlkey = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp;
562 //m_UrlMap[]; 566 //m_UrlMap[];
563 else 567 else
564 urlkey = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; 568 urlkey = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp;
565 569
566 if (m_UrlMap.ContainsKey(urlkey)) 570 if (m_UrlMap.ContainsKey(urlkey))
567 { 571 {