From 5095b4c2125f1a4035952539e8051cd39ddae989 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Wed, 30 Jul 2008 16:47:25 +0000 Subject: From: Richard Alimi 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. --- .../Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 14 ++++++++++++-- 1 file 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 } 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; } -- cgit v1.1