diff options
author | Justin Clark-Casey (justincc) | 2012-07-13 01:03:28 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-13 01:03:28 +0100 |
commit | 884d603cac6c3fe0cdbd199e13e1514146ff82bc (patch) | |
tree | 00701964cd4053700c5f37c48c8a5196928b00d1 /OpenSim/Server/Handlers/Grid | |
parent | Don't cache regions data on the other unused LocalGridServiceConnector that t... (diff) | |
download | opensim-SC-884d603cac6c3fe0cdbd199e13e1514146ff82bc.zip opensim-SC-884d603cac6c3fe0cdbd199e13e1514146ff82bc.tar.gz opensim-SC-884d603cac6c3fe0cdbd199e13e1514146ff82bc.tar.bz2 opensim-SC-884d603cac6c3fe0cdbd199e13e1514146ff82bc.tar.xz |
Rather than instantiating a UTF8 encoding everywhere when we want to supress the BOM, use a single Util.UTF8NoBomEncoding.
This class is thread-safe (as evidenced by the provision of the system-wide Encoding.UTF8 which does not suppress BOM on output).
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 42 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | 13 |
2 files changed, 25 insertions, 30 deletions
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 91d14cb..ef5f33e 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | |||
@@ -226,10 +226,9 @@ namespace OpenSim.Server.Handlers.Grid | |||
226 | } | 226 | } |
227 | 227 | ||
228 | string xmlString = ServerUtils.BuildXmlResponse(result); | 228 | string xmlString = ServerUtils.BuildXmlResponse(result); |
229 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
230 | UTF8Encoding encoding = new UTF8Encoding(); | ||
231 | return encoding.GetBytes(xmlString); | ||
232 | 229 | ||
230 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
231 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); | ||
233 | } | 232 | } |
234 | 233 | ||
235 | byte[] GetRegionByUUID(Dictionary<string, object> request) | 234 | byte[] GetRegionByUUID(Dictionary<string, object> request) |
@@ -256,9 +255,9 @@ namespace OpenSim.Server.Handlers.Grid | |||
256 | result["result"] = rinfo.ToKeyValuePairs(); | 255 | result["result"] = rinfo.ToKeyValuePairs(); |
257 | 256 | ||
258 | string xmlString = ServerUtils.BuildXmlResponse(result); | 257 | string xmlString = ServerUtils.BuildXmlResponse(result); |
258 | |||
259 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | 259 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); |
260 | UTF8Encoding encoding = new UTF8Encoding(); | 260 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
261 | return encoding.GetBytes(xmlString); | ||
262 | } | 261 | } |
263 | 262 | ||
264 | byte[] GetRegionByPosition(Dictionary<string, object> request) | 263 | byte[] GetRegionByPosition(Dictionary<string, object> request) |
@@ -289,9 +288,9 @@ namespace OpenSim.Server.Handlers.Grid | |||
289 | result["result"] = rinfo.ToKeyValuePairs(); | 288 | result["result"] = rinfo.ToKeyValuePairs(); |
290 | 289 | ||
291 | string xmlString = ServerUtils.BuildXmlResponse(result); | 290 | string xmlString = ServerUtils.BuildXmlResponse(result); |
291 | |||
292 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | 292 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); |
293 | UTF8Encoding encoding = new UTF8Encoding(); | 293 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
294 | return encoding.GetBytes(xmlString); | ||
295 | } | 294 | } |
296 | 295 | ||
297 | byte[] GetRegionByName(Dictionary<string, object> request) | 296 | byte[] GetRegionByName(Dictionary<string, object> request) |
@@ -318,9 +317,9 @@ namespace OpenSim.Server.Handlers.Grid | |||
318 | result["result"] = rinfo.ToKeyValuePairs(); | 317 | result["result"] = rinfo.ToKeyValuePairs(); |
319 | 318 | ||
320 | string xmlString = ServerUtils.BuildXmlResponse(result); | 319 | string xmlString = ServerUtils.BuildXmlResponse(result); |
320 | |||
321 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | 321 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); |
322 | UTF8Encoding encoding = new UTF8Encoding(); | 322 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
323 | return encoding.GetBytes(xmlString); | ||
324 | } | 323 | } |
325 | 324 | ||
326 | byte[] GetRegionsByName(Dictionary<string, object> request) | 325 | byte[] GetRegionsByName(Dictionary<string, object> request) |
@@ -361,9 +360,9 @@ namespace OpenSim.Server.Handlers.Grid | |||
361 | } | 360 | } |
362 | 361 | ||
363 | string xmlString = ServerUtils.BuildXmlResponse(result); | 362 | string xmlString = ServerUtils.BuildXmlResponse(result); |
363 | |||
364 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | 364 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); |
365 | UTF8Encoding encoding = new UTF8Encoding(); | 365 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
366 | return encoding.GetBytes(xmlString); | ||
367 | } | 366 | } |
368 | 367 | ||
369 | byte[] GetRegionRange(Dictionary<string, object> request) | 368 | byte[] GetRegionRange(Dictionary<string, object> request) |
@@ -410,9 +409,9 @@ namespace OpenSim.Server.Handlers.Grid | |||
410 | } | 409 | } |
411 | } | 410 | } |
412 | string xmlString = ServerUtils.BuildXmlResponse(result); | 411 | string xmlString = ServerUtils.BuildXmlResponse(result); |
412 | |||
413 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | 413 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); |
414 | UTF8Encoding encoding = new UTF8Encoding(); | 414 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
415 | return encoding.GetBytes(xmlString); | ||
416 | } | 415 | } |
417 | 416 | ||
418 | byte[] GetDefaultRegions(Dictionary<string, object> request) | 417 | byte[] GetDefaultRegions(Dictionary<string, object> request) |
@@ -440,9 +439,9 @@ namespace OpenSim.Server.Handlers.Grid | |||
440 | } | 439 | } |
441 | } | 440 | } |
442 | string xmlString = ServerUtils.BuildXmlResponse(result); | 441 | string xmlString = ServerUtils.BuildXmlResponse(result); |
442 | |||
443 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | 443 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); |
444 | UTF8Encoding encoding = new UTF8Encoding(); | 444 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
445 | return encoding.GetBytes(xmlString); | ||
446 | } | 445 | } |
447 | 446 | ||
448 | byte[] GetFallbackRegions(Dictionary<string, object> request) | 447 | byte[] GetFallbackRegions(Dictionary<string, object> request) |
@@ -481,9 +480,9 @@ namespace OpenSim.Server.Handlers.Grid | |||
481 | } | 480 | } |
482 | } | 481 | } |
483 | string xmlString = ServerUtils.BuildXmlResponse(result); | 482 | string xmlString = ServerUtils.BuildXmlResponse(result); |
483 | |||
484 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | 484 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); |
485 | UTF8Encoding encoding = new UTF8Encoding(); | 485 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
486 | return encoding.GetBytes(xmlString); | ||
487 | } | 486 | } |
488 | 487 | ||
489 | byte[] GetHyperlinks(Dictionary<string, object> request) | 488 | byte[] GetHyperlinks(Dictionary<string, object> request) |
@@ -511,9 +510,9 @@ namespace OpenSim.Server.Handlers.Grid | |||
511 | } | 510 | } |
512 | } | 511 | } |
513 | string xmlString = ServerUtils.BuildXmlResponse(result); | 512 | string xmlString = ServerUtils.BuildXmlResponse(result); |
513 | |||
514 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | 514 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); |
515 | UTF8Encoding encoding = new UTF8Encoding(); | 515 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
516 | return encoding.GetBytes(xmlString); | ||
517 | } | 516 | } |
518 | 517 | ||
519 | byte[] GetRegionFlags(Dictionary<string, object> request) | 518 | byte[] GetRegionFlags(Dictionary<string, object> request) |
@@ -537,12 +536,11 @@ namespace OpenSim.Server.Handlers.Grid | |||
537 | result["result"] = flags.ToString(); | 536 | result["result"] = flags.ToString(); |
538 | 537 | ||
539 | string xmlString = ServerUtils.BuildXmlResponse(result); | 538 | string xmlString = ServerUtils.BuildXmlResponse(result); |
539 | |||
540 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | 540 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); |
541 | UTF8Encoding encoding = new UTF8Encoding(); | 541 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
542 | return encoding.GetBytes(xmlString); | ||
543 | } | 542 | } |
544 | 543 | ||
545 | |||
546 | #endregion | 544 | #endregion |
547 | 545 | ||
548 | #region Misc | 546 | #region Misc |
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index bf21255..687cf8d 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | |||
@@ -117,10 +117,9 @@ namespace OpenSim.Server.Handlers.GridUser | |||
117 | result["result"] = guinfo.ToKeyValuePairs(); | 117 | result["result"] = guinfo.ToKeyValuePairs(); |
118 | 118 | ||
119 | string xmlString = ServerUtils.BuildXmlResponse(result); | 119 | string xmlString = ServerUtils.BuildXmlResponse(result); |
120 | //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); | ||
121 | UTF8Encoding encoding = new UTF8Encoding(); | ||
122 | return encoding.GetBytes(xmlString); | ||
123 | 120 | ||
121 | //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); | ||
122 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); | ||
124 | } | 123 | } |
125 | 124 | ||
126 | byte[] LoggedOut(Dictionary<string, object> request) | 125 | byte[] LoggedOut(Dictionary<string, object> request) |
@@ -189,10 +188,9 @@ namespace OpenSim.Server.Handlers.GridUser | |||
189 | result["result"] = guinfo.ToKeyValuePairs(); | 188 | result["result"] = guinfo.ToKeyValuePairs(); |
190 | 189 | ||
191 | string xmlString = ServerUtils.BuildXmlResponse(result); | 190 | string xmlString = ServerUtils.BuildXmlResponse(result); |
192 | //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); | ||
193 | UTF8Encoding encoding = new UTF8Encoding(); | ||
194 | return encoding.GetBytes(xmlString); | ||
195 | 191 | ||
192 | //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); | ||
193 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); | ||
196 | } | 194 | } |
197 | 195 | ||
198 | byte[] GetGridUserInfos(Dictionary<string, object> request) | 196 | byte[] GetGridUserInfos(Dictionary<string, object> request) |
@@ -231,8 +229,7 @@ namespace OpenSim.Server.Handlers.GridUser | |||
231 | } | 229 | } |
232 | 230 | ||
233 | string xmlString = ServerUtils.BuildXmlResponse(result); | 231 | string xmlString = ServerUtils.BuildXmlResponse(result); |
234 | UTF8Encoding encoding = new UTF8Encoding(); | 232 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
235 | return encoding.GetBytes(xmlString); | ||
236 | } | 233 | } |
237 | 234 | ||
238 | private bool UnpackArgs(Dictionary<string, object> request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt) | 235 | private bool UnpackArgs(Dictionary<string, object> request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt) |