mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 11:25:39 +08:00
Add regression test for llRequestUrl()
This commit is contained in:
@@ -122,15 +122,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
/// </summary>
|
||||
private int m_TotalUrls = 100;
|
||||
|
||||
private uint https_port = 0;
|
||||
private uint m_HttpsPort = 0;
|
||||
private IHttpServer m_HttpServer = null;
|
||||
private IHttpServer m_HttpsServer = null;
|
||||
|
||||
private string m_ExternalHostNameForLSL = "";
|
||||
public string ExternalHostNameForLSL
|
||||
{
|
||||
get { return m_ExternalHostNameForLSL; }
|
||||
}
|
||||
public string ExternalHostNameForLSL { get; private set; }
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
@@ -144,11 +140,20 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName);
|
||||
bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false);
|
||||
IConfig networkConfig = config.Configs["Network"];
|
||||
|
||||
if (ssl_enabled)
|
||||
https_port = (uint) config.Configs["Network"].GetInt("https_port",0);
|
||||
if (networkConfig != null)
|
||||
{
|
||||
ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", null);
|
||||
|
||||
bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener", false);
|
||||
|
||||
if (ssl_enabled)
|
||||
m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort);
|
||||
}
|
||||
|
||||
if (ExternalHostNameForLSL == null)
|
||||
ExternalHostNameForLSL = System.Environment.MachineName;
|
||||
|
||||
IConfig llFunctionsConfig = config.Configs["LL-Functions"];
|
||||
|
||||
@@ -169,9 +174,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
m_HttpServer = MainServer.Instance;
|
||||
//
|
||||
// We can use the https if it is enabled
|
||||
if (https_port > 0)
|
||||
if (m_HttpsPort > 0)
|
||||
{
|
||||
m_HttpsServer = MainServer.GetHttpServer(https_port);
|
||||
m_HttpsServer = MainServer.GetHttpServer(m_HttpsPort);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +214,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
|
||||
return urlcode;
|
||||
}
|
||||
string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";
|
||||
string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";
|
||||
|
||||
UrlData urlData = new UrlData();
|
||||
urlData.hostID = host.UUID;
|
||||
@@ -254,7 +259,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
|
||||
return urlcode;
|
||||
}
|
||||
string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/";
|
||||
string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/";
|
||||
|
||||
UrlData urlData = new UrlData();
|
||||
urlData.hostID = host.UUID;
|
||||
@@ -579,9 +584,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
string url;
|
||||
|
||||
if (is_ssl)
|
||||
url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp;
|
||||
url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp;
|
||||
else
|
||||
url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp;
|
||||
url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp;
|
||||
|
||||
// Avoid a race - the request URL may have been released via llRequestUrl() whilst this
|
||||
// request was being processed.
|
||||
|
||||
Reference in New Issue
Block a user