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.

avinationmerge
Tom 2011-01-29 19:38:05 -08:00
parent a2d51f0ff4
commit 35d29ef3e3
1 changed files with 11 additions and 1 deletions

View File

@ -408,7 +408,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
{ {
HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response;
Status = (int)webRsp.StatusCode; Status = (int)webRsp.StatusCode;
ResponseBody = webRsp.StatusDescription; try
{
using (Stream responseStream = webRsp.GetResponseStream())
{
ResponseBody = responseStream.GetStreamString();
}
}
catch
{
ResponseBody = webRsp.StatusDescription;
}
} }
else else
{ {