diff options
author | Justin Clark-Casey (justincc) | 2012-08-29 23:16:16 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-08-29 23:16:16 +0100 |
commit | 1f88179a65d3ac82883614f981a081a45c178be9 (patch) | |
tree | 2a3a0be26a6e440e59cb216ea39d825b263c8982 /OpenSim/Region | |
parent | Add VectorRenderModuleStressTests that contains a long running test that gene... (diff) | |
parent | This partially implements the LSL function to set the response (diff) | |
download | opensim-SC_OLD-1f88179a65d3ac82883614f981a081a45c178be9.zip opensim-SC_OLD-1f88179a65d3ac82883614f981a081a45c178be9.tar.gz opensim-SC_OLD-1f88179a65d3ac82883614f981a081a45c178be9.tar.bz2 opensim-SC_OLD-1f88179a65d3ac82883614f981a081a45c178be9.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
5 files changed, 49 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 05d54f0..53a9679 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -84,6 +84,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
84 | public string body; | 84 | public string body; |
85 | public int responseCode; | 85 | public int responseCode; |
86 | public string responseBody; | 86 | public string responseBody; |
87 | public string responseType = "text/plain"; | ||
87 | //public ManualResetEvent ev; | 88 | //public ManualResetEvent ev; |
88 | public bool requestDone; | 89 | public bool requestDone; |
89 | public int startTime; | 90 | public int startTime; |
@@ -302,6 +303,22 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
302 | } | 303 | } |
303 | } | 304 | } |
304 | 305 | ||
306 | public void HttpContentType(UUID request, string type) | ||
307 | { | ||
308 | lock (m_UrlMap) | ||
309 | { | ||
310 | if (m_RequestMap.ContainsKey(request)) | ||
311 | { | ||
312 | UrlData urlData = m_RequestMap[request]; | ||
313 | urlData.requests[request].responseType = type; | ||
314 | } | ||
315 | else | ||
316 | { | ||
317 | m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString()); | ||
318 | } | ||
319 | } | ||
320 | } | ||
321 | |||
305 | public void HttpResponse(UUID request, int status, string body) | 322 | public void HttpResponse(UUID request, int status, string body) |
306 | { | 323 | { |
307 | lock (m_UrlMap) | 324 | lock (m_UrlMap) |
@@ -504,7 +521,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
504 | //put response | 521 | //put response |
505 | response["int_response_code"] = requestData.responseCode; | 522 | response["int_response_code"] = requestData.responseCode; |
506 | response["str_response_string"] = requestData.responseBody; | 523 | response["str_response_string"] = requestData.responseBody; |
507 | response["content_type"] = "text/plain"; | 524 | response["content_type"] = requestData.responseType; |
525 | // response["content_type"] = "text/plain"; | ||
508 | response["keepalive"] = false; | 526 | response["keepalive"] = false; |
509 | response["reusecontext"] = false; | 527 | response["reusecontext"] = false; |
510 | 528 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs index 457444c..79e9f9d 100644 --- a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs | |||
@@ -39,6 +39,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
39 | UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID); | 39 | UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID); |
40 | void ReleaseURL(string url); | 40 | void ReleaseURL(string url); |
41 | void HttpResponse(UUID request, int status, string body); | 41 | void HttpResponse(UUID request, int status, string body); |
42 | void HttpContentType(UUID request, string type); | ||
43 | |||
42 | string GetHttpHeader(UUID request, string header); | 44 | string GetHttpHeader(UUID request, string header); |
43 | int GetFreeUrls(); | 45 | int GetFreeUrls(); |
44 | 46 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 09fcf50..e245684 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -140,12 +140,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
140 | internal float m_ScriptDistanceFactor = 1.0f; | 140 | internal float m_ScriptDistanceFactor = 1.0f; |
141 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); | 141 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); |
142 | 142 | ||
143 | protected IUrlModule m_UrlModule = null; | ||
144 | |||
143 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 145 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
144 | { | 146 | { |
145 | m_ScriptEngine = ScriptEngine; | 147 | m_ScriptEngine = ScriptEngine; |
146 | m_host = host; | 148 | m_host = host; |
147 | m_item = item; | 149 | m_item = item; |
148 | 150 | ||
151 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | ||
152 | |||
149 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) | 153 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) |
150 | m_OSFunctionsEnabled = true; | 154 | m_OSFunctionsEnabled = true; |
151 | 155 | ||
@@ -3358,5 +3362,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3358 | 3362 | ||
3359 | return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); | 3363 | return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); |
3360 | } | 3364 | } |
3361 | } | 3365 | |
3366 | /// <summary> | ||
3367 | /// Sets the response type for an HTTP request/response | ||
3368 | /// </summary> | ||
3369 | /// <returns></returns> | ||
3370 | public void osSetContentType(LSL_Key id, string type) | ||
3371 | { | ||
3372 | CheckThreatLevel(ThreatLevel.High,"osSetResponseType"); | ||
3373 | if (m_UrlModule != null) | ||
3374 | m_UrlModule.HttpContentType(new UUID(id),type); | ||
3375 | } | ||
3376 | |||
3377 | } | ||
3362 | } \ No newline at end of file | 3378 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index ce1845c..06729ab 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -365,5 +365,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
365 | /// </summary> | 365 | /// </summary> |
366 | /// <returns>Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown.</returns> | 366 | /// <returns>Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown.</returns> |
367 | LSL_Key osGetRezzingObject(); | 367 | LSL_Key osGetRezzingObject(); |
368 | |||
369 | /// <summary> | ||
370 | /// Sets the response type for an HTTP request/response | ||
371 | /// </summary> | ||
372 | /// <returns></returns> | ||
373 | void osSetContentType(LSL_Key id, string type); | ||
368 | } | 374 | } |
369 | } | 375 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e9131e4..ba1ade2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -955,5 +955,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
955 | { | 955 | { |
956 | return m_OSSL_Functions.osGetRezzingObject(); | 956 | return m_OSSL_Functions.osGetRezzingObject(); |
957 | } | 957 | } |
958 | |||
959 | public void osSetContentType(LSL_Key id, string type) | ||
960 | { | ||
961 | m_OSSL_Functions.osSetContentType(id,type); | ||
962 | } | ||
958 | } | 963 | } |
959 | } | 964 | } |