From 5a095723932a94f024dfde3f0266818e0456dade Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 13 Mar 2012 20:14:51 -0700 Subject: Minor sanity check on simulation agent handler (content type) --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 1d1f9ef..5c9be8f 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -272,23 +272,28 @@ namespace OpenSim.Server.Handlers.Simulation keysvals.Add("headers", headervals); keysvals.Add("querystringkeys", querystringkeys); - Stream inputStream; + httpResponse.StatusCode = 200; + httpResponse.ContentType = "text/html"; + httpResponse.KeepAlive = false; + Encoding encoding = Encoding.UTF8; + + Stream inputStream = null; if (httpRequest.ContentType == "application/x-gzip") inputStream = new GZipStream(request, CompressionMode.Decompress); - else + else if (httpRequest.ContentType == "application/json") inputStream = request; + else // no go + { + httpResponse.StatusCode = 406; + return encoding.GetBytes("false"); + } - Encoding encoding = Encoding.UTF8; StreamReader reader = new StreamReader(inputStream, encoding); string requestBody = reader.ReadToEnd(); reader.Close(); keysvals.Add("body", requestBody); - httpResponse.StatusCode = 200; - httpResponse.ContentType = "text/html"; - httpResponse.KeepAlive = false; - Hashtable responsedata = new Hashtable(); UUID agentID; -- cgit v1.1