Fix for failed http request status
Thanks "sendapatch" for fixes to llHTTPRequest status reporting.iar_mods
parent
56dbcae402
commit
87374274b9
|
@ -411,8 +411,21 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
Request.Timeout = HttpTimeout;
|
Request.Timeout = HttpTimeout;
|
||||||
// execute the request
|
try
|
||||||
response = (HttpWebResponse) Request.GetResponse();
|
{
|
||||||
|
// execute the request
|
||||||
|
response = (HttpWebResponse) Request.GetResponse();
|
||||||
|
}
|
||||||
|
catch (WebException e)
|
||||||
|
{
|
||||||
|
if (e.Status != WebExceptionStatus.ProtocolError)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
response = (HttpWebResponse)e.Response;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = (int)response.StatusCode;
|
||||||
|
|
||||||
Stream resStream = response.GetResponseStream();
|
Stream resStream = response.GetResponseStream();
|
||||||
|
|
||||||
|
@ -436,17 +449,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError)
|
Status = (int)OSHttpStatusCode.ClientErrorJoker;
|
||||||
{
|
ResponseBody = e.Message;
|
||||||
HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response;
|
|
||||||
Status = (int)webRsp.StatusCode;
|
|
||||||
ResponseBody = webRsp.StatusDescription;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Status = (int)OSHttpStatusCode.ClientErrorJoker;
|
|
||||||
ResponseBody = e.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
_finished = true;
|
_finished = true;
|
||||||
return;
|
return;
|
||||||
|
@ -457,7 +461,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
response.Close();
|
response.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = (int)OSHttpStatusCode.SuccessOk;
|
|
||||||
_finished = true;
|
_finished = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue