aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers
diff options
context:
space:
mode:
authorUbitUmarov2012-07-17 00:54:23 +0100
committerUbitUmarov2012-07-17 00:54:23 +0100
commitd5f4fb7b50fb7c594b018f8241399e22f88fc951 (patch)
tree8f3dab3d170596f02b1d1d836a0bc08a3e6b8ebd /OpenSim/Server/Handlers
parentUbitOde: remove useless water collider from active code. (diff)
parentMerge branch 'avination' into careminster (diff)
downloadopensim-SC-d5f4fb7b50fb7c594b018f8241399e22f88fc951.zip
opensim-SC-d5f4fb7b50fb7c594b018f8241399e22f88fc951.tar.gz
opensim-SC-d5f4fb7b50fb7c594b018f8241399e22f88fc951.tar.bz2
opensim-SC-d5f4fb7b50fb7c594b018f8241399e22f88fc951.tar.xz
Merge branch 'avination' into ubitwork
Diffstat (limited to 'OpenSim/Server/Handlers')
-rw-r--r--OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs3
-rw-r--r--OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs3
-rw-r--r--OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs9
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs44
-rw-r--r--OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs13
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs9
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs45
-rw-r--r--OpenSim/Server/Handlers/Map/MapAddServerConnector.cs79
-rw-r--r--OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs9
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs11
-rw-r--r--OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs50
-rw-r--r--OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs9
13 files changed, 150 insertions, 136 deletions
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
index a19b599..6b93cd9 100644
--- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
@@ -321,8 +321,7 @@ namespace OpenSim.Server.Handlers.Authentication
321 private byte[] ResultToBytes(Dictionary<string, object> result) 321 private byte[] ResultToBytes(Dictionary<string, object> result)
322 { 322 {
323 string xmlString = ServerUtils.BuildXmlResponse(result); 323 string xmlString = ServerUtils.BuildXmlResponse(result);
324 UTF8Encoding encoding = new UTF8Encoding(); 324 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
325 return encoding.GetBytes(xmlString);
326 } 325 }
327 } 326 }
328} 327}
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
index dfed761..18cef15 100644
--- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
@@ -191,6 +191,8 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
191 191
192 #endregion HTML 192 #endregion HTML
193 193
194 public string Name { get { return "OpenId"; } }
195 public string Description { get { return null; } }
194 public string ContentType { get { return m_contentType; } } 196 public string ContentType { get { return m_contentType; } }
195 public string HttpMethod { get { return m_httpMethod; } } 197 public string HttpMethod { get { return m_httpMethod; } }
196 public string Path { get { return m_path; } } 198 public string Path { get { return m_path; } }
diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
index 3ee405c..393584e 100644
--- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
@@ -121,8 +121,7 @@ namespace OpenSim.Server.Handlers.Avatar
121 121
122 string xmlString = ServerUtils.BuildXmlResponse(result); 122 string xmlString = ServerUtils.BuildXmlResponse(result);
123 123
124 UTF8Encoding encoding = new UTF8Encoding(); 124 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
125 return encoding.GetBytes(xmlString);
126 } 125 }
127 126
128 return FailureResult(); 127 return FailureResult();
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
index 59420f5..47a8558 100644
--- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
@@ -95,7 +95,8 @@ namespace OpenSim.Server.Handlers.Friends
95 return DeleteFriendString(request); 95 return DeleteFriendString(request);
96 96
97 } 97 }
98 m_log.DebugFormat("[FRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); 98
99 m_log.DebugFormat("[FRIENDS HANDLER]: unknown method request {0}", method);
99 } 100 }
100 catch (Exception e) 101 catch (Exception e)
101 { 102 {
@@ -103,7 +104,6 @@ namespace OpenSim.Server.Handlers.Friends
103 } 104 }
104 105
105 return FailureResult(); 106 return FailureResult();
106
107 } 107 }
108 108
109 #region Method-specific handlers 109 #region Method-specific handlers
@@ -152,10 +152,9 @@ namespace OpenSim.Server.Handlers.Friends
152 } 152 }
153 153
154 string xmlString = ServerUtils.BuildXmlResponse(result); 154 string xmlString = ServerUtils.BuildXmlResponse(result);
155 //m_log.DebugFormat("[FRIENDS HANDLER]: resp string: {0}", xmlString);
156 UTF8Encoding encoding = new UTF8Encoding();
157 return encoding.GetBytes(xmlString);
158 155
156 //m_log.DebugFormat("[FRIENDS HANDLER]: resp string: {0}", xmlString);
157 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
159 } 158 }
160 159
161 byte[] StoreFriend(Dictionary<string, object> request) 160 byte[] StoreFriend(Dictionary<string, object> request)
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index bebf482..ef5f33e 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -116,7 +116,7 @@ namespace OpenSim.Server.Handlers.Grid
116 return GetRegionFlags(request); 116 return GetRegionFlags(request);
117 } 117 }
118 118
119 m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); 119 m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method);
120 } 120 }
121 catch (Exception e) 121 catch (Exception e)
122 { 122 {
@@ -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)
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
index 8ef03e7..0aa2729 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
@@ -122,7 +122,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
122 return GrantRights(request); 122 return GrantRights(request);
123 */ 123 */
124 } 124 }
125 m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); 125
126 m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0}", method);
126 } 127 }
127 catch (Exception e) 128 catch (Exception e)
128 { 129 {
@@ -278,13 +279,11 @@ namespace OpenSim.Server.Handlers.Hypergrid
278 } 279 }
279 280
280 string xmlString = ServerUtils.BuildXmlResponse(result); 281 string xmlString = ServerUtils.BuildXmlResponse(result);
281 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
282 UTF8Encoding encoding = new UTF8Encoding();
283 return encoding.GetBytes(xmlString);
284 282
283 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
284 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
285 } 285 }
286 286
287
288 #endregion 287 #endregion
289 288
290 #region Misc 289 #region Misc
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index cb9b65d..64127c2 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -217,9 +217,9 @@ namespace OpenSim.Server.Handlers.Asset
217 result["RESULT"] = "False"; 217 result["RESULT"] = "False";
218 218
219 string xmlString = ServerUtils.BuildXmlResponse(result); 219 string xmlString = ServerUtils.BuildXmlResponse(result);
220
220 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 221 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
221 UTF8Encoding encoding = new UTF8Encoding(); 222 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
222 return encoding.GetBytes(xmlString);
223 } 223 }
224 224
225 byte[] HandleGetInventorySkeleton(Dictionary<string,object> request) 225 byte[] HandleGetInventorySkeleton(Dictionary<string,object> request)
@@ -245,9 +245,9 @@ namespace OpenSim.Server.Handlers.Asset
245 result["FOLDERS"] = sfolders; 245 result["FOLDERS"] = sfolders;
246 246
247 string xmlString = ServerUtils.BuildXmlResponse(result); 247 string xmlString = ServerUtils.BuildXmlResponse(result);
248
248 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 249 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
249 UTF8Encoding encoding = new UTF8Encoding(); 250 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
250 return encoding.GetBytes(xmlString);
251 } 251 }
252 252
253 byte[] HandleGetUserInventory(Dictionary<string, object> request) 253 byte[] HandleGetUserInventory(Dictionary<string, object> request)
@@ -284,9 +284,9 @@ namespace OpenSim.Server.Handlers.Asset
284 } 284 }
285 285
286 string xmlString = ServerUtils.BuildXmlResponse(result); 286 string xmlString = ServerUtils.BuildXmlResponse(result);
287
287 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 288 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
288 UTF8Encoding encoding = new UTF8Encoding(); 289 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
289 return encoding.GetBytes(xmlString);
290 } 290 }
291 291
292 byte[] HandleGetRootFolder(Dictionary<string,object> request) 292 byte[] HandleGetRootFolder(Dictionary<string,object> request)
@@ -300,9 +300,9 @@ namespace OpenSim.Server.Handlers.Asset
300 result["folder"] = EncodeFolder(rfolder); 300 result["folder"] = EncodeFolder(rfolder);
301 301
302 string xmlString = ServerUtils.BuildXmlResponse(result); 302 string xmlString = ServerUtils.BuildXmlResponse(result);
303
303 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 304 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
304 UTF8Encoding encoding = new UTF8Encoding(); 305 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
305 return encoding.GetBytes(xmlString);
306 } 306 }
307 307
308 byte[] HandleGetFolderForType(Dictionary<string,object> request) 308 byte[] HandleGetFolderForType(Dictionary<string,object> request)
@@ -317,9 +317,9 @@ namespace OpenSim.Server.Handlers.Asset
317 result["folder"] = EncodeFolder(folder); 317 result["folder"] = EncodeFolder(folder);
318 318
319 string xmlString = ServerUtils.BuildXmlResponse(result); 319 string xmlString = ServerUtils.BuildXmlResponse(result);
320
320 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 321 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
321 UTF8Encoding encoding = new UTF8Encoding(); 322 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
322 return encoding.GetBytes(xmlString);
323 } 323 }
324 324
325 byte[] HandleGetFolderContent(Dictionary<string,object> request) 325 byte[] HandleGetFolderContent(Dictionary<string,object> request)
@@ -358,9 +358,9 @@ namespace OpenSim.Server.Handlers.Asset
358 } 358 }
359 359
360 string xmlString = ServerUtils.BuildXmlResponse(result); 360 string xmlString = ServerUtils.BuildXmlResponse(result);
361
361 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 362 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
362 UTF8Encoding encoding = new UTF8Encoding(); 363 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
363 return encoding.GetBytes(xmlString);
364 } 364 }
365 365
366 byte[] HandleGetFolderItems(Dictionary<string,object> request) 366 byte[] HandleGetFolderItems(Dictionary<string,object> request)
@@ -386,9 +386,9 @@ namespace OpenSim.Server.Handlers.Asset
386 result["ITEMS"] = sitems; 386 result["ITEMS"] = sitems;
387 387
388 string xmlString = ServerUtils.BuildXmlResponse(result); 388 string xmlString = ServerUtils.BuildXmlResponse(result);
389
389 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 390 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
390 UTF8Encoding encoding = new UTF8Encoding(); 391 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
391 return encoding.GetBytes(xmlString);
392 } 392 }
393 393
394 byte[] HandleAddFolder(Dictionary<string,object> request) 394 byte[] HandleAddFolder(Dictionary<string,object> request)
@@ -550,9 +550,9 @@ namespace OpenSim.Server.Handlers.Asset
550 result["item"] = EncodeItem(item); 550 result["item"] = EncodeItem(item);
551 551
552 string xmlString = ServerUtils.BuildXmlResponse(result); 552 string xmlString = ServerUtils.BuildXmlResponse(result);
553
553 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 554 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
554 UTF8Encoding encoding = new UTF8Encoding(); 555 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
555 return encoding.GetBytes(xmlString);
556 } 556 }
557 557
558 byte[] HandleGetFolder(Dictionary<string,object> request) 558 byte[] HandleGetFolder(Dictionary<string,object> request)
@@ -567,9 +567,9 @@ namespace OpenSim.Server.Handlers.Asset
567 result["folder"] = EncodeFolder(folder); 567 result["folder"] = EncodeFolder(folder);
568 568
569 string xmlString = ServerUtils.BuildXmlResponse(result); 569 string xmlString = ServerUtils.BuildXmlResponse(result);
570
570 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 571 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
571 UTF8Encoding encoding = new UTF8Encoding(); 572 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
572 return encoding.GetBytes(xmlString);
573 } 573 }
574 574
575 byte[] HandleGetActiveGestures(Dictionary<string,object> request) 575 byte[] HandleGetActiveGestures(Dictionary<string,object> request)
@@ -592,9 +592,9 @@ namespace OpenSim.Server.Handlers.Asset
592 result["ITEMS"] = items; 592 result["ITEMS"] = items;
593 593
594 string xmlString = ServerUtils.BuildXmlResponse(result); 594 string xmlString = ServerUtils.BuildXmlResponse(result);
595
595 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 596 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
596 UTF8Encoding encoding = new UTF8Encoding(); 597 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
597 return encoding.GetBytes(xmlString);
598 } 598 }
599 599
600 byte[] HandleGetAssetPermissions(Dictionary<string,object> request) 600 byte[] HandleGetAssetPermissions(Dictionary<string,object> request)
@@ -609,12 +609,11 @@ namespace OpenSim.Server.Handlers.Asset
609 609
610 result["RESULT"] = perms.ToString(); 610 result["RESULT"] = perms.ToString();
611 string xmlString = ServerUtils.BuildXmlResponse(result); 611 string xmlString = ServerUtils.BuildXmlResponse(result);
612
612 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 613 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
613 UTF8Encoding encoding = new UTF8Encoding(); 614 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
614 return encoding.GetBytes(xmlString);
615 } 615 }
616 616
617
618 private Dictionary<string, object> EncodeFolder(InventoryFolderBase f) 617 private Dictionary<string, object> EncodeFolder(InventoryFolderBase f)
619 { 618 {
620 Dictionary<string, object> ret = new Dictionary<string, object>(); 619 Dictionary<string, object> ret = new Dictionary<string, object>();
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
index 75dd711..4a61969 100644
--- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
@@ -33,17 +33,24 @@ using System.Xml;
33 33
34using Nini.Config; 34using Nini.Config;
35using log4net; 35using log4net;
36using OpenMetaverse;
36 37
38using OpenSim.Framework;
37using OpenSim.Server.Base; 39using OpenSim.Server.Base;
38using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
39using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Server.Handlers.Base; 42using OpenSim.Server.Handlers.Base;
41 43
44using GridRegion = OpenSim.Services.Interfaces.GridRegion;
45
42namespace OpenSim.Server.Handlers.MapImage 46namespace OpenSim.Server.Handlers.MapImage
43{ 47{
44 public class MapAddServiceConnector : ServiceConnector 48 public class MapAddServiceConnector : ServiceConnector
45 { 49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
46 private IMapImageService m_MapService; 52 private IMapImageService m_MapService;
53 private IGridService m_GridService;
47 private string m_ConfigName = "MapImageService"; 54 private string m_ConfigName = "MapImageService";
48 55
49 public MapAddServiceConnector(IConfigSource config, IHttpServer server, string configName) : 56 public MapAddServiceConnector(IConfigSource config, IHttpServer server, string configName) :
@@ -53,16 +60,27 @@ namespace OpenSim.Server.Handlers.MapImage
53 if (serverConfig == null) 60 if (serverConfig == null)
54 throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); 61 throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
55 62
56 string gridService = serverConfig.GetString("LocalServiceModule", 63 string mapService = serverConfig.GetString("LocalServiceModule",
57 String.Empty); 64 String.Empty);
58 65
59 if (gridService == String.Empty) 66 if (mapService == String.Empty)
60 throw new Exception("No LocalServiceModule in config file"); 67 throw new Exception("No LocalServiceModule in config file");
61 68
62 Object[] args = new Object[] { config }; 69 Object[] args = new Object[] { config };
63 m_MapService = ServerUtils.LoadPlugin<IMapImageService>(gridService, args); 70 m_MapService = ServerUtils.LoadPlugin<IMapImageService>(mapService, args);
71
72 string gridService = serverConfig.GetString("GridService", String.Empty);
73 if (gridService != string.Empty)
74 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
75
76 if (m_GridService != null)
77 m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is ON");
78 else
79 m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF");
80
81 bool proxy = serverConfig.GetBoolean("HasProxy", false);
82 server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy));
64 83
65 server.AddStreamHandler(new MapServerPostHandler(m_MapService));
66 } 84 }
67 } 85 }
68 86
@@ -70,11 +88,15 @@ namespace OpenSim.Server.Handlers.MapImage
70 { 88 {
71 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 89 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
72 private IMapImageService m_MapService; 90 private IMapImageService m_MapService;
91 private IGridService m_GridService;
92 bool m_Proxy;
73 93
74 public MapServerPostHandler(IMapImageService service) : 94 public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy) :
75 base("POST", "/map") 95 base("POST", "/map")
76 { 96 {
77 m_MapService = service; 97 m_MapService = service;
98 m_GridService = grid;
99 m_Proxy = proxy;
78 } 100 }
79 101
80 public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 102 public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
@@ -105,6 +127,27 @@ namespace OpenSim.Server.Handlers.MapImage
105// if (request.ContainsKey("TYPE")) 127// if (request.ContainsKey("TYPE"))
106// type = request["TYPE"].ToString(); 128// type = request["TYPE"].ToString();
107 129
130 if (m_GridService != null)
131 {
132 System.Net.IPAddress ipAddr = GetCallerIP(httpRequest);
133 GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize);
134 if (r != null)
135 {
136 if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString())
137 {
138 m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be trying to impersonate region in IP {1}", ipAddr, r.ExternalEndPoint.Address);
139 return FailureResult("IP address of caller does not match IP address of registered region");
140 }
141
142 }
143 else
144 {
145 m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}",
146 ipAddr, x, y);
147 return FailureResult("Region not found at given coordinates");
148 }
149 }
150
108 byte[] data = Convert.FromBase64String(request["DATA"].ToString()); 151 byte[] data = Convert.FromBase64String(request["DATA"].ToString());
109 152
110 string reason = string.Empty; 153 string reason = string.Empty;
@@ -183,5 +226,31 @@ namespace OpenSim.Server.Handlers.MapImage
183 226
184 return ms.ToArray(); 227 return ms.ToArray();
185 } 228 }
229
230 private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
231 {
232 if (!m_Proxy)
233 return request.RemoteIPEndPoint.Address;
234
235 // We're behind a proxy
236 string xff = "X-Forwarded-For";
237 string xffValue = request.Headers[xff.ToLower()];
238 if (xffValue == null || (xffValue != null && xffValue == string.Empty))
239 xffValue = request.Headers[xff];
240
241 if (xffValue == null || (xffValue != null && xffValue == string.Empty))
242 {
243 m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header");
244 return request.RemoteIPEndPoint.Address;
245 }
246
247 System.Net.IPEndPoint ep = Util.GetClientIPFromXFF(xffValue);
248 if (ep != null)
249 return ep.Address;
250
251 // Oops
252 return request.RemoteIPEndPoint.Address;
253 }
254
186 } 255 }
187} 256}
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
index 6b6a552..2d67c6d 100644
--- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
@@ -199,9 +199,9 @@ namespace OpenSim.Server.Handlers.Presence
199 result["result"] = pinfo.ToKeyValuePairs(); 199 result["result"] = pinfo.ToKeyValuePairs();
200 200
201 string xmlString = ServerUtils.BuildXmlResponse(result); 201 string xmlString = ServerUtils.BuildXmlResponse(result);
202
202 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); 203 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
203 UTF8Encoding encoding = new UTF8Encoding(); 204 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
204 return encoding.GetBytes(xmlString);
205 } 205 }
206 206
207 byte[] GetAgents(Dictionary<string, object> request) 207 byte[] GetAgents(Dictionary<string, object> request)
@@ -240,12 +240,11 @@ namespace OpenSim.Server.Handlers.Presence
240 } 240 }
241 241
242 string xmlString = ServerUtils.BuildXmlResponse(result); 242 string xmlString = ServerUtils.BuildXmlResponse(result);
243
243 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); 244 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
244 UTF8Encoding encoding = new UTF8Encoding(); 245 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
245 return encoding.GetBytes(xmlString);
246 } 246 }
247 247
248
249 private byte[] SuccessResult() 248 private byte[] SuccessResult()
250 { 249 {
251 XmlDocument doc = new XmlDocument(); 250 XmlDocument doc = new XmlDocument();
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 8f6fa52..d772c39 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -149,13 +149,16 @@ namespace OpenSim.Server.Handlers.Simulation
149 149
150 responsedata["int_response_code"] = HttpStatusCode.OK; 150 responsedata["int_response_code"] = HttpStatusCode.OK;
151 151
152 OSDMap resp = new OSDMap(2); 152 OSDMap resp = new OSDMap(3);
153 153
154 resp["success"] = OSD.FromBoolean(result); 154 resp["success"] = OSD.FromBoolean(result);
155 resp["reason"] = OSD.FromString(reason); 155 resp["reason"] = OSD.FromString(reason);
156 resp["version"] = OSD.FromString(version); 156 resp["version"] = OSD.FromString(version);
157 157
158 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); 158 // We must preserve defaults here, otherwise a false "success" will not be put into the JSON map!
159 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true);
160
161// Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]);
159 } 162 }
160 163
161 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) 164 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
@@ -569,7 +572,7 @@ namespace OpenSim.Server.Handlers.Simulation
569 AgentData agent = new AgentData(); 572 AgentData agent = new AgentData();
570 try 573 try
571 { 574 {
572 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); 575 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID));
573 } 576 }
574 catch (Exception ex) 577 catch (Exception ex)
575 { 578 {
@@ -589,7 +592,7 @@ namespace OpenSim.Server.Handlers.Simulation
589 AgentPosition agent = new AgentPosition(); 592 AgentPosition agent = new AgentPosition();
590 try 593 try
591 { 594 {
592 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); 595 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID));
593 } 596 }
594 catch (Exception ex) 597 catch (Exception ex)
595 { 598 {
diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
index f0d8f69..dbb1a15 100644
--- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
@@ -93,11 +93,6 @@ namespace OpenSim.Server.Handlers.Simulation
93 DoObjectPost(request, responsedata, regionID); 93 DoObjectPost(request, responsedata, regionID);
94 return responsedata; 94 return responsedata;
95 } 95 }
96 else if (method.Equals("PUT"))
97 {
98 DoObjectPut(request, responsedata, regionID);
99 return responsedata;
100 }
101 //else if (method.Equals("DELETE")) 96 //else if (method.Equals("DELETE"))
102 //{ 97 //{
103 // DoObjectDelete(request, responsedata, agentID, action, regionHandle); 98 // DoObjectDelete(request, responsedata, agentID, action, regionHandle);
@@ -161,7 +156,7 @@ namespace OpenSim.Server.Handlers.Simulation
161 if (args.ContainsKey("extra") && args["extra"] != null) 156 if (args.ContainsKey("extra") && args["extra"] != null)
162 extraStr = args["extra"].AsString(); 157 extraStr = args["extra"].AsString();
163 158
164 IScene s = m_SimulationService.GetScene(destination.RegionHandle); 159 IScene s = m_SimulationService.GetScene(destination.RegionID);
165 ISceneObject sog = null; 160 ISceneObject sog = null;
166 try 161 try
167 { 162 {
@@ -219,48 +214,5 @@ namespace OpenSim.Server.Handlers.Simulation
219 { 214 {
220 return m_SimulationService.CreateObject(destination, newPosition, sog, false); 215 return m_SimulationService.CreateObject(destination, newPosition, sog, false);
221 } 216 }
222
223 protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID)
224 {
225 OSDMap args = Utils.GetOSDMap((string)request["body"]);
226 if (args == null)
227 {
228 responsedata["int_response_code"] = 400;
229 responsedata["str_response_string"] = "false";
230 return;
231 }
232
233 // retrieve the input arguments
234 int x = 0, y = 0;
235 UUID uuid = UUID.Zero;
236 string regionname = string.Empty;
237 if (args.ContainsKey("destination_x") && args["destination_x"] != null)
238 Int32.TryParse(args["destination_x"].AsString(), out x);
239 if (args.ContainsKey("destination_y") && args["destination_y"] != null)
240 Int32.TryParse(args["destination_y"].AsString(), out y);
241 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
242 UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
243 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
244 regionname = args["destination_name"].ToString();
245
246 GridRegion destination = new GridRegion();
247 destination.RegionID = uuid;
248 destination.RegionLocX = x;
249 destination.RegionLocY = y;
250 destination.RegionName = regionname;
251
252 UUID userID = UUID.Zero, itemID = UUID.Zero;
253 if (args.ContainsKey("userid") && args["userid"] != null)
254 userID = args["userid"].AsUUID();
255 if (args.ContainsKey("itemid") && args["itemid"] != null)
256 itemID = args["itemid"].AsUUID();
257
258 // This is the meaning of PUT object
259 bool result = m_SimulationService.CreateObject(destination, userID, itemID);
260
261 responsedata["int_response_code"] = 200;
262 responsedata["str_response_string"] = result.ToString();
263 }
264
265 } 217 }
266} 218}
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
index 3fd69ae..72551ef 100644
--- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
@@ -195,9 +195,9 @@ namespace OpenSim.Server.Handlers.UserAccounts
195 } 195 }
196 196
197 string xmlString = ServerUtils.BuildXmlResponse(result); 197 string xmlString = ServerUtils.BuildXmlResponse(result);
198
198 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); 199 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
199 UTF8Encoding encoding = new UTF8Encoding(); 200 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
200 return encoding.GetBytes(xmlString);
201 } 201 }
202 202
203 byte[] StoreAccount(Dictionary<string, object> request) 203 byte[] StoreAccount(Dictionary<string, object> request)
@@ -353,8 +353,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
353 private byte[] ResultToBytes(Dictionary<string, object> result) 353 private byte[] ResultToBytes(Dictionary<string, object> result)
354 { 354 {
355 string xmlString = ServerUtils.BuildXmlResponse(result); 355 string xmlString = ServerUtils.BuildXmlResponse(result);
356 UTF8Encoding encoding = new UTF8Encoding(); 356 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
357 return encoding.GetBytes(xmlString);
358 } 357 }
359 } 358 }
360} 359} \ No newline at end of file