Minor sanity check on simulation agent handler (content type)

0.7.4.1
Diva Canto 2012-03-13 20:14:51 -07:00
parent 37828c9b9a
commit 5a09572393
1 changed files with 12 additions and 7 deletions

View File

@ -272,23 +272,28 @@ namespace OpenSim.Server.Handlers.Simulation
keysvals.Add("headers", headervals); keysvals.Add("headers", headervals);
keysvals.Add("querystringkeys", querystringkeys); 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") if (httpRequest.ContentType == "application/x-gzip")
inputStream = new GZipStream(request, CompressionMode.Decompress); inputStream = new GZipStream(request, CompressionMode.Decompress);
else else if (httpRequest.ContentType == "application/json")
inputStream = request; inputStream = request;
else // no go
{
httpResponse.StatusCode = 406;
return encoding.GetBytes("false");
}
Encoding encoding = Encoding.UTF8;
StreamReader reader = new StreamReader(inputStream, encoding); StreamReader reader = new StreamReader(inputStream, encoding);
string requestBody = reader.ReadToEnd(); string requestBody = reader.ReadToEnd();
reader.Close(); reader.Close();
keysvals.Add("body", requestBody); keysvals.Add("body", requestBody);
httpResponse.StatusCode = 200;
httpResponse.ContentType = "text/html";
httpResponse.KeepAlive = false;
Hashtable responsedata = new Hashtable(); Hashtable responsedata = new Hashtable();
UUID agentID; UUID agentID;