From 71f7bfc2ff195106254712654fdd549ea9f2a3e3 Mon Sep 17 00:00:00 2001 From: Talun Date: Thu, 24 Jan 2013 21:08:57 +0000 Subject: 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 --- .../Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Scripting/LSLHttp') 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 if (m_RequestMap.ContainsKey(request)) { UrlData urlData = m_RequestMap[request]; + string responseBody = body; + if (urlData.requests[request].responseType.Equals("text/plain")) + { + string value; + if (urlData.requests[request].headers.TryGetValue("user-agent", out value)) + { + if (value != null && value.IndexOf("MSIE") >= 0) + { + // wrap the html escaped response if the target client is IE + // It ignores "text/plain" if the body is html + responseBody = "" + System.Web.HttpUtility.HtmlEncode(body) + ""; + } + } + } urlData.requests[request].responseCode = status; - urlData.requests[request].responseBody = body; + urlData.requests[request].responseBody = responseBody; //urlData.requests[request].ev.Set(); urlData.requests[request].requestDone =true; } -- cgit v1.1