From 35d29ef3e3539b03164289481fbf305ad7565dfb Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 29 Jan 2011 19:38:05 -0800 Subject: [PATCH] If llHTTPRequest results in an error, still attempt to get the response text. If we can't (which implies the server is unreachable), return the StatusDescription as before. --- .../Scripting/HttpRequest/ScriptsHttpRequests.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index e4a24611d6..51742ff784 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -408,7 +408,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest { HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; Status = (int)webRsp.StatusCode; - ResponseBody = webRsp.StatusDescription; + try + { + using (Stream responseStream = webRsp.GetResponseStream()) + { + ResponseBody = responseStream.GetStreamString(); + } + } + catch + { + ResponseBody = webRsp.StatusDescription; + } } else {