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
parent
96d1891c71
commit
5095b4c212
|
@ -357,8 +357,18 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
status = (int)OSHttpStatusCode.ClientErrorJoker;
|
if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError)
|
||||||
response_body = e.Message;
|
{
|
||||||
|
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;
|
finished = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue