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>
user_profiles
Talun 2013-01-24 21:08:57 +00:00 committed by nebadon
parent 427ab219b8
commit 71f7bfc2ff
1 changed files with 15 additions and 1 deletions

View File

@ -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 = "<html>" + System.Web.HttpUtility.HtmlEncode(body) + "</html>";
}
}
}
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;
}