mirror of
https://github.com/opensim/opensim.git
synced 2026-07-02 08:25:44 +08:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user