From 5ae8759de16875309cdd0fccf5d3bb24bac483d6 Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 2 Dec 2007 18:49:42 +0000 Subject: Added some error handling (and console output) to BaseHttpServer. a few other bits of refactoring. --- OpenSim/Framework/Servers/BaseHttpServer.cs | 36 ++++++++++++++++++----------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index e645e7b..baf5add 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -185,26 +185,34 @@ namespace OpenSim.Framework.Servers if (xmlRprcRequest != null) { string methodName = xmlRprcRequest.MethodName; + if (methodName != null) + { - XmlRpcResponse xmlRpcResponse; + XmlRpcResponse xmlRpcResponse; - XmlRpcMethod method; - if (m_rpcHandlers.TryGetValue(methodName, out method)) - { - xmlRpcResponse = method(xmlRprcRequest); + XmlRpcMethod method; + if (m_rpcHandlers.TryGetValue(methodName, out method)) + { + xmlRpcResponse = method(xmlRprcRequest); + } + else + { + xmlRpcResponse = new XmlRpcResponse(); + Hashtable unknownMethodError = new Hashtable(); + unknownMethodError["reason"] = "XmlRequest"; + ; + unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]"; + unknownMethodError["login"] = "false"; + xmlRpcResponse.Value = unknownMethodError; + } + + responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); } else { - xmlRpcResponse = new XmlRpcResponse(); - Hashtable unknownMethodError = new Hashtable(); - unknownMethodError["reason"] = "XmlRequest"; - ; - unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]"; - unknownMethodError["login"] = "false"; - xmlRpcResponse.Value = unknownMethodError; + System.Console.WriteLine("Handler not found for http request " +request.RawUrl); + responseString = "Error"; } - - responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); } response.AddHeader("Content-type", "text/xml"); -- cgit v1.1