diff options
author | Diva Canto | 2012-03-13 20:14:51 -0700 |
---|---|---|
committer | Diva Canto | 2012-03-13 20:14:51 -0700 |
commit | 5a095723932a94f024dfde3f0266818e0456dade (patch) | |
tree | 943d606b674b27a90afa1dae57893edbb268e541 | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-5a095723932a94f024dfde3f0266818e0456dade.zip opensim-SC-5a095723932a94f024dfde3f0266818e0456dade.tar.gz opensim-SC-5a095723932a94f024dfde3f0266818e0456dade.tar.bz2 opensim-SC-5a095723932a94f024dfde3f0266818e0456dade.tar.xz |
Minor sanity check on simulation agent handler (content type)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 19 |
1 files 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 | |||
272 | keysvals.Add("headers", headervals); | 272 | keysvals.Add("headers", headervals); |
273 | keysvals.Add("querystringkeys", querystringkeys); | 273 | keysvals.Add("querystringkeys", querystringkeys); |
274 | 274 | ||
275 | Stream inputStream; | 275 | httpResponse.StatusCode = 200; |
276 | httpResponse.ContentType = "text/html"; | ||
277 | httpResponse.KeepAlive = false; | ||
278 | Encoding encoding = Encoding.UTF8; | ||
279 | |||
280 | Stream inputStream = null; | ||
276 | if (httpRequest.ContentType == "application/x-gzip") | 281 | if (httpRequest.ContentType == "application/x-gzip") |
277 | inputStream = new GZipStream(request, CompressionMode.Decompress); | 282 | inputStream = new GZipStream(request, CompressionMode.Decompress); |
278 | else | 283 | else if (httpRequest.ContentType == "application/json") |
279 | inputStream = request; | 284 | inputStream = request; |
285 | else // no go | ||
286 | { | ||
287 | httpResponse.StatusCode = 406; | ||
288 | return encoding.GetBytes("false"); | ||
289 | } | ||
280 | 290 | ||
281 | Encoding encoding = Encoding.UTF8; | ||
282 | StreamReader reader = new StreamReader(inputStream, encoding); | 291 | StreamReader reader = new StreamReader(inputStream, encoding); |
283 | 292 | ||
284 | string requestBody = reader.ReadToEnd(); | 293 | string requestBody = reader.ReadToEnd(); |
285 | reader.Close(); | 294 | reader.Close(); |
286 | keysvals.Add("body", requestBody); | 295 | keysvals.Add("body", requestBody); |
287 | 296 | ||
288 | httpResponse.StatusCode = 200; | ||
289 | httpResponse.ContentType = "text/html"; | ||
290 | httpResponse.KeepAlive = false; | ||
291 | |||
292 | Hashtable responsedata = new Hashtable(); | 297 | Hashtable responsedata = new Hashtable(); |
293 | 298 | ||
294 | UUID agentID; | 299 | UUID agentID; |