diff options
author | Dr Scofield | 2008-07-30 16:47:25 +0000 |
---|---|---|
committer | Dr Scofield | 2008-07-30 16:47:25 +0000 |
commit | 5095b4c2125f1a4035952539e8051cd39ddae989 (patch) | |
tree | 2d926111d6241bf4e3108142f7ab692d487ed3ab /OpenSim/Region | |
parent | From: Richard Alimi <ralimi@us.ibm.com> (diff) | |
download | opensim-SC_OLD-5095b4c2125f1a4035952539e8051cd39ddae989.zip opensim-SC_OLD-5095b4c2125f1a4035952539e8051cd39ddae989.tar.gz opensim-SC_OLD-5095b4c2125f1a4035952539e8051cd39ddae989.tar.bz2 opensim-SC_OLD-5095b4c2125f1a4035952539e8051cd39ddae989.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 7677834..1eb0387 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -357,8 +357,18 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
357 | } | 357 | } |
358 | catch (Exception e) | 358 | catch (Exception e) |
359 | { | 359 | { |
360 | status = (int)OSHttpStatusCode.ClientErrorJoker; | 360 | if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError) |
361 | response_body = e.Message; | 361 | { |
362 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; | ||
363 | status = (int)webRsp.StatusCode; | ||
364 | response_body = webRsp.StatusDescription; | ||
365 | } | ||
366 | else | ||
367 | { | ||
368 | status = (int)OSHttpStatusCode.ClientErrorJoker; | ||
369 | response_body = e.Message; | ||
370 | } | ||
371 | |||
362 | finished = true; | 372 | finished = true; |
363 | return; | 373 | return; |
364 | } | 374 | } |