Moved RegionName from RegionInfo to SimpleRegionInfo.
parent
0fc2b73e7b
commit
ffd30b8ac3
|
@ -64,6 +64,13 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
protected string m_serverURI;
|
protected string m_serverURI;
|
||||||
|
|
||||||
|
public string RegionName
|
||||||
|
{
|
||||||
|
get { return m_regionName; }
|
||||||
|
set { m_regionName = value; }
|
||||||
|
}
|
||||||
|
protected string m_regionName = String.Empty;
|
||||||
|
|
||||||
protected bool Allow_Alternate_Ports;
|
protected bool Allow_Alternate_Ports;
|
||||||
public bool m_allow_alternate_ports;
|
public bool m_allow_alternate_ports;
|
||||||
protected string m_externalHostName;
|
protected string m_externalHostName;
|
||||||
|
@ -284,7 +291,6 @@ namespace OpenSim.Framework
|
||||||
public UUID originRegionID = UUID.Zero;
|
public UUID originRegionID = UUID.Zero;
|
||||||
public string proxyUrl = "";
|
public string proxyUrl = "";
|
||||||
public int ProxyOffset = 0;
|
public int ProxyOffset = 0;
|
||||||
public string RegionName = String.Empty;
|
|
||||||
public string regionSecret = UUID.Random().ToString();
|
public string regionSecret = UUID.Random().ToString();
|
||||||
|
|
||||||
public string osSecret;
|
public string osSecret;
|
||||||
|
|
|
@ -54,12 +54,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
{
|
{
|
||||||
public UUID requestID;
|
public UUID requestID;
|
||||||
public Dictionary<string, string> headers;
|
public Dictionary<string, string> headers;
|
||||||
public string body;
|
public string body;
|
||||||
public int responseCode;
|
public int responseCode;
|
||||||
public string responseBody;
|
public string responseBody;
|
||||||
public ManualResetEvent ev;
|
public ManualResetEvent ev;
|
||||||
public bool requestDone;
|
public bool requestDone;
|
||||||
public int startTime;
|
public int startTime;
|
||||||
public string uri;
|
public string uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,23 +73,23 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
new Dictionary<UUID, UrlData>();
|
new Dictionary<UUID, UrlData>();
|
||||||
|
|
||||||
private Dictionary<string, UrlData> m_UrlMap =
|
private Dictionary<string, UrlData> m_UrlMap =
|
||||||
new Dictionary<string, UrlData>();
|
new Dictionary<string, UrlData>();
|
||||||
|
|
||||||
|
|
||||||
private int m_TotalUrls = 100;
|
private int m_TotalUrls = 100;
|
||||||
|
|
||||||
private IHttpServer m_HttpServer = null;
|
private IHttpServer m_HttpServer = null;
|
||||||
|
|
||||||
private string m_ExternalHostNameForLSL = "";
|
private string m_ExternalHostNameForLSL = "";
|
||||||
|
|
||||||
public Type ReplaceableInterface
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return null; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private Hashtable HandleHttpPoll(Hashtable request)
|
private Hashtable HandleHttpPoll(Hashtable request)
|
||||||
{
|
{
|
||||||
return new Hashtable();
|
return new Hashtable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName);
|
m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public UUID RequestURL(IScriptModule engine, SceneObjectPart host, UUID itemID)
|
public UUID RequestURL(IScriptModule engine, SceneObjectPart host, UUID itemID)
|
||||||
{
|
{
|
||||||
UUID urlcode = UUID.Random();
|
UUID urlcode = UUID.Random();
|
||||||
|
@ -141,8 +141,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
{
|
{
|
||||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
|
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
|
||||||
return urlcode;
|
return urlcode;
|
||||||
}
|
}
|
||||||
string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";
|
string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";
|
||||||
|
|
||||||
UrlData urlData = new UrlData();
|
UrlData urlData = new UrlData();
|
||||||
urlData.hostID = host.UUID;
|
urlData.hostID = host.UUID;
|
||||||
|
@ -152,14 +152,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
urlData.urlcode = urlcode;
|
urlData.urlcode = urlcode;
|
||||||
urlData.requests = new Dictionary<UUID, RequestData>();
|
urlData.requests = new Dictionary<UUID, RequestData>();
|
||||||
|
|
||||||
|
|
||||||
m_UrlMap[url] = urlData;
|
m_UrlMap[url] = urlData;
|
||||||
|
|
||||||
string uri = "/lslhttp/" + urlcode.ToString() + "/";
|
string uri = "/lslhttp/" + urlcode.ToString() + "/";
|
||||||
|
|
||||||
m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll,
|
m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll,
|
||||||
new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents,
|
new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents,
|
||||||
urlcode));
|
urlcode));
|
||||||
|
|
||||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
|
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
|
||||||
}
|
}
|
||||||
|
@ -180,11 +180,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
{
|
{
|
||||||
lock (m_UrlMap)
|
lock (m_UrlMap)
|
||||||
{
|
{
|
||||||
UrlData data;
|
UrlData data;
|
||||||
|
|
||||||
if (!m_UrlMap.TryGetValue(url, out data))
|
if (!m_UrlMap.TryGetValue(url, out data))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (UUID req in data.requests.Keys)
|
foreach (UUID req in data.requests.Keys)
|
||||||
|
@ -196,36 +196,36 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HttpResponse(UUID request, int status, string body)
|
public void HttpResponse(UUID request, int status, string body)
|
||||||
{
|
{
|
||||||
if (m_RequestMap.ContainsKey(request))
|
if (m_RequestMap.ContainsKey(request))
|
||||||
{
|
{
|
||||||
UrlData urlData = m_RequestMap[request];
|
UrlData urlData = m_RequestMap[request];
|
||||||
RequestData requestData=urlData.requests[request];
|
RequestData requestData=urlData.requests[request];
|
||||||
urlData.requests[request].responseCode = status;
|
urlData.requests[request].responseCode = status;
|
||||||
urlData.requests[request].responseBody = body;
|
urlData.requests[request].responseBody = body;
|
||||||
//urlData.requests[request].ev.Set();
|
//urlData.requests[request].ev.Set();
|
||||||
urlData.requests[request].requestDone=true;
|
urlData.requests[request].requestDone=true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString());
|
m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetHttpHeader(UUID requestId, string header)
|
public string GetHttpHeader(UUID requestId, string header)
|
||||||
{
|
{
|
||||||
if (m_RequestMap.ContainsKey(requestId))
|
if (m_RequestMap.ContainsKey(requestId))
|
||||||
{
|
{
|
||||||
UrlData urlData=m_RequestMap[requestId];
|
UrlData urlData=m_RequestMap[requestId];
|
||||||
string value;
|
string value;
|
||||||
if (urlData.requests[requestId].headers.TryGetValue(header,out value))
|
if (urlData.requests[requestId].headers.TryGetValue(header,out value))
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Warn("[HttpRequestHandler] There was no http-in request with id " + requestId);
|
m_log.Warn("[HttpRequestHandler] There was no http-in request with id " + requestId);
|
||||||
}
|
}
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetFreeUrls()
|
public int GetFreeUrls()
|
||||||
|
@ -275,63 +275,63 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
foreach (string urlname in removeURLs)
|
foreach (string urlname in removeURLs)
|
||||||
m_UrlMap.Remove(urlname);
|
m_UrlMap.Remove(urlname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void RemoveUrl(UrlData data)
|
private void RemoveUrl(UrlData data)
|
||||||
{
|
{
|
||||||
m_HttpServer.RemoveHTTPHandler("", "/lslhttp/"+data.urlcode.ToString()+"/");
|
m_HttpServer.RemoveHTTPHandler("", "/lslhttp/"+data.urlcode.ToString()+"/");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Hashtable NoEvents(UUID requestID, UUID sessionID)
|
private Hashtable NoEvents(UUID requestID, UUID sessionID)
|
||||||
{
|
{
|
||||||
Hashtable response = new Hashtable();
|
Hashtable response = new Hashtable();
|
||||||
UrlData url;
|
UrlData url;
|
||||||
lock (m_RequestMap)
|
lock (m_RequestMap)
|
||||||
{
|
{
|
||||||
if (!m_RequestMap.ContainsKey(requestID))
|
if (!m_RequestMap.ContainsKey(requestID))
|
||||||
return response;
|
return response;
|
||||||
url = m_RequestMap[requestID];
|
url = m_RequestMap[requestID];
|
||||||
}
|
|
||||||
|
|
||||||
if (System.Environment.TickCount - url.requests[requestID].startTime > 25000)
|
|
||||||
{
|
|
||||||
response["int_response_code"] = 500;
|
|
||||||
response["str_response_string"] = "Script timeout";
|
|
||||||
response["content_type"] = "text/plain";
|
|
||||||
response["keepalive"] = false;
|
|
||||||
response["reusecontext"] = false;
|
|
||||||
|
|
||||||
//remove from map
|
|
||||||
lock (url)
|
|
||||||
{
|
|
||||||
url.requests.Remove(requestID);
|
|
||||||
m_RequestMap.Remove(requestID);
|
|
||||||
}
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (System.Environment.TickCount - url.requests[requestID].startTime > 25000)
|
||||||
return response;
|
{
|
||||||
}
|
response["int_response_code"] = 500;
|
||||||
|
response["str_response_string"] = "Script timeout";
|
||||||
|
response["content_type"] = "text/plain";
|
||||||
|
response["keepalive"] = false;
|
||||||
|
response["reusecontext"] = false;
|
||||||
|
|
||||||
|
//remove from map
|
||||||
|
lock (url)
|
||||||
|
{
|
||||||
|
url.requests.Remove(requestID);
|
||||||
|
m_RequestMap.Remove(requestID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
private bool HasEvents(UUID requestID, UUID sessionID)
|
private bool HasEvents(UUID requestID, UUID sessionID)
|
||||||
{
|
{
|
||||||
UrlData url=null;
|
UrlData url=null;
|
||||||
|
|
||||||
lock (m_RequestMap)
|
lock (m_RequestMap)
|
||||||
{
|
{
|
||||||
if (!m_RequestMap.ContainsKey(requestID))
|
if (!m_RequestMap.ContainsKey(requestID))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
url = m_RequestMap[requestID];
|
|
||||||
if (!url.requests.ContainsKey(requestID))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
url = m_RequestMap[requestID];
|
||||||
|
if (!url.requests.ContainsKey(requestID))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (System.Environment.TickCount-url.requests[requestID].startTime>25000)
|
if (System.Environment.TickCount-url.requests[requestID].startTime>25000)
|
||||||
{
|
{
|
||||||
|
@ -343,146 +343,146 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
private Hashtable GetEvents(UUID requestID, UUID sessionID, string request)
|
private Hashtable GetEvents(UUID requestID, UUID sessionID, string request)
|
||||||
{
|
{
|
||||||
UrlData url = null;
|
UrlData url = null;
|
||||||
RequestData requestData = null;
|
RequestData requestData = null;
|
||||||
|
|
||||||
lock (m_RequestMap)
|
lock (m_RequestMap)
|
||||||
{
|
{
|
||||||
if (!m_RequestMap.ContainsKey(requestID))
|
if (!m_RequestMap.ContainsKey(requestID))
|
||||||
return NoEvents(requestID,sessionID);
|
return NoEvents(requestID,sessionID);
|
||||||
url = m_RequestMap[requestID];
|
url = m_RequestMap[requestID];
|
||||||
requestData = url.requests[requestID];
|
requestData = url.requests[requestID];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!requestData.requestDone)
|
if (!requestData.requestDone)
|
||||||
return NoEvents(requestID,sessionID);
|
return NoEvents(requestID,sessionID);
|
||||||
|
|
||||||
Hashtable response = new Hashtable();
|
Hashtable response = new Hashtable();
|
||||||
|
|
||||||
if (System.Environment.TickCount - requestData.startTime > 25000)
|
if (System.Environment.TickCount - requestData.startTime > 25000)
|
||||||
{
|
{
|
||||||
response["int_response_code"] = 500;
|
response["int_response_code"] = 500;
|
||||||
response["str_response_string"] = "Script timeout";
|
response["str_response_string"] = "Script timeout";
|
||||||
response["content_type"] = "text/plain";
|
response["content_type"] = "text/plain";
|
||||||
response["keepalive"] = false;
|
response["keepalive"] = false;
|
||||||
response["reusecontext"] = false;
|
response["reusecontext"] = false;
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
//put response
|
//put response
|
||||||
response["int_response_code"] = requestData.responseCode;
|
response["int_response_code"] = requestData.responseCode;
|
||||||
response["str_response_string"] = requestData.responseBody;
|
response["str_response_string"] = requestData.responseBody;
|
||||||
response["content_type"] = "text/plain";
|
response["content_type"] = "text/plain";
|
||||||
response["keepalive"] = false;
|
response["keepalive"] = false;
|
||||||
response["reusecontext"] = false;
|
response["reusecontext"] = false;
|
||||||
|
|
||||||
//remove from map
|
//remove from map
|
||||||
lock (url)
|
lock (url)
|
||||||
{
|
{
|
||||||
url.requests.Remove(requestID);
|
url.requests.Remove(requestID);
|
||||||
m_RequestMap.Remove(requestID);
|
m_RequestMap.Remove(requestID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
public void HttpRequestHandler(UUID requestID, Hashtable request)
|
public void HttpRequestHandler(UUID requestID, Hashtable request)
|
||||||
{
|
{
|
||||||
lock (request)
|
lock (request)
|
||||||
{
|
{
|
||||||
string uri = request["uri"].ToString();
|
string uri = request["uri"].ToString();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Hashtable headers = (Hashtable)request["headers"];
|
Hashtable headers = (Hashtable)request["headers"];
|
||||||
|
|
||||||
string uri_full = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/";
|
string uri_full = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/";
|
||||||
|
|
||||||
int pos1 = uri.IndexOf("/");// /lslhttp
|
int pos1 = uri.IndexOf("/");// /lslhttp
|
||||||
int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/
|
int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/
|
||||||
int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/
|
int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/
|
||||||
string uri_tmp = uri.Substring(0, pos3 + 1);
|
string uri_tmp = uri.Substring(0, pos3 + 1);
|
||||||
//HTTP server code doesn't provide us with QueryStrings
|
//HTTP server code doesn't provide us with QueryStrings
|
||||||
string pathInfo;
|
string pathInfo;
|
||||||
string queryString;
|
string queryString;
|
||||||
queryString = "";
|
queryString = "";
|
||||||
|
|
||||||
pathInfo = uri.Substring(pos3);
|
pathInfo = uri.Substring(pos3);
|
||||||
|
|
||||||
UrlData url = m_UrlMap["http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp];
|
UrlData url = m_UrlMap["http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp];
|
||||||
|
|
||||||
//for llGetHttpHeader support we need to store original URI here
|
//for llGetHttpHeader support we need to store original URI here
|
||||||
//to make x-path-info / x-query-string / x-script-url / x-remote-ip headers
|
//to make x-path-info / x-query-string / x-script-url / x-remote-ip headers
|
||||||
//as per http://wiki.secondlife.com/wiki/LlGetHTTPHeader
|
//as per http://wiki.secondlife.com/wiki/LlGetHTTPHeader
|
||||||
|
|
||||||
RequestData requestData = new RequestData();
|
RequestData requestData = new RequestData();
|
||||||
requestData.requestID = requestID;
|
requestData.requestID = requestID;
|
||||||
requestData.requestDone = false;
|
requestData.requestDone = false;
|
||||||
requestData.startTime = System.Environment.TickCount;
|
requestData.startTime = System.Environment.TickCount;
|
||||||
requestData.uri = uri;
|
requestData.uri = uri;
|
||||||
if (requestData.headers == null)
|
if (requestData.headers == null)
|
||||||
requestData.headers = new Dictionary<string, string>();
|
requestData.headers = new Dictionary<string, string>();
|
||||||
|
|
||||||
foreach (DictionaryEntry header in headers)
|
foreach (DictionaryEntry header in headers)
|
||||||
{
|
{
|
||||||
string key = (string)header.Key;
|
string key = (string)header.Key;
|
||||||
string value = (string)header.Value;
|
string value = (string)header.Value;
|
||||||
requestData.headers.Add(key, value);
|
requestData.headers.Add(key, value);
|
||||||
}
|
}
|
||||||
foreach (DictionaryEntry de in request)
|
foreach (DictionaryEntry de in request)
|
||||||
{
|
{
|
||||||
if (de.Key.ToString() == "querystringkeys")
|
if (de.Key.ToString() == "querystringkeys")
|
||||||
{
|
{
|
||||||
System.String[] keys = (System.String[])de.Value;
|
System.String[] keys = (System.String[])de.Value;
|
||||||
foreach (String key in keys)
|
foreach (String key in keys)
|
||||||
{
|
{
|
||||||
if (request.ContainsKey(key))
|
if (request.ContainsKey(key))
|
||||||
{
|
{
|
||||||
string val = (String)request[key];
|
string val = (String)request[key];
|
||||||
queryString = queryString + key + "=" + val + "&";
|
queryString = queryString + key + "=" + val + "&";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (queryString.Length > 1)
|
if (queryString.Length > 1)
|
||||||
queryString = queryString.Substring(0, queryString.Length - 1);
|
queryString = queryString.Substring(0, queryString.Length - 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//if this machine is behind DNAT/port forwarding, currently this is being
|
//if this machine is behind DNAT/port forwarding, currently this is being
|
||||||
//set to address of port forwarding router
|
//set to address of port forwarding router
|
||||||
requestData.headers["x-remote-ip"] = requestData.headers["remote_addr"];
|
requestData.headers["x-remote-ip"] = requestData.headers["remote_addr"];
|
||||||
requestData.headers["x-path-info"] = pathInfo;
|
requestData.headers["x-path-info"] = pathInfo;
|
||||||
requestData.headers["x-query-string"] = queryString;
|
requestData.headers["x-query-string"] = queryString;
|
||||||
requestData.headers["x-script-url"] = url.url;
|
requestData.headers["x-script-url"] = url.url;
|
||||||
|
|
||||||
requestData.ev = new ManualResetEvent(false);
|
requestData.ev = new ManualResetEvent(false);
|
||||||
lock (url.requests)
|
lock (url.requests)
|
||||||
{
|
{
|
||||||
url.requests.Add(requestID, requestData);
|
url.requests.Add(requestID, requestData);
|
||||||
}
|
}
|
||||||
lock (m_RequestMap)
|
lock (m_RequestMap)
|
||||||
{
|
{
|
||||||
//add to request map
|
//add to request map
|
||||||
m_RequestMap.Add(requestID, url);
|
m_RequestMap.Add(requestID, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
url.engine.PostScriptEvent(url.itemID, "http_request", new Object[] { requestID.ToString(), request["http-method"].ToString(), request["body"].ToString() });
|
url.engine.PostScriptEvent(url.itemID, "http_request", new Object[] { requestID.ToString(), request["http-method"].ToString(), request["body"].ToString() });
|
||||||
|
|
||||||
//send initial response?
|
//send initial response?
|
||||||
Hashtable response = new Hashtable();
|
Hashtable response = new Hashtable();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception we)
|
catch (Exception we)
|
||||||
{
|
{
|
||||||
//Hashtable response = new Hashtable();
|
//Hashtable response = new Hashtable();
|
||||||
m_log.Warn("[HttpRequestHandler]: http-in request failed");
|
m_log.Warn("[HttpRequestHandler]: http-in request failed");
|
||||||
m_log.Warn(we.Message);
|
m_log.Warn(we.Message);
|
||||||
m_log.Warn(we.StackTrace);
|
m_log.Warn(we.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
// This is key-ed on agent ID
|
// This is key-ed on agent ID
|
||||||
protected Dictionary<UUID, SimpleRegionInfo> m_knownRegions = new Dictionary<UUID, SimpleRegionInfo>();
|
protected Dictionary<UUID, SimpleRegionInfo> m_knownRegions = new Dictionary<UUID, SimpleRegionInfo>();
|
||||||
|
|
||||||
|
protected Dictionary<UUID, ulong> m_HyperlinkHandles = new Dictionary<UUID, ulong>();
|
||||||
|
|
||||||
#region ISharedRegionModule
|
#region ISharedRegionModule
|
||||||
|
|
||||||
public Type ReplaceableInterface
|
public Type ReplaceableInterface
|
||||||
|
@ -160,10 +162,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
if (regionInfo.RegionID.Equals(UUID.Zero))
|
if (regionInfo.RegionID.Equals(UUID.Zero))
|
||||||
{
|
{
|
||||||
m_log.Info("[HGrid]: Linking remote region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort);
|
m_log.Info("[HGrid]: Linking remote region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort);
|
||||||
regionInfo.RegionID = m_HypergridServiceConnector.LinkRegion(regionInfo);
|
ulong regionHandle = 0;
|
||||||
|
regionInfo.RegionID = m_HypergridServiceConnector.LinkRegion(regionInfo, out regionHandle);
|
||||||
if (!regionInfo.RegionID.Equals(UUID.Zero))
|
if (!regionInfo.RegionID.Equals(UUID.Zero))
|
||||||
{
|
{
|
||||||
m_HyperlinkRegions.Add(regionInfo.RegionID, regionInfo);
|
AddHyperlinkRegion(regionInfo, regionHandle);
|
||||||
m_log.Info("[HGrid]: Successfully linked to region_uuid " + regionInfo.RegionID);
|
m_log.Info("[HGrid]: Successfully linked to region_uuid " + regionInfo.RegionID);
|
||||||
|
|
||||||
// Try get the map image
|
// Try get the map image
|
||||||
|
@ -186,15 +189,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
// Try the hyperlink collection
|
// Try the hyperlink collection
|
||||||
if (m_HyperlinkRegions.ContainsKey(regionID))
|
if (m_HyperlinkRegions.ContainsKey(regionID))
|
||||||
{
|
{
|
||||||
m_HyperlinkRegions.Remove(regionID);
|
RemoveHyperlinkRegion(regionID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Try the foreign users home collection
|
// Try the foreign users home collection
|
||||||
if (m_knownRegions.ContainsKey(regionID))
|
|
||||||
{
|
foreach (SimpleRegionInfo r in m_knownRegions.Values)
|
||||||
m_knownRegions.Remove(regionID);
|
if (r.RegionID == regionID)
|
||||||
return true;
|
{
|
||||||
}
|
RemoveHyperlinkHomeRegion(regionID);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Finally, try the normal route
|
// Finally, try the normal route
|
||||||
return m_GridServiceConnector.DeregisterRegion(regionID);
|
return m_GridServiceConnector.DeregisterRegion(regionID);
|
||||||
}
|
}
|
||||||
|
@ -213,8 +219,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
return m_HyperlinkRegions[regionID];
|
return m_HyperlinkRegions[regionID];
|
||||||
|
|
||||||
// Try the foreign users home collection
|
// Try the foreign users home collection
|
||||||
if (m_knownRegions.ContainsKey(regionID))
|
foreach (SimpleRegionInfo r in m_knownRegions.Values)
|
||||||
return m_knownRegions[regionID];
|
if (r.RegionID == regionID)
|
||||||
|
return m_knownRegions[regionID];
|
||||||
|
|
||||||
// Finally, try the normal route
|
// Finally, try the normal route
|
||||||
return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
|
return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
|
||||||
|
@ -249,20 +256,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
if (region != null)
|
if (region != null)
|
||||||
return region;
|
return region;
|
||||||
|
|
||||||
// !!! Commenting until region name exists
|
// Try the hyperlink collection
|
||||||
//// Try the hyperlink collection
|
foreach (SimpleRegionInfo r in m_HyperlinkRegions.Values)
|
||||||
//foreach (SimpleRegionInfo r in m_HyperlinkRegions.Values)
|
{
|
||||||
//{
|
if (r.RegionName == regionName)
|
||||||
// if (r.RegionName == regionName)
|
return r;
|
||||||
// return r;
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
//// Try the foreign users home collection
|
// Try the foreign users home collection
|
||||||
//foreach (SimpleRegionInfo r in m_knownRegions.Values)
|
foreach (SimpleRegionInfo r in m_knownRegions.Values)
|
||||||
//{
|
{
|
||||||
// if (r.RegionName == regionName)
|
if (r.RegionName == regionName)
|
||||||
// return r;
|
return r;
|
||||||
//}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,6 +305,35 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private void AddHyperlinkRegion(SimpleRegionInfo regionInfo, ulong regionHandle)
|
||||||
|
{
|
||||||
|
m_HyperlinkRegions.Add(regionInfo.RegionID, regionInfo);
|
||||||
|
m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemoveHyperlinkRegion(UUID regionID)
|
||||||
|
{
|
||||||
|
m_HyperlinkRegions.Remove(regionID);
|
||||||
|
m_HyperlinkHandles.Remove(regionID);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddHyperlinkHomeRegion(UUID userID, SimpleRegionInfo regionInfo, ulong regionHandle)
|
||||||
|
{
|
||||||
|
m_knownRegions.Add(userID, regionInfo);
|
||||||
|
m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemoveHyperlinkHomeRegion(UUID regionID)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<UUID, SimpleRegionInfo> kvp in m_knownRegions)
|
||||||
|
{
|
||||||
|
if (kvp.Value.RegionID == regionID)
|
||||||
|
{
|
||||||
|
m_knownRegions.Remove(kvp.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_HyperlinkHandles.Remove(regionID);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7838,8 +7838,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_String llGetHTTPHeader(LSL_Key request_id, string header)
|
public LSL_String llGetHTTPHeader(LSL_Key request_id, string header)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if (m_UrlModule != null)
|
if (m_UrlModule != null)
|
||||||
return m_UrlModule.GetHttpHeader(new UUID(request_id), header);
|
return m_UrlModule.GetHttpHeader(new UUID(request_id), header);
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
}
|
}
|
||||||
|
@ -9124,9 +9124,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// Partial implementation: support for parameter flags needed
|
// Partial implementation: support for parameter flags needed
|
||||||
// see http://wiki.secondlife.com/wiki/llHTTPResponse
|
// see http://wiki.secondlife.com/wiki/llHTTPResponse
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if (m_UrlModule != null)
|
if (m_UrlModule != null)
|
||||||
m_UrlModule.HttpResponse(new UUID(id), status,body);
|
m_UrlModule.HttpResponse(new UUID(id), status,body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,67 +54,63 @@ namespace OpenSim.Services.Connectors.Grid
|
||||||
m_AssetService = assService;
|
m_AssetService = assService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID LinkRegion(SimpleRegionInfo info)
|
public UUID LinkRegion(SimpleRegionInfo info, out ulong realHandle)
|
||||||
{
|
{
|
||||||
UUID uuid = UUID.Zero;
|
UUID uuid = UUID.Zero;
|
||||||
|
realHandle = 0;
|
||||||
|
|
||||||
//Hashtable hash = new Hashtable();
|
Hashtable hash = new Hashtable();
|
||||||
//hash["region_name"] = info.RegionName;
|
hash["region_name"] = info.RegionName;
|
||||||
|
|
||||||
//IList paramList = new ArrayList();
|
IList paramList = new ArrayList();
|
||||||
//paramList.Add(hash);
|
paramList.Add(hash);
|
||||||
|
|
||||||
//XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
|
XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
|
||||||
//string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
|
string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
|
||||||
//m_log.Debug("[HGrid]: Linking to " + uri);
|
m_log.Debug("[HGrid]: Linking to " + uri);
|
||||||
//XmlRpcResponse response = request.Send(uri, 10000);
|
XmlRpcResponse response = request.Send(uri, 10000);
|
||||||
//if (response.IsFault)
|
if (response.IsFault)
|
||||||
//{
|
{
|
||||||
// m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString);
|
m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString);
|
||||||
//}
|
}
|
||||||
//else
|
else
|
||||||
//{
|
{
|
||||||
// hash = (Hashtable)response.Value;
|
hash = (Hashtable)response.Value;
|
||||||
// //foreach (Object o in hash)
|
//foreach (Object o in hash)
|
||||||
// // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
|
// m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
|
||||||
// try
|
try
|
||||||
// {
|
{
|
||||||
// UUID.TryParse((string)hash["uuid"], out uuid);
|
UUID.TryParse((string)hash["uuid"], out uuid);
|
||||||
// info.RegionID = uuid;
|
info.RegionID = uuid;
|
||||||
// if ((string)hash["handle"] != null)
|
if ((string)hash["handle"] != null)
|
||||||
// {
|
{
|
||||||
// info.regionSecret = (string)hash["handle"];
|
realHandle = Convert.ToUInt64((string)hash["handle"]);
|
||||||
// //m_log.Debug(">> HERE: " + info.regionSecret);
|
m_log.Debug(">> HERE, realHandle: " + realHandle);
|
||||||
// }
|
}
|
||||||
// if (hash["region_image"] != null)
|
//if (hash["region_image"] != null)
|
||||||
// {
|
//{
|
||||||
// UUID img = UUID.Zero;
|
// UUID img = UUID.Zero;
|
||||||
// UUID.TryParse((string)hash["region_image"], out img);
|
// UUID.TryParse((string)hash["region_image"], out img);
|
||||||
// info.RegionSettings.TerrainImageID = img;
|
// info.RegionSettings.TerrainImageID = img;
|
||||||
// }
|
//}
|
||||||
// if (hash["region_name"] != null)
|
if (hash["region_name"] != null)
|
||||||
// {
|
{
|
||||||
// info.RegionName = (string)hash["region_name"];
|
info.RegionName = (string)hash["region_name"];
|
||||||
// //m_log.Debug(">> " + info.RegionName);
|
//m_log.Debug(">> " + info.RegionName);
|
||||||
// }
|
}
|
||||||
// if (hash["internal_port"] != null)
|
if (hash["internal_port"] != null)
|
||||||
// {
|
{
|
||||||
// int port = Convert.ToInt32((string)hash["internal_port"]);
|
int port = Convert.ToInt32((string)hash["internal_port"]);
|
||||||
// info.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
|
info.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
|
||||||
// //m_log.Debug(">> " + info.InternalEndPoint.ToString());
|
//m_log.Debug(">> " + info.InternalEndPoint.ToString());
|
||||||
// }
|
}
|
||||||
// if (hash["remoting_port"] != null)
|
|
||||||
// {
|
|
||||||
// info.RemotingPort = Convert.ToUInt32(hash["remoting_port"]);
|
|
||||||
// //m_log.Debug(">> " + info.RemotingPort);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
}
|
||||||
// catch (Exception e)
|
catch (Exception e)
|
||||||
// {
|
{
|
||||||
// m_log.Error("[HGrid]: Got exception while parsing hyperlink response " + e.StackTrace);
|
m_log.Error("[HGrid]: Got exception while parsing hyperlink response " + e.StackTrace);
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ namespace OpenSim.Services.GridService
|
||||||
rdata.posY = (int)rinfo.RegionLocY;
|
rdata.posY = (int)rinfo.RegionLocY;
|
||||||
rdata.RegionID = rinfo.RegionID;
|
rdata.RegionID = rinfo.RegionID;
|
||||||
rdata.Data = rinfo.ToKeyValuePairs();
|
rdata.Data = rinfo.ToKeyValuePairs();
|
||||||
//rdata.RegionName = rinfo.RegionName;
|
rdata.RegionName = rinfo.RegionName;
|
||||||
|
|
||||||
return rdata;
|
return rdata;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ namespace OpenSim.Services.GridService
|
||||||
rinfo.RegionLocX = (uint)rdata.posX;
|
rinfo.RegionLocX = (uint)rdata.posX;
|
||||||
rinfo.RegionLocY = (uint)rdata.posY;
|
rinfo.RegionLocY = (uint)rdata.posY;
|
||||||
rinfo.RegionID = rdata.RegionID;
|
rinfo.RegionID = rdata.RegionID;
|
||||||
//rinfo.RegionName = rdata.RegionName;
|
rinfo.RegionName = rdata.RegionName;
|
||||||
|
|
||||||
return rinfo;
|
return rinfo;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue