diff options
Fix for failed http request status
Thanks "sendapatch" for fixes to llHTTPRequest status reporting.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 43672d1..8fb5d75 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -411,8 +411,21 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
411 | } | 411 | } |
412 | 412 | ||
413 | Request.Timeout = HttpTimeout; | 413 | Request.Timeout = HttpTimeout; |
414 | // execute the request | 414 | try |
415 | response = (HttpWebResponse) Request.GetResponse(); | 415 | { |
416 | // execute the request | ||
417 | response = (HttpWebResponse) Request.GetResponse(); | ||
418 | } | ||
419 | catch (WebException e) | ||
420 | { | ||
421 | if (e.Status != WebExceptionStatus.ProtocolError) | ||
422 | { | ||
423 | throw; | ||
424 | } | ||
425 | response = (HttpWebResponse)e.Response; | ||
426 | } | ||
427 | |||
428 | Status = (int)response.StatusCode; | ||
416 | 429 | ||
417 | Stream resStream = response.GetResponseStream(); | 430 | Stream resStream = response.GetResponseStream(); |
418 | 431 | ||
@@ -436,17 +449,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
436 | } | 449 | } |
437 | catch (Exception e) | 450 | catch (Exception e) |
438 | { | 451 | { |
439 | if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError) | 452 | Status = (int)OSHttpStatusCode.ClientErrorJoker; |
440 | { | 453 | ResponseBody = e.Message; |
441 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; | ||
442 | Status = (int)webRsp.StatusCode; | ||
443 | ResponseBody = webRsp.StatusDescription; | ||
444 | } | ||
445 | else | ||
446 | { | ||
447 | Status = (int)OSHttpStatusCode.ClientErrorJoker; | ||
448 | ResponseBody = e.Message; | ||
449 | } | ||
450 | 454 | ||
451 | _finished = true; | 455 | _finished = true; |
452 | return; | 456 | return; |
@@ -457,7 +461,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
457 | response.Close(); | 461 | response.Close(); |
458 | } | 462 | } |
459 | 463 | ||
460 | Status = (int)OSHttpStatusCode.SuccessOk; | ||
461 | _finished = true; | 464 | _finished = true; |
462 | } | 465 | } |
463 | 466 | ||