handle a condition where the http headers apparently have multiple remote ports designated

mysql-performance
dahlia 2009-12-02 04:10:53 -08:00
parent 5ee79c62bf
commit 4234c64147
1 changed files with 9 additions and 1 deletions

View File

@ -188,7 +188,15 @@ namespace OpenSim.Framework.Servers.HttpServer
try try
{ {
IPAddress addr = IPAddress.Parse(req.Headers["remote_addr"]); 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); _remoteIPEndPoint = new IPEndPoint(addr, port);
} }
catch (FormatException) catch (FormatException)