diff options
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>
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | 16 |
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 | } |