From 2f398231acda79e313c2975ecdd5a6015cb71a54 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 23 Apr 2012 15:31:45 +0300 Subject: Minor improvements to logging Eliminated an extra newline in the console if the log line doesn't contain a category (example of a category: "[ASSETS]"). --- OpenSim/Server/Base/ServerUtils.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 8effdd2..0cc2a4b 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -117,7 +117,10 @@ namespace OpenSim.Server.Base catch (Exception e) { if (!(e is System.MissingMethodException)) - m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException); + { + m_log.ErrorFormat("Error loading plugin {0} from {1}. Exception: {2}", + interfaceName, dllName, e.InnerException == null ? e.Message : e.InnerException.Message); + } return null; } -- cgit v1.1 From e4e754ee93de0e0b6fde3b3ccd20085d3d4a09a1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 27 Apr 2012 09:23:56 -0700 Subject: MapImageService: added an additional security check for OSGrid and other grids like it. --- .../Server/Handlers/Map/MapAddServerConnector.cs | 48 +++++++++++++++++++--- 1 file changed, 43 insertions(+), 5 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 75dd711..c87de92 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -33,17 +33,24 @@ using System.Xml; using Nini.Config; using log4net; +using OpenMetaverse; +using OpenSim.Framework; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; + namespace OpenSim.Server.Handlers.MapImage { public class MapAddServiceConnector : ServiceConnector { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private IMapImageService m_MapService; + private IGridService m_GridService; private string m_ConfigName = "MapImageService"; public MapAddServiceConnector(IConfigSource config, IHttpServer server, string configName) : @@ -53,16 +60,26 @@ namespace OpenSim.Server.Handlers.MapImage if (serverConfig == null) throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); - string gridService = serverConfig.GetString("LocalServiceModule", + string mapService = serverConfig.GetString("LocalServiceModule", String.Empty); - if (gridService == String.Empty) + if (mapService == String.Empty) throw new Exception("No LocalServiceModule in config file"); Object[] args = new Object[] { config }; - m_MapService = ServerUtils.LoadPlugin(gridService, args); + m_MapService = ServerUtils.LoadPlugin(mapService, args); + + string gridService = serverConfig.GetString("GridService", String.Empty); + if (gridService != string.Empty) + m_GridService = ServerUtils.LoadPlugin(gridService, args); + + if (m_GridService != null) + m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is ON"); + else + m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF"); + + server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService)); - server.AddStreamHandler(new MapServerPostHandler(m_MapService)); } } @@ -70,11 +87,13 @@ namespace OpenSim.Server.Handlers.MapImage { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IMapImageService m_MapService; + private IGridService m_GridService; - public MapServerPostHandler(IMapImageService service) : + public MapServerPostHandler(IMapImageService service, IGridService grid) : base("POST", "/map") { m_MapService = service; + m_GridService = grid; } public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) @@ -105,6 +124,25 @@ namespace OpenSim.Server.Handlers.MapImage // if (request.ContainsKey("TYPE")) // type = request["TYPE"].ToString(); + if (m_GridService != null) + { + GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize); + if (r != null) + { + if (r.ExternalEndPoint.Address != httpRequest.RemoteIPEndPoint.Address) + { + m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue", httpRequest.RemoteIPEndPoint.Address); + return FailureResult("IP address of caller does not match IP address of registered region"); + } + + } + else + { + m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue", httpRequest.RemoteIPEndPoint.Address); + return FailureResult("Region not found at given coordinates"); + } + } + byte[] data = Convert.FromBase64String(request["DATA"].ToString()); string reason = string.Empty; -- cgit v1.1 From ac64fe03d8992a041933c303fa12933393cf1713 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 27 Apr 2012 09:59:46 -0700 Subject: Amend to last commit: account for the existence of proxies. --- .../Server/Handlers/Map/MapAddServerConnector.cs | 35 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index c87de92..cc7ef9d 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -78,7 +78,8 @@ namespace OpenSim.Server.Handlers.MapImage else m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF"); - server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService)); + bool proxy = serverConfig.GetBoolean("HasProxy", false); + server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy)); } } @@ -88,12 +89,14 @@ namespace OpenSim.Server.Handlers.MapImage private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IMapImageService m_MapService; private IGridService m_GridService; + bool m_Proxy; - public MapServerPostHandler(IMapImageService service, IGridService grid) : + public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy) : base("POST", "/map") { m_MapService = service; m_GridService = grid; + m_Proxy = proxy; } public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) @@ -129,7 +132,7 @@ namespace OpenSim.Server.Handlers.MapImage GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize); if (r != null) { - if (r.ExternalEndPoint.Address != httpRequest.RemoteIPEndPoint.Address) + if (r.ExternalEndPoint.Address != GetCallerIP(httpRequest)) { m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue", httpRequest.RemoteIPEndPoint.Address); return FailureResult("IP address of caller does not match IP address of registered region"); @@ -221,5 +224,31 @@ namespace OpenSim.Server.Handlers.MapImage return ms.ToArray(); } + + private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) + { + if (!m_Proxy) + return request.RemoteIPEndPoint.Address; + + // We're behind a proxy + string xff = "X-Forwarded-For"; + string xffValue = request.Headers[xff.ToLower()]; + if (xffValue == null || (xffValue != null && xffValue == string.Empty)) + xffValue = request.Headers[xff]; + + if (xffValue == null || (xffValue != null && xffValue == string.Empty)) + { + m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); + return request.RemoteIPEndPoint.Address; + } + + System.Net.IPEndPoint ep = Util.GetClientIPFromXFF(xffValue); + if (ep != null) + return ep.Address; + + // Oops + return request.RemoteIPEndPoint.Address; + } + } } -- cgit v1.1 From 292752bb78984c84b4305f32226d7f226092a08a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 27 Apr 2012 10:22:43 -0700 Subject: MapImage security issue: better error messages --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index cc7ef9d..a612114 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -132,16 +132,18 @@ namespace OpenSim.Server.Handlers.MapImage GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize); if (r != null) { - if (r.ExternalEndPoint.Address != GetCallerIP(httpRequest)) + System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); + if (r.ExternalEndPoint.Address != ipAddr) { - m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue", httpRequest.RemoteIPEndPoint.Address); + m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be trying to impersonate region in IP {1}", ipAddr, r.ExternalEndPoint.Address); return FailureResult("IP address of caller does not match IP address of registered region"); } } else { - m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue", httpRequest.RemoteIPEndPoint.Address); + m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}", + httpRequest.RemoteIPEndPoint.Address, x, y); return FailureResult("Region not found at given coordinates"); } } -- cgit v1.1 From a9dbe393194b58447f20984eff03d366c03a01e4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 27 Apr 2012 10:39:20 -0700 Subject: MapImage security issue. Compare strings instead of IPAddresses. --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index a612114..8ba188d 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -133,7 +133,7 @@ namespace OpenSim.Server.Handlers.MapImage if (r != null) { System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); - if (r.ExternalEndPoint.Address != ipAddr) + if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) { m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be trying to impersonate region in IP {1}", ipAddr, r.ExternalEndPoint.Address); return FailureResult("IP address of caller does not match IP address of registered region"); -- cgit v1.1 From 9bc94c502a8e30b0d727f15d0e4b4bb22d163d6c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 27 Apr 2012 11:05:40 -0700 Subject: MapImageService: changed the event at which the map tiles are uploaded, because they were being uploaded before the region was registered with the grid --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 8ba188d..4a61969 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -129,10 +129,10 @@ namespace OpenSim.Server.Handlers.MapImage if (m_GridService != null) { + System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize); if (r != null) { - System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) { m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be trying to impersonate region in IP {1}", ipAddr, r.ExternalEndPoint.Address); @@ -143,7 +143,7 @@ namespace OpenSim.Server.Handlers.MapImage else { m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}", - httpRequest.RemoteIPEndPoint.Address, x, y); + ipAddr, x, y); return FailureResult("Region not found at given coordinates"); } } -- cgit v1.1 From 231a3bf147315a9284140476d2b09e13c3fee1c0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 May 2012 01:45:49 +0100 Subject: Implement optional name and description on http stream handlers so that we can relate a slow request to what the handler actually does and the agent it serves, if applicable. This is most useful for capabilities where the url is not self-describing. --- OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Server') 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 http://openid.net/. #endregion HTML + public string Name { get { return "OpenId"; } } + public string Description { get { return null; } } public string ContentType { get { return m_contentType; } } public string HttpMethod { get { return m_httpMethod; } } public string Path { get { return m_path; } } -- cgit v1.1 From bf5f8b54ae24c50e7288d34525962ec174d4b473 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 May 2012 02:22:06 +0100 Subject: Remove the somewhat misleading logging of the string length of some unknown requests, as this appeared to be some kind of numbered error code. This brings these messages into line with similar messages that did not do this. --- OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs | 4 ++-- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 2 +- OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index 59420f5..ef9b96f 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs @@ -95,7 +95,8 @@ namespace OpenSim.Server.Handlers.Friends return DeleteFriendString(request); } - m_log.DebugFormat("[FRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); + + m_log.DebugFormat("[FRIENDS HANDLER]: unknown method request {0}", method); } catch (Exception e) { @@ -103,7 +104,6 @@ namespace OpenSim.Server.Handlers.Friends } return FailureResult(); - } #region Method-specific handlers diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index bebf482..91d14cb 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -116,7 +116,7 @@ namespace OpenSim.Server.Handlers.Grid return GetRegionFlags(request); } - m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); + m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method); } catch (Exception e) { diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index 8ef03e7..c2f127c 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs @@ -122,7 +122,8 @@ namespace OpenSim.Server.Handlers.Hypergrid return GrantRights(request); */ } - m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); + + m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0}", method); } catch (Exception e) { -- cgit v1.1 From e813f41478eefb50748e9bdc2b825fa8bc25c971 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 9 May 2012 20:52:54 +0100 Subject: Escape and unescape xml element names if necessary in ServerUtils.BuildXmlData() and ParseElement() If AvatarService appearance data is retrieved over the network, then ServerUtils was attempting to transfer names such as "Wearable 0:0" directly to xml element names, resulting in an exception. Space is not valid in xml element names. Neither is : in this case since the intention is not to namespace. Using names directly as keys is not a good idea. To get around this problem this patch escapes and unescapes the element names as appropriate. This has no impact on existing xml (since it had to be valid in the first place) but allows AvatarService data to be used over the network. Setting appearance (from simulator to AvatarService) did not suffer this problem since the values are passed in the query string which is already properly escaped. --- OpenSim/Server/Base/ServerUtils.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 0cc2a4b..42c82cf 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -268,7 +268,7 @@ namespace OpenSim.Server.Base continue; XmlElement elem = parent.OwnerDocument.CreateElement("", - kvp.Key, ""); + XmlConvert.EncodeLocalName(kvp.Key), ""); if (kvp.Value is Dictionary) { @@ -323,11 +323,11 @@ namespace OpenSim.Server.Base XmlNode type = part.Attributes.GetNamedItem("type"); if (type == null || type.Value != "List") { - ret[part.Name] = part.InnerText; + ret[XmlConvert.DecodeName(part.Name)] = part.InnerText; } else { - ret[part.Name] = ParseElement(part); + ret[XmlConvert.DecodeName(part.Name)] = ParseElement(part); } } -- cgit v1.1 From 38ce9d45a523db277d3eb4d3ed310b7cd9ca6b43 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 May 2012 01:00:18 +0100 Subject: Make ISimulationScene.GetScene() used the more efficient region id for lookup rather than the region handle. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 4 ++-- OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 5c9be8f..99ae7f0 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -546,7 +546,7 @@ namespace OpenSim.Server.Handlers.Simulation AgentData agent = new AgentData(); try { - agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); + agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID)); } catch (Exception ex) { @@ -566,7 +566,7 @@ namespace OpenSim.Server.Handlers.Simulation AgentPosition agent = new AgentPosition(); try { - agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); + agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID)); } catch (Exception ex) { diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs index f0d8f69..a4d03ba 100644 --- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs @@ -161,7 +161,7 @@ namespace OpenSim.Server.Handlers.Simulation if (args.ContainsKey("extra") && args["extra"] != null) extraStr = args["extra"].AsString(); - IScene s = m_SimulationService.GetScene(destination.RegionHandle); + IScene s = m_SimulationService.GetScene(destination.RegionID); ISceneObject sog = null; try { -- cgit v1.1 From 7cceab12956dcb8ebeff129375888541831f7976 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 May 2012 01:41:00 +0100 Subject: In remote QueryAccess, also receive the actual status (true|false) instead of always true no matter what the callee actually returned. This was due to two things 1) SimulationServiceConnector.QueryAccess was always looking to the outer result["success"]. But if a "_Result" map is returned (which is certainly the case right now), then the true success is _Result["success"], result["success"] is always true no matter what 2) If QueryAccess was false at the destination, then AgentHandlers.DoQueryAccess() was never putting this in the result. The default action of SerializeJsonString() is not to put false booleans in the JSON!!!, so this has to be explicitly set. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 99ae7f0..012b14e 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -144,13 +144,16 @@ namespace OpenSim.Server.Handlers.Simulation responsedata["int_response_code"] = HttpStatusCode.OK; - OSDMap resp = new OSDMap(2); + OSDMap resp = new OSDMap(3); resp["success"] = OSD.FromBoolean(result); resp["reason"] = OSD.FromString(reason); resp["version"] = OSD.FromString(version); - responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); + // We must preserve defaults here, otherwise a false "success" will not be put into the JSON map! + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + +// Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]); } protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) -- cgit v1.1 From 257b1b517dec58bf902bac63bc7ab7080286d415 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Jun 2012 02:03:50 +0100 Subject: Add main instance to internal MainServer.m_Servers list to simplify internal logic. This does require the server to be added before it is set as the main Instance --- OpenSim/Server/Base/HttpServerBase.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index d471559..7014303 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -138,6 +138,7 @@ namespace OpenSim.Server.Base m_HttpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass); } + MainServer.AddHttpServer(m_HttpServer); MainServer.Instance = m_HttpServer; // If https_listener = true, then add an ssl listener on the https_port... @@ -157,16 +158,8 @@ namespace OpenSim.Server.Base System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); Thread.CurrentThread.Abort(); } - // Add our https_server - BaseHttpServer server = null; - server = new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass); - if (server != null) - { - m_Log.InfoFormat("[SERVER]: Starting HTTPS server on port {0}", https_port); - m_Servers.Add(https_port,server); - } - else - System.Console.WriteLine(String.Format("Failed to start HTTPS server on port {0}",https_port)); + + m_Servers.Add(https_port, new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass)); } } -- cgit v1.1 From 94517c8d5c63f9e8a1ea9a83b04db956f27aa25d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Jun 2012 02:51:52 +0100 Subject: Make the "debug http" command available for robust as well as the simulator. This allows one to see incoming requests as they happen. This required making everything use the common MainServer class for registering and retrieving http servers, rather than duplicate structures. --- OpenSim/Server/Base/HttpServerBase.cs | 78 ++++++++--------------------------- OpenSim/Server/ServerMain.cs | 26 ++++++------ 2 files changed, 30 insertions(+), 74 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 7014303..7ba0ca8 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -42,42 +42,9 @@ namespace OpenSim.Server.Base { // Logger // - private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - // The http server instance - // - protected BaseHttpServer m_HttpServer = null; - protected uint m_Port = 0; - protected Dictionary m_Servers = - new Dictionary(); - protected uint m_consolePort = 0; - - public IHttpServer HttpServer - { - get { return m_HttpServer; } - } - - public uint DefaultPort - { - get { return m_Port; } - } - - public IHttpServer GetHttpServer(uint port) - { - m_Log.InfoFormat("[SERVER]: Requested port {0}", port); - if (port == m_Port) - return HttpServer; - - if (m_Servers.ContainsKey(port)) - return m_Servers[port]; - - m_Servers[port] = new BaseHttpServer(port); - - m_Log.InfoFormat("[SERVER]: Starting new HTTP server on port {0}", port); - m_Servers[port].Start(); - - return m_Servers[port]; - } + private uint m_consolePort; // Handle all the automagical stuff // @@ -94,19 +61,21 @@ namespace OpenSim.Server.Base System.Console.WriteLine("Section 'Network' not found, server can't start"); Thread.CurrentThread.Abort(); } + uint port = (uint)networkConfig.GetInt("port", 0); if (port == 0) { - Thread.CurrentThread.Abort(); } - // + bool ssl_main = networkConfig.GetBoolean("https_main",false); bool ssl_listener = networkConfig.GetBoolean("https_listener",false); m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); - m_Port = port; + + BaseHttpServer httpServer = null; + // // This is where to make the servers: // @@ -118,8 +87,7 @@ namespace OpenSim.Server.Base // if ( !ssl_main ) { - m_HttpServer = new BaseHttpServer(port); - + httpServer = new BaseHttpServer(port); } else { @@ -135,11 +103,12 @@ namespace OpenSim.Server.Base System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); Thread.CurrentThread.Abort(); } - m_HttpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass); + + httpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass); } - MainServer.AddHttpServer(m_HttpServer); - MainServer.Instance = m_HttpServer; + MainServer.AddHttpServer(httpServer); + MainServer.Instance = httpServer; // If https_listener = true, then add an ssl listener on the https_port... if ( ssl_listener == true ) { @@ -159,34 +128,23 @@ namespace OpenSim.Server.Base Thread.CurrentThread.Abort(); } - m_Servers.Add(https_port, new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass)); + MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass)); } } protected override void Initialise() { - m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", m_HttpServer.Port); - m_HttpServer.Start(); - - if (m_Servers.Count > 0) - { - foreach (BaseHttpServer s in m_Servers.Values) - { - if (!s.UseSSL) - m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", s.Port); - else - m_Log.InfoFormat("[SERVER]: Starting HTTPS server on port {0}", s.Port); + foreach (BaseHttpServer s in MainServer.Servers.Values) + s.Start(); - s.Start(); - } - } + MainServer.RegisterHttpConsoleCommands(MainConsole.Instance); if (MainConsole.Instance is RemoteConsole) { if (m_consolePort == 0) - ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer); + ((RemoteConsole)MainConsole.Instance).SetServer(MainServer.Instance); else - ((RemoteConsole)MainConsole.Instance).SetServer(GetHttpServer(m_consolePort)); + ((RemoteConsole)MainConsole.Instance).SetServer(MainServer.GetHttpServer(m_consolePort)); } } } diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 9503c4c..21fb678 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -30,6 +30,7 @@ using log4net; using System.Reflection; using System; using System.Collections.Generic; +using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Base; using OpenSim.Server.Handlers.Base; @@ -92,27 +93,24 @@ namespace OpenSim.Server if (parts.Length > 1) friendlyName = parts[1]; - IHttpServer server = m_Server.HttpServer; - if (port != 0) - server = m_Server.GetHttpServer(port); + IHttpServer server; - if (port != m_Server.DefaultPort && port != 0) - m_log.InfoFormat("[SERVER]: Loading {0} on port {1}", friendlyName, port); + if (port != 0) + server = MainServer.GetHttpServer(port); else - m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName); + server = MainServer.Instance; + + m_log.InfoFormat("[SERVER]: Loading {0} on port {1}", friendlyName, server.Port); IServiceConnector connector = null; - Object[] modargs = new Object[] { m_Server.Config, server, - configName }; - connector = ServerUtils.LoadPlugin(conn, - modargs); + Object[] modargs = new Object[] { m_Server.Config, server, configName }; + connector = ServerUtils.LoadPlugin(conn, modargs); + if (connector == null) { modargs = new Object[] { m_Server.Config, server }; - connector = - ServerUtils.LoadPlugin(conn, - modargs); + connector = ServerUtils.LoadPlugin(conn, modargs); } if (connector != null) @@ -132,4 +130,4 @@ namespace OpenSim.Server return 0; } } -} +} \ No newline at end of file -- cgit v1.1 From a4551b027bc3f9dfcf79f74210a1156abfb7bb2f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 30 Jun 2012 01:14:49 +0100 Subject: Removing unused handling of incoming create object by userID and itemID only. It appears this was never actually used since attachments were rezzed in other code. This was never available on remote simulator comms, only local. --- .../Server/Handlers/Simulation/ObjectHandlers.cs | 48 ---------------------- 1 file changed, 48 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs index a4d03ba..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 DoObjectPost(request, responsedata, regionID); return responsedata; } - else if (method.Equals("PUT")) - { - DoObjectPut(request, responsedata, regionID); - return responsedata; - } //else if (method.Equals("DELETE")) //{ // DoObjectDelete(request, responsedata, agentID, action, regionHandle); @@ -219,48 +214,5 @@ namespace OpenSim.Server.Handlers.Simulation { return m_SimulationService.CreateObject(destination, newPosition, sog, false); } - - protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID) - { - OSDMap args = Utils.GetOSDMap((string)request["body"]); - if (args == null) - { - responsedata["int_response_code"] = 400; - responsedata["str_response_string"] = "false"; - return; - } - - // retrieve the input arguments - int x = 0, y = 0; - UUID uuid = UUID.Zero; - string regionname = string.Empty; - if (args.ContainsKey("destination_x") && args["destination_x"] != null) - Int32.TryParse(args["destination_x"].AsString(), out x); - if (args.ContainsKey("destination_y") && args["destination_y"] != null) - Int32.TryParse(args["destination_y"].AsString(), out y); - if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) - UUID.TryParse(args["destination_uuid"].AsString(), out uuid); - if (args.ContainsKey("destination_name") && args["destination_name"] != null) - regionname = args["destination_name"].ToString(); - - GridRegion destination = new GridRegion(); - destination.RegionID = uuid; - destination.RegionLocX = x; - destination.RegionLocY = y; - destination.RegionName = regionname; - - UUID userID = UUID.Zero, itemID = UUID.Zero; - if (args.ContainsKey("userid") && args["userid"] != null) - userID = args["userid"].AsUUID(); - if (args.ContainsKey("itemid") && args["itemid"] != null) - itemID = args["itemid"].AsUUID(); - - // This is the meaning of PUT object - bool result = m_SimulationService.CreateObject(destination, userID, itemID); - - responsedata["int_response_code"] = 200; - responsedata["str_response_string"] = result.ToString(); - } - } } -- cgit v1.1 From 1926de5a0599051c27c065fb06da3dc536e6784a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 30 Jun 2012 01:25:27 +0100 Subject: Remove some mono compiler warnings --- OpenSim/Server/Base/HttpServerBase.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 7ba0ca8..29b1c00 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -40,9 +40,7 @@ namespace OpenSim.Server.Base { public class HttpServerBase : ServicesServerBase { - // Logger - // - private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private uint m_consolePort; -- cgit v1.1 From 916e3bf886ee622e2f18d6eb74f90fee8c630471 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 11 Jul 2012 22:54:22 +0100 Subject: Where possible, use the system Encoding.ASCII and Encoding.UTF8 rather than constructing fresh copies. The encodings are thread-safe and already used in such a manner in other places. This isn't done where Byte Order Mark output is suppressed, since Encoding.UTF8 is constructed to output the BOM. --- OpenSim/Server/Base/ServicesServerBase.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 36c48e6..b137c05 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -27,9 +27,10 @@ using System; using System.IO; -using System.Xml; -using System.Threading; using System.Reflection; +using System.Threading; +using System.Text; +using System.Xml; using OpenSim.Framework; using OpenSim.Framework.Console; using log4net; @@ -335,8 +336,7 @@ namespace OpenSim.Server.Base { string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); FileStream fs = File.Create(path); - System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); - Byte[] buf = enc.GetBytes(pidstring); + Byte[] buf = Encoding.ASCII.GetBytes(pidstring); fs.Write(buf, 0, buf.Length); fs.Close(); m_pidFile = path; -- cgit v1.1 From 884d603cac6c3fe0cdbd199e13e1514146ff82bc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Jul 2012 01:03:28 +0100 Subject: 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). --- .../AuthenticationServerPostHandler.cs | 3 +- .../Handlers/Avatar/AvatarServerPostHandler.cs | 3 +- .../Handlers/Friends/FriendsServerPostHandler.cs | 5 +-- .../Server/Handlers/Grid/GridServerPostHandler.cs | 42 ++++++++++---------- .../Handlers/GridUser/GridUserServerPostHandler.cs | 13 +++---- .../Hypergrid/HGFriendsServerPostHandler.cs | 6 +-- .../Handlers/Inventory/XInventoryInConnector.cs | 45 +++++++++++----------- .../Handlers/Presence/PresenceServerPostHandler.cs | 9 ++--- .../UserAccounts/UserAccountServerPostHandler.cs | 9 ++--- 9 files changed, 61 insertions(+), 74 deletions(-) (limited to 'OpenSim/Server') 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 private byte[] ResultToBytes(Dictionary result) { string xmlString = ServerUtils.BuildXmlResponse(result); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } } } 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 string xmlString = ServerUtils.BuildXmlResponse(result); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } return FailureResult(); diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index ef9b96f..47a8558 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs @@ -152,10 +152,9 @@ namespace OpenSim.Server.Handlers.Friends } string xmlString = ServerUtils.BuildXmlResponse(result); - //m_log.DebugFormat("[FRIENDS HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + //m_log.DebugFormat("[FRIENDS HANDLER]: resp string: {0}", xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] StoreFriend(Dictionary request) 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 } string xmlString = ServerUtils.BuildXmlResponse(result); - //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] GetRegionByUUID(Dictionary request) @@ -256,9 +255,9 @@ namespace OpenSim.Server.Handlers.Grid result["result"] = rinfo.ToKeyValuePairs(); string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] GetRegionByPosition(Dictionary request) @@ -289,9 +288,9 @@ namespace OpenSim.Server.Handlers.Grid result["result"] = rinfo.ToKeyValuePairs(); string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] GetRegionByName(Dictionary request) @@ -318,9 +317,9 @@ namespace OpenSim.Server.Handlers.Grid result["result"] = rinfo.ToKeyValuePairs(); string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] GetRegionsByName(Dictionary request) @@ -361,9 +360,9 @@ namespace OpenSim.Server.Handlers.Grid } string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] GetRegionRange(Dictionary request) @@ -410,9 +409,9 @@ namespace OpenSim.Server.Handlers.Grid } } string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] GetDefaultRegions(Dictionary request) @@ -440,9 +439,9 @@ namespace OpenSim.Server.Handlers.Grid } } string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] GetFallbackRegions(Dictionary request) @@ -481,9 +480,9 @@ namespace OpenSim.Server.Handlers.Grid } } string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] GetHyperlinks(Dictionary request) @@ -511,9 +510,9 @@ namespace OpenSim.Server.Handlers.Grid } } string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] GetRegionFlags(Dictionary request) @@ -537,12 +536,11 @@ namespace OpenSim.Server.Handlers.Grid result["result"] = flags.ToString(); string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } - #endregion #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 result["result"] = guinfo.ToKeyValuePairs(); string xmlString = ServerUtils.BuildXmlResponse(result); - //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] LoggedOut(Dictionary request) @@ -189,10 +188,9 @@ namespace OpenSim.Server.Handlers.GridUser result["result"] = guinfo.ToKeyValuePairs(); string xmlString = ServerUtils.BuildXmlResponse(result); - //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] GetGridUserInfos(Dictionary request) @@ -231,8 +229,7 @@ namespace OpenSim.Server.Handlers.GridUser } string xmlString = ServerUtils.BuildXmlResponse(result); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } private bool UnpackArgs(Dictionary 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 c2f127c..0aa2729 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs @@ -279,13 +279,11 @@ namespace OpenSim.Server.Handlers.Hypergrid } string xmlString = ServerUtils.BuildXmlResponse(result); - //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } - #endregion #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 result["RESULT"] = "False"; string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] HandleGetInventorySkeleton(Dictionary request) @@ -245,9 +245,9 @@ namespace OpenSim.Server.Handlers.Asset result["FOLDERS"] = sfolders; string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] HandleGetUserInventory(Dictionary request) @@ -284,9 +284,9 @@ namespace OpenSim.Server.Handlers.Asset } string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] HandleGetRootFolder(Dictionary request) @@ -300,9 +300,9 @@ namespace OpenSim.Server.Handlers.Asset result["folder"] = EncodeFolder(rfolder); string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] HandleGetFolderForType(Dictionary request) @@ -317,9 +317,9 @@ namespace OpenSim.Server.Handlers.Asset result["folder"] = EncodeFolder(folder); string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] HandleGetFolderContent(Dictionary request) @@ -358,9 +358,9 @@ namespace OpenSim.Server.Handlers.Asset } string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] HandleGetFolderItems(Dictionary request) @@ -386,9 +386,9 @@ namespace OpenSim.Server.Handlers.Asset result["ITEMS"] = sitems; string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] HandleAddFolder(Dictionary request) @@ -550,9 +550,9 @@ namespace OpenSim.Server.Handlers.Asset result["item"] = EncodeItem(item); string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] HandleGetFolder(Dictionary request) @@ -567,9 +567,9 @@ namespace OpenSim.Server.Handlers.Asset result["folder"] = EncodeFolder(folder); string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] HandleGetActiveGestures(Dictionary request) @@ -592,9 +592,9 @@ namespace OpenSim.Server.Handlers.Asset result["ITEMS"] = items; string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] HandleGetAssetPermissions(Dictionary request) @@ -609,12 +609,11 @@ namespace OpenSim.Server.Handlers.Asset result["RESULT"] = perms.ToString(); string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } - private Dictionary EncodeFolder(InventoryFolderBase f) { Dictionary ret = new Dictionary(); 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 result["result"] = pinfo.ToKeyValuePairs(); string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] GetAgents(Dictionary request) @@ -240,12 +240,11 @@ namespace OpenSim.Server.Handlers.Presence } string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } - private byte[] SuccessResult() { XmlDocument doc = new XmlDocument(); 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 } string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } byte[] StoreAccount(Dictionary request) @@ -353,8 +353,7 @@ namespace OpenSim.Server.Handlers.UserAccounts private byte[] ResultToBytes(Dictionary result) { string xmlString = ServerUtils.BuildXmlResponse(result); - UTF8Encoding encoding = new UTF8Encoding(); - return encoding.GetBytes(xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); } } -} +} \ No newline at end of file -- cgit v1.1