From 6754681e5b775a2ae33d6dca4fd155c81d6ac070 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 1 Oct 2008 04:26:51 +0000 Subject: * Adds error handlers for errors parsing the querystring passed on the OSHttpRequest constructor. * maybe.. it was a key that was null. Obviously you can't still a null key in a string key'ed collection. --- OpenSim/Framework/Servers/OSHttpRequest.cs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/OSHttpRequest.cs b/OpenSim/Framework/Servers/OSHttpRequest.cs index 28f4337..55c983d 100644 --- a/OpenSim/Framework/Servers/OSHttpRequest.cs +++ b/OpenSim/Framework/Servers/OSHttpRequest.cs @@ -221,10 +221,25 @@ namespace OpenSim.Framework.Servers _userAgent = req.Headers["user-agent"]; _queryString = new NameValueCollection(); _query = new Hashtable(); - foreach (KeyValuePair q in req.QueryString) + try { - _queryString.Add(q.Key, q.Value.Value); - _query[q.Key] = q.Value.Value; + foreach (KeyValuePair q in req.QueryString) + { + try + { + _queryString.Add(q.Key, q.Value.Value); + _query[q.Key] = q.Value.Value; + } + catch (InvalidCastException) + { + System.Console.WriteLine("[OSHttpRequest]: Errror parsing querystring.. but it was recoverable.. skipping on to the next one"); + continue; + } + } + } + catch (Exception) + { + System.Console.WriteLine("[OSHttpRequest]: Errror parsing querystring"); } // TODO: requires change to HttpServer.HttpRequest _ipEndPoint = null; -- cgit v1.1