This partially implements the LSL function to set the response

type for an HTTP request. Since the "official" LSL function limits
the use of the response type, it is implemented as osSetContentType
with a string for the content mime type and a threat level of high.
With this function you should be able to implement rather functional
media-on-a-prim application with much less difficulty.
This commit is contained in:
Mic Bowman
2012-08-29 14:56:51 -07:00
parent 0c3061f973
commit 3d736d575f
5 changed files with 49 additions and 2 deletions

View File

@@ -140,12 +140,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
internal float m_ScriptDistanceFactor = 1.0f;
internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >();
protected IUrlModule m_UrlModule = null;
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item)
{
m_ScriptEngine = ScriptEngine;
m_host = host;
m_item = item;
m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
m_OSFunctionsEnabled = true;
@@ -3358,5 +3362,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_Key(m_host.ParentGroup.FromPartID.ToString());
}
}
/// <summary>
/// Sets the response type for an HTTP request/response
/// </summary>
/// <returns></returns>
public void osSetContentType(LSL_Key id, string type)
{
CheckThreatLevel(ThreatLevel.High,"osSetResponseType");
if (m_UrlModule != null)
m_UrlModule.HttpContentType(new UUID(id),type);
}
}
}