aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTalun2013-01-24 21:08:57 +0000
committernebadon2013-01-24 14:48:20 -0700
commit71f7bfc2ff195106254712654fdd549ea9f2a3e3 (patch)
tree4a690b6305e3af4705c05ab4083bf8a5bfe03489
parentAdd JSONification of WebStats module. Adds a '?json' query parameter (diff)
downloadopensim-SC_OLD-71f7bfc2ff195106254712654fdd549ea9f2a3e3.zip
opensim-SC_OLD-71f7bfc2ff195106254712654fdd549ea9f2a3e3.tar.gz
opensim-SC_OLD-71f7bfc2ff195106254712654fdd549ea9f2a3e3.tar.bz2
opensim-SC_OLD-71f7bfc2ff195106254712654fdd549ea9f2a3e3.tar.xz
Mantis 6508 llHTTPResponse body is incorrectly interpreted by IE
This patch html escapes responses going to IE so that they cannot be interpreted as HTML if the response type is "text/plain". This has no effect if the reponse type has been set to "text/html" by osSetContentType Signed-off-by: nebadon <michael@osgrid.org>
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs16
1 files changed, 15 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index a654477..be617a5 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -328,8 +328,22 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
328 if (m_RequestMap.ContainsKey(request)) 328 if (m_RequestMap.ContainsKey(request))
329 { 329 {
330 UrlData urlData = m_RequestMap[request]; 330 UrlData urlData = m_RequestMap[request];
331 string responseBody = body;
332 if (urlData.requests[request].responseType.Equals("text/plain"))
333 {
334 string value;
335 if (urlData.requests[request].headers.TryGetValue("user-agent", out value))
336 {
337 if (value != null && value.IndexOf("MSIE") >= 0)
338 {
339 // wrap the html escaped response if the target client is IE
340 // It ignores "text/plain" if the body is html
341 responseBody = "<html>" + System.Web.HttpUtility.HtmlEncode(body) + "</html>";
342 }
343 }
344 }
331 urlData.requests[request].responseCode = status; 345 urlData.requests[request].responseCode = status;
332 urlData.requests[request].responseBody = body; 346 urlData.requests[request].responseBody = responseBody;
333 //urlData.requests[request].ev.Set(); 347 //urlData.requests[request].ev.Set();
334 urlData.requests[request].requestDone =true; 348 urlData.requests[request].requestDone =true;
335 } 349 }