From: Richard Alimi <ralimi@us.ibm.com>

The following is a patch that causes the ensuing http_response event (after
an llHTTPRequest) to include the HTTP status code returned from the server
(if available). The patch also sets the body parameter for the
http_response event to be set as the status description returned by the
server.
0.6.0-stable
Dr Scofield 2008-07-30 16:47:25 +00:00
parent 96d1891c71
commit 5095b4c212
1 changed files with 12 additions and 2 deletions

View File

@ -357,8 +357,18 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
}
catch (Exception e)
{
status = (int)OSHttpStatusCode.ClientErrorJoker;
response_body = e.Message;
if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError)
{
HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response;
status = (int)webRsp.StatusCode;
response_body = webRsp.StatusDescription;
}
else
{
status = (int)OSHttpStatusCode.ClientErrorJoker;
response_body = e.Message;
}
finished = true;
return;
}