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
parent
427ab219b8
commit
71f7bfc2ff
|
@ -328,8 +328,22 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
if (m_RequestMap.ContainsKey(request))
|
if (m_RequestMap.ContainsKey(request))
|
||||||
{
|
{
|
||||||
UrlData urlData = m_RequestMap[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].responseCode = status;
|
||||||
urlData.requests[request].responseBody = body;
|
urlData.requests[request].responseBody = responseBody;
|
||||||
//urlData.requests[request].ev.Set();
|
//urlData.requests[request].ev.Set();
|
||||||
urlData.requests[request].requestDone =true;
|
urlData.requests[request].requestDone =true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue