From 0169177c995daa513df4b5b7f1f74c2cedaaebf2 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 7 Oct 2008 20:07:24 +0000 Subject: [PATCH] * HttpServer fix for when a handler throws an exception but has already closed the response connection * UUID.TryParse() on a null or empty string will now return false git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@2275 52acb1d6-8a22-11de-b505-999d5b087335 --- OpenMetaverse/Capabilities/HttpServer.cs | 16 +++++++++++++--- OpenMetaverse/Types/UUID.cs | 6 ++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/OpenMetaverse/Capabilities/HttpServer.cs b/OpenMetaverse/Capabilities/HttpServer.cs index 07191b46..241d0912 100644 --- a/OpenMetaverse/Capabilities/HttpServer.cs +++ b/OpenMetaverse/Capabilities/HttpServer.cs @@ -157,11 +157,21 @@ namespace OpenMetaverse.Capabilities } catch (Exception e) { - context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; - context.Response.StatusDescription = e.ToString(); + try + { + context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; + context.Response.StatusDescription = e.ToString(); + } + catch (Exception) + { + Logger.Log(e.ToString(), Helpers.LogLevel.Error); + } + } + finally + { + context.Response.Close(); } - context.Response.Close(); return; } } diff --git a/OpenMetaverse/Types/UUID.cs b/OpenMetaverse/Types/UUID.cs index 3ee2ef44..4e27f1a0 100644 --- a/OpenMetaverse/Types/UUID.cs +++ b/OpenMetaverse/Types/UUID.cs @@ -208,6 +208,12 @@ namespace OpenMetaverse /// UUID.TryParse("11f8aa9c-b071-4242-836b-13b7abe0d489", result) public static bool TryParse(string val, out UUID result) { + if (String.IsNullOrEmpty(val)) + { + result = UUID.Zero; + return false; + } + try { result = Parse(val);