mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
several changes to llHttpRequest processing: options section renamed ScriptsHttpRequestModule; throttle by prim (PrimRequestsBurst = 3, PrimRequestsPerSec = 1) and max concurrent connections per instance (MaxPoolThreads = 5), llhttprequest returns if error, nullkey if throttled, reqid otherwise
This commit is contained in:
@@ -13945,14 +13945,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
public LSL_Key llHTTPRequest(string url, LSL_List parameters, string body)
|
||||
{
|
||||
// Partial implementation: support for parameter flags needed
|
||||
// see http://wiki.secondlife.com/wiki/LlHTTPRequest
|
||||
// parameter flags support are implemented in ScriptsHttpRequests.cs
|
||||
// in StartHttpRequest
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
IHttpRequestModule httpScriptMod =
|
||||
m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>();
|
||||
IHttpRequestModule httpScriptMod = m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>();
|
||||
if(httpScriptMod == null)
|
||||
return "";
|
||||
|
||||
if(!httpScriptMod.CheckThrottle(m_host.LocalId))
|
||||
return UUID.Zero.ToString();
|
||||
|
||||
List<string> param = new List<string>();
|
||||
bool ok;
|
||||
Int32 flag;
|
||||
@@ -14123,8 +14123,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
|
||||
HttpInitialRequestStatus status;
|
||||
UUID reqID
|
||||
= httpScriptMod.StartHttpRequest(m_host.LocalId, m_item.ItemID, url, param, httpHeaders, body, out status);
|
||||
UUID reqID = httpScriptMod.StartHttpRequest(m_host.LocalId, m_item.ItemID, url, param, httpHeaders, body, out status);
|
||||
|
||||
if (status == HttpInitialRequestStatus.DISALLOWED_BY_FILTER)
|
||||
Error("llHttpRequest", string.Format("Request to {0} disallowed by filter", url));
|
||||
@@ -14132,7 +14131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (reqID != UUID.Zero)
|
||||
return reqID.ToString();
|
||||
else
|
||||
return null;
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -48,14 +48,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
if (m_CmdManager.m_ScriptEngine.World == null)
|
||||
return;
|
||||
|
||||
IHttpRequestModule iHttpReq =
|
||||
m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>();
|
||||
|
||||
HttpRequestClass httpInfo = null;
|
||||
|
||||
if (iHttpReq != null)
|
||||
httpInfo = (HttpRequestClass)iHttpReq.GetNextCompletedRequest();
|
||||
IHttpRequestModule iHttpReq = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>();
|
||||
if(iHttpReq == null)
|
||||
return;
|
||||
|
||||
HttpRequestClass httpInfo = (HttpRequestClass)iHttpReq.GetNextCompletedRequest();
|
||||
while (httpInfo != null)
|
||||
{
|
||||
//m_log.Debug("[AsyncLSL]:" + httpInfo.response_body + httpInfo.status);
|
||||
@@ -67,8 +64,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
// implemented here yet anyway. Should be fixed if/when maxsize
|
||||
// is supported
|
||||
|
||||
iHttpReq.RemoveCompletedRequest(httpInfo.ReqID);
|
||||
|
||||
object[] resobj = new object[]
|
||||
{
|
||||
new LSL_Types.LSLString(httpInfo.ReqID.ToString()),
|
||||
|
||||
Reference in New Issue
Block a user