diff --git a/OpenSim/Capabilities/LLSDStreamHandler.cs b/OpenSim/Capabilities/LLSDStreamHandler.cs index f5c728ce91..5df24b2cc1 100644 --- a/OpenSim/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Capabilities/LLSDStreamHandler.cs @@ -66,9 +66,7 @@ namespace OpenSim.Framework.Capabilities TResponse response = m_method(llsdRequest); - Encoding encoding = new UTF8Encoding(false); - - return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); + return Util.UTF8NoBomEncoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); } } } diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 57fb808dc1..ffcc5840e8 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -98,6 +98,11 @@ namespace OpenSim.Framework /// public string lastname; + /// + /// Agent's full name. + /// + public string Name { get { return string.Format("{0} {1}", firstname, lastname); } } + /// /// Random Unique GUID for this session. Client gets this at login and it's /// only supposed to be disclosed over secure channels diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 4cc2e2c9c3..d5952c4b4c 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1353,7 +1353,6 @@ namespace OpenSim.Framework void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message); void SendLogoutPacket(); - EndPoint GetClientEP(); // WARNING WARNING WARNING // diff --git a/OpenSim/Framework/Serialization/TarArchiveWriter.cs b/OpenSim/Framework/Serialization/TarArchiveWriter.cs index 122fa8e39a..2a3bc4805d 100644 --- a/OpenSim/Framework/Serialization/TarArchiveWriter.cs +++ b/OpenSim/Framework/Serialization/TarArchiveWriter.cs @@ -41,8 +41,6 @@ namespace OpenSim.Framework.Serialization { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); - /// /// Binary writer for the underlying stream /// @@ -73,7 +71,7 @@ namespace OpenSim.Framework.Serialization /// public void WriteFile(string filePath, string data) { - WriteFile(filePath, m_utf8Encoding.GetBytes(data)); + WriteFile(filePath, Util.UTF8NoBomEncoding.GetBytes(data)); } /// diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index fd9586ca21..8cc29eed36 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -148,6 +148,7 @@ namespace OpenSim.Framework } public static Encoding UTF8 = Encoding.UTF8; + public static Encoding UTF8NoBomEncoding = new UTF8Encoding(false); /// /// Well known UUID for the blank texture used in the Linden SL viewer version 1.20 (and hopefully onwards) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 56ad5c9e47..230af8edbf 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -996,44 +996,11 @@ namespace OpenSim break; case "connections": - System.Text.StringBuilder connections = new System.Text.StringBuilder("Connections:\n"); - m_sceneManager.ForEachScene( - delegate(Scene scene) { - scene.ForEachClient( - delegate(IClientAPI client) { - connections.AppendFormat( - "{0}: {1} ({2}) from {3} on circuit {4}\n", - scene.RegionInfo.RegionName, - client.Name, - client.AgentId, - client.RemoteEndPoint, - client.CircuitCode - ); - } - ); - } - ); - - MainConsole.Instance.Output(connections.ToString()); + HandleShowConnections(); break; case "circuits": - System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n"); - m_sceneManager.ForEachScene( - delegate(Scene scene) { - //this.HttpServer. - acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName); - foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.GetAgentCircuits().Values) - acd.AppendFormat( - "\t{0} {1} ({2})\n", - aCircuit.firstname, - aCircuit.lastname, - (aCircuit.child ? "Child" : "Root") - ); - } - ); - - MainConsole.Instance.Output(acd.ToString()); + HandleShowCircuits(); break; case "http-handlers": @@ -1138,6 +1105,53 @@ namespace OpenSim } } + private void HandleShowCircuits() + { + ConsoleDisplayTable cdt = new ConsoleDisplayTable(); + cdt.AddColumn("Region", 20); + cdt.AddColumn("Avatar name", 24); + cdt.AddColumn("Type", 5); + cdt.AddColumn("Code", 10); + cdt.AddColumn("IP", 16); + cdt.AddColumn("Viewer Name", 24); + + m_sceneManager.ForEachScene( + s => + { + foreach (AgentCircuitData aCircuit in s.AuthenticateHandler.GetAgentCircuits().Values) + cdt.AddRow( + s.Name, + aCircuit.Name, + aCircuit.child ? "child" : "root", + aCircuit.circuitcode.ToString(), + aCircuit.IPAddress.ToString(), + aCircuit.Viewer); + }); + + MainConsole.Instance.Output(cdt.ToString()); + } + + private void HandleShowConnections() + { + ConsoleDisplayTable cdt = new ConsoleDisplayTable(); + cdt.AddColumn("Region", 20); + cdt.AddColumn("Avatar name", 24); + cdt.AddColumn("Circuit code", 12); + cdt.AddColumn("Endpoint", 23); + cdt.AddColumn("Active?", 7); + + m_sceneManager.ForEachScene( + s => s.ForEachClient( + c => cdt.AddRow( + s.Name, + c.Name, + c.RemoteEndPoint.ToString(), + c.CircuitCode.ToString(), + c.IsActive.ToString()))); + + MainConsole.Instance.Output(cdt.ToString()); + } + /// /// Use XML2 format to serialize data to a file /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8874585625..73cdec30fb 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Handles new client connections /// Constructor takes a single Packet and authenticates everything /// - public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientInventory, IClientIPEndpoint, IStatsCollector + public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientInventory, IStatsCollector { /// /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. @@ -357,7 +357,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected string m_lastName; protected Thread m_clientThread; protected Vector3 m_startpos; - protected EndPoint m_userEndPoint; protected UUID m_activeGroupID; protected string m_activeGroupName = String.Empty; protected ulong m_activeGroupPowers; @@ -442,7 +441,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// Constructor /// - public LLClientView(EndPoint remoteEP, Scene scene, LLUDPServer udpServer, LLUDPClient udpClient, AuthenticateResponse sessionInfo, + public LLClientView(Scene scene, LLUDPServer udpServer, LLUDPClient udpClient, AuthenticateResponse sessionInfo, UUID agentId, UUID sessionId, uint circuitCode) { // DebugPacketLevel = 1; @@ -450,7 +449,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP RegisterInterface(this); RegisterInterface(this); RegisterInterface(this); - RegisterInterface(this); m_scene = scene; m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); @@ -467,7 +465,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_sessionId = sessionId; m_secureSessionId = sessionInfo.LoginInfo.SecureSession; m_circuitCode = circuitCode; - m_userEndPoint = remoteEP; m_firstName = sessionInfo.LoginInfo.First; m_lastName = sessionInfo.LoginInfo.Last; m_startpos = sessionInfo.LoginInfo.StartPos; @@ -11833,7 +11830,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { ClientInfo info = m_udpClient.GetClientInfo(); - info.userEP = m_userEndPoint; info.proxyEP = null; info.agentcircuit = RequestClientInfo(); @@ -11845,11 +11841,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpClient.SetClientInfo(info); } - public EndPoint GetClientEP() - { - return m_userEndPoint; - } - #region Media Parcel Members public void SendParcelMediaCommand(uint flags, ParcelMediaCommandEnum command, float time) @@ -12119,24 +12110,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP return numPackets; } - #region IClientIPEndpoint Members - - public IPAddress EndPoint - { - get - { - if (m_userEndPoint is IPEndPoint) - { - IPEndPoint ep = (IPEndPoint)m_userEndPoint; - - return ep.Address; - } - return null; - } - } - - #endregion - public void SendRebakeAvatarTextures(UUID textureID) { RebakeAvatarTexturesPacket pack = diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 468d5246ef..097f1098eb 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1103,7 +1103,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); - client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); + client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); client.OnLogout += LogoutHandler; ((LLClientView)client).DisableFacelights = m_disableFacelights; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 540f33a9c0..3c6e38127f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -41,8 +41,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { - public class LocalGridServicesConnector : - ISharedRegionModule, IGridService + public class LocalGridServicesConnector : ISharedRegionModule, IGridService { private static readonly ILog m_log = LogManager.GetLogger( @@ -51,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid private IGridService m_GridService; private Dictionary m_LocalCache = new Dictionary(); - private bool m_Enabled = false; + private bool m_Enabled; public LocalGridServicesConnector() { @@ -59,7 +58,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public LocalGridServicesConnector(IConfigSource source) { - m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated"); + m_log.Debug("[LOCAL GRID SERVICE CONNECTOR]: LocalGridServicesConnector instantiated directly."); InitialiseService(source); } @@ -84,8 +83,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (name == Name) { InitialiseService(source); - m_Enabled = true; - m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled"); + m_log.Info("[LOCAL GRID SERVICE CONNECTOR]: Local grid connector enabled"); } } } @@ -95,7 +93,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid IConfig assetConfig = source.Configs["GridService"]; if (assetConfig == null) { - m_log.Error("[LOCAL GRID CONNECTOR]: GridService missing from OpenSim.ini"); + m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: GridService missing from OpenSim.ini"); return; } @@ -104,7 +102,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (serviceDll == String.Empty) { - m_log.Error("[LOCAL GRID CONNECTOR]: No LocalServiceModule named in section GridService"); + m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: No LocalServiceModule named in section GridService"); return; } @@ -115,16 +113,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (m_GridService == null) { - m_log.Error("[LOCAL GRID CONNECTOR]: Can't load grid service"); + m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: Can't load grid service"); return; } + + m_Enabled = true; } public void PostInitialise() { + // FIXME: We will still add this command even if we aren't enabled since RemoteGridServiceConnector + // will have instantiated us directly. MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours", "show neighbours", - "Shows the local regions' neighbours", NeighboursCommand); + "Shows the local regions' neighbours", HandleShowNeighboursCommand); } public void Close() @@ -133,17 +135,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public void AddRegion(Scene scene) { - if (m_Enabled) - scene.RegisterModuleInterface(this); + if (!m_Enabled) + return; + + scene.RegisterModuleInterface(this); if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) - m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); + m_log.ErrorFormat("[LOCAL GRID SERVICE CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); else m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); } public void RemoveRegion(Scene scene) { + if (!m_Enabled) + return; + m_LocalCache[scene.RegionInfo.RegionID].Clear(); m_LocalCache.Remove(scene.RegionInfo.RegionID); } @@ -232,7 +239,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid #endregion - public void NeighboursCommand(string module, string[] cmdparams) + public void HandleShowNeighboursCommand(string module, string[] cmdparams) { System.Text.StringBuilder caps = new System.Text.StringBuilder(); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs index 40cc536916..7a90686839 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs @@ -125,13 +125,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour uint x, y; Utils.LongToUInts(regionHandle, out x, out y); - m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from region {0} to region at {1}-{2}", - thisRegion.RegionName, x / Constants.RegionSize, y / Constants.RegionSize); - foreach (Scene s in m_Scenes) { if (s.RegionInfo.RegionHandle == regionHandle) { + m_log.DebugFormat("[LOCAL NEIGHBOUR SERVICE CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}", + thisRegion.RegionName, s.Name, x / Constants.RegionSize, y / Constants.RegionSize); + //m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); return s.IncomingHelloNeighbour(thisRegion); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 25223b95b3..3e9583cb43 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -782,19 +782,19 @@ namespace OpenSim.Region.Framework.Scenes } } - string grant = startupConfig.GetString("AllowedViewerList", String.Empty); + string grant = startupConfig.GetString("AllowedClients", String.Empty); if (grant.Length > 0) { - foreach (string viewer in grant.Split(',')) + foreach (string viewer in grant.Split('|')) { m_AllowedViewers.Add(viewer.Trim().ToLower()); } } - grant = startupConfig.GetString("BannedViewerList", String.Empty); + grant = startupConfig.GetString("BannedClients", String.Empty); if (grant.Length > 0) { - foreach (string viewer in grant.Split(',')) + foreach (string viewer in grant.Split('|')) { m_BannedViewers.Add(viewer.Trim().ToLower()); } diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index eff635b30f..661e03c9be 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -84,16 +84,23 @@ namespace OpenSim.Region.Framework.Scenes if (neighbourService != null) neighbour = neighbourService.HelloNeighbour(regionhandle, region); else - m_log.DebugFormat("[SCENE COMMUNICATION SERVICE]: No neighbour service provided for informing neigbhours of this region"); + m_log.DebugFormat( + "[SCENE COMMUNICATION SERVICE]: No neighbour service provided for region {0} to inform neigbhours of status", + m_scene.Name); if (neighbour != null) { - m_log.DebugFormat("[SCENE COMMUNICATION SERVICE]: Successfully informed neighbour {0}-{1} that I'm here", x / Constants.RegionSize, y / Constants.RegionSize); + m_log.DebugFormat( + "[SCENE COMMUNICATION SERVICE]: Region {0} successfully informed neighbour {1} at {2}-{3} that it is up", + m_scene.Name, neighbour.RegionName, x / Constants.RegionSize, y / Constants.RegionSize); + m_scene.EventManager.TriggerOnRegionUp(neighbour); } else { - m_log.InfoFormat("[SCENE COMMUNICATION SERVICE]: Failed to inform neighbour {0}-{1} that I'm here.", x / Constants.RegionSize, y / Constants.RegionSize); + m_log.WarnFormat( + "[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.", + x / Constants.RegionSize, y / Constants.RegionSize); } } @@ -101,8 +108,13 @@ namespace OpenSim.Region.Framework.Scenes { //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); - List neighbours = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID); - m_log.DebugFormat("[SCENE COMMUNICATION SERVICE]: Informing {0} neighbours that this region is up", neighbours.Count); + List neighbours + = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID); + + m_log.DebugFormat( + "[SCENE COMMUNICATION SERVICE]: Informing {0} neighbours that region {1} is up", + neighbours.Count, m_scene.Name); + foreach (GridRegion n in neighbours) { InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 3a3252853d..5043208277 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -44,7 +44,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server { public delegate void OnIRCClientReadyDelegate(IRCClientView cv); - public class IRCClientView : IClientAPI, IClientCore, IClientIPEndpoint + public class IRCClientView : IClientAPI, IClientCore { public event OnIRCClientReadyDelegate OnIRCReady; @@ -1431,11 +1431,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server Disconnect(); } - public EndPoint GetClientEP() - { - return null; - } - public ClientInfo GetClientInfo() { return new ClientInfo(); @@ -1633,15 +1628,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server #endregion - #region Implementation of IClientIPEndpoint - - public IPAddress EndPoint - { - get { return ((IPEndPoint) m_client.Client.RemoteEndPoint).Address; } - } - - #endregion - public void SendRebakeAvatarTextures(UUID textureID) { } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 9b3400da78..67989ba752 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -945,11 +945,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public EndPoint GetClientEP() - { - return null; - } - public ClientInfo GetClientInfo() { return null; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index cfa08c20e1..3654106427 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -874,13 +874,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (World.Entities.ContainsKey((UUID)agent) && World.Entities[avatarID] is ScenePresence) { ScenePresence target = (ScenePresence)World.Entities[avatarID]; - EndPoint ep = target.ControllingClient.GetClientEP(); - if (ep is IPEndPoint) - { - IPEndPoint ip = (IPEndPoint)ep; - return ip.Address.ToString(); - } + return target.ControllingClient.RemoteEndPoint.Address.ToString(); } + // fall through case, just return nothing return ""; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 1c0cac78a0..f1abd4b746 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -952,7 +952,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance try { FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")); - Byte[] buf = (new UTF8Encoding()).GetBytes(xml); + Byte[] buf = Util.UTF8NoBomEncoding.GetBytes(xml); fs.Write(buf, 0, buf.Length); fs.Close(); } diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index a19b5993bf..6b93cd9035 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 3ee405c509..393584e932 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 ef9b96fa54..47a85581af 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 91d14cbeab..ef5f33e173 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 bf212554c7..687cf8ddb1 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 c2f127c213..0aa272973f 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); - + 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 cb9b65da77..64127c20af 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,11 +609,10 @@ 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); - } + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + } private Dictionary EncodeFolder(InventoryFolderBase f) { diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 34610e2836..708971a272 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -200,9 +200,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) @@ -241,9 +241,9 @@ 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() diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index 3fd69aed50..72551ef404 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 diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 888b072013..7429293c3c 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs @@ -132,8 +132,7 @@ namespace OpenSim.Services.Connectors try { strBuffer = OSDParser.SerializeJsonString(args); - UTF8Encoding str = new UTF8Encoding(); - buffer = str.GetBytes(strBuffer); + buffer = Util.UTF8NoBomEncoding.GetBytes(strBuffer); } catch (Exception e) { diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 376465c053..89c4f110db 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -963,11 +963,6 @@ namespace OpenSim.Tests.Common.Mock { } - public EndPoint GetClientEP() - { - return null; - } - public ClientInfo GetClientInfo() { return null; diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 33eaccb8dd..9c68b6546c 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -280,18 +280,18 @@ ;; default is false ; TelehubAllowLandmark = false - ;# {AllowedViewerList} {} {Comma separated list of allowed viewers} {} - ;; Comma separated list of viewers which may gain access to the regions. - ;; One can use a Substring of the viewer name to enable only certain subversions + ;# {AllowedClients} {} {Bar (|) separated list of allowed clients} {} + ;; Bar (|) separated list of viewers which may gain access to the regions. + ;; One can use a substring of the viewer name to enable only certain versions ;; Example: Agent uses the viewer "Imprudence 1.3.2.0" ;; - "Imprudence" has access ;; - "Imprudence 1.3" has access ;; - "Imprudence 1.3.1" has no access - ;; AllowedViewerList = + ; AllowedViewerList = - ;# {BannedViewerList} {} {Comma separated list of banned viewers} {} - ;# Comma separated list of viewers which may not gain access to the regions. - ;; One can use a Substring of the viewer name to disable only certain subversions + ;# {BannedClients} {} {Bar (|) separated list of banned clients} {} + ;# Bar (|) separated list of viewers which may not gain access to the regions. + ;; One can use a Substring of the viewer name to disable only certain versions ;; Example: Agent uses the viewer "Imprudence 1.3.2.0" ;; - "Imprudence" has no access ;; - "Imprudence 1.3" has no access