From 35d29ef3e3539b03164289481fbf305ad7565dfb Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 29 Jan 2011 19:38:05 -0800 Subject: 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. --- .../CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index e4a2461..51742ff 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 { -- cgit v1.1