mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 11:25:39 +08:00
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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user