From 4234c64147cd59c284276a5408702c31860a5928 Mon Sep 17 00:00:00 2001 From: dahlia Date: Wed, 2 Dec 2009 04:10:53 -0800 Subject: handle a condition where the http headers apparently have multiple remote ports designated --- OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs index c53160f..bcfb0a4 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs @@ -188,7 +188,15 @@ namespace OpenSim.Framework.Servers.HttpServer try { IPAddress addr = IPAddress.Parse(req.Headers["remote_addr"]); - int port = Int32.Parse(req.Headers["remote_port"]); + // sometimes req.Headers["remote_port"] returns a comma separated list, so use + // the first one in the list and log it + string[] strPorts = req.Headers["remote_port"].Split(new char[] { ',' }); + if (strPorts.Length > 1) + { + _log.ErrorFormat("[OSHttpRequest]: format exception on addr/port {0}:{1}, ignoring", + req.Headers["remote_addr"], req.Headers["remote_port"]); + } + int port = Int32.Parse(strPorts[0]); _remoteIPEndPoint = new IPEndPoint(addr, port); } catch (FormatException) -- cgit v1.1 From 504bfd87d5a769aaea3f7a8469254b6340487442 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 Dec 2009 17:57:29 +0000 Subject: if an xml rpc method throws an exception, log as an error to the console as well as returning the exception to the caller --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index bec5ed3..7de5c4c 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -723,13 +723,21 @@ namespace OpenSim.Framework.Servers.HttpServer xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); } catch(Exception e) - { + { + string errorMessage + = String.Format( + "Requested method [{0}] from {1} threw exception: {2} {3}", + methodName, request.RemoteIPEndPoint.Address, e.Message, e.StackTrace); + + m_log.ErrorFormat("[BASE HTTP SERVER]: {0}", errorMessage); + // if the registered XmlRpc method threw an exception, we pass a fault-code along xmlRpcResponse = new XmlRpcResponse(); + // Code probably set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php - xmlRpcResponse.SetFault(-32603, String.Format("Requested method [{0}] threw exception: {1}", - methodName, e.Message)); + xmlRpcResponse.SetFault(-32603, errorMessage); } + // if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here response.KeepAlive = m_rpcHandlersKeepAlive[methodName]; } -- cgit v1.1 From 8e089b6d8d0d5b20cce6c812d987f77bc3957435 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sat, 5 Dec 2009 13:23:05 -0500 Subject: * Fix line endings in BaseHttpServer.cs --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 7de5c4c..75cdeb4 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -723,12 +723,12 @@ namespace OpenSim.Framework.Servers.HttpServer xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); } catch(Exception e) - { - string errorMessage - = String.Format( - "Requested method [{0}] from {1} threw exception: {2} {3}", - methodName, request.RemoteIPEndPoint.Address, e.Message, e.StackTrace); - + { + string errorMessage + = String.Format( + "Requested method [{0}] from {1} threw exception: {2} {3}", + methodName, request.RemoteIPEndPoint.Address, e.Message, e.StackTrace); + m_log.ErrorFormat("[BASE HTTP SERVER]: {0}", errorMessage); // if the registered XmlRpc method threw an exception, we pass a fault-code along -- cgit v1.1