From 6772c9d2b6d05c985174f514aa8df2aacd33a201 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 18 Jan 2010 17:35:49 +0000 Subject: Comment the asset deletion handler. It can be abused and is not currently needed. --- OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs index 3f33da6..f33bb90 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs @@ -63,7 +63,7 @@ namespace OpenSim.Server.Handlers.Asset if (p.Length > 0) { - result = m_AssetService.Delete(p[0]); + // result = m_AssetService.Delete(p[0]); } XmlSerializer xs = new XmlSerializer(typeof(bool)); -- cgit v1.1 From 65775b87e5000a07634240ab8ce39aaecd30d1e6 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 5 May 2010 23:06:36 +0200 Subject: Add a XMLRPC method to remotely set the login level for the LLLoginService. This requires a special XMLRPC call, which has to supply the credentials of a god user (User level >= 200). Disabled by default. Also Adds a configuration option to set the initial permitted login level. --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 37 ++++++++++++++++++++++ .../Handlers/Login/LLLoginServiceInConnector.cs | 1 + 2 files changed, 38 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index daf2704..83b3e31 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -99,6 +99,43 @@ namespace OpenSim.Server.Handlers.Login } + public XmlRpcResponse HandleXMLRPCSetLoginLevel(XmlRpcRequest request, IPEndPoint remoteClient) + { + Hashtable requestData = (Hashtable)request.Params[0]; + + if (requestData != null) + { + if (requestData.ContainsKey("first") && requestData["first"] != null && + requestData.ContainsKey("last") && requestData["last"] != null && + requestData.ContainsKey("level") && requestData["level"] != null && + requestData.ContainsKey("passwd") && requestData["passwd"] != null) + { + string first = requestData["first"].ToString(); + string last = requestData["last"].ToString(); + string passwd = requestData["passwd"].ToString(); + int level = Int32.Parse(requestData["level"].ToString()); + + m_log.InfoFormat("[LOGIN]: XMLRPC Set Level to {2} Requested by {0} {1}", first, last, level); + + Hashtable reply = m_LocalService.SetLevel(first, last, passwd, level, remoteClient); + + XmlRpcResponse response = new XmlRpcResponse(); + response.Value = reply; + + return response; + + } + } + + XmlRpcResponse failResponse = new XmlRpcResponse(); + Hashtable failHash = new Hashtable(); + failHash["success"] = "false"; + failResponse.Value = failHash; + + return failResponse; + + } + public OSD HandleLLSDLogin(OSD request, IPEndPoint remoteClient) { if (request.Type == OSDType.Map) diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs index e24055b..67e8392 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs @@ -88,6 +88,7 @@ namespace OpenSim.Server.Handlers.Login { LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService); server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); + server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); } -- cgit v1.1 From 733a07e061cdcb6095677758a264ba976bb94b93 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 6 May 2010 00:34:49 +0200 Subject: Plumb the viewer version string through into AgentCircuitData. Now all that is left os to figure out what black magic turns AgentCircuitData into AgentData and then copy that into the ScenePresence, where m_Viewer is already added with this commit and waits for the data. --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 83b3e31..c9bf996 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -86,7 +86,7 @@ namespace OpenSim.Server.Handlers.Login m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); LoginResponse reply = null; - reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, remoteClient); + reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, remoteClient); XmlRpcResponse response = new XmlRpcResponse(); response.Value = reply.ToHashtable(); @@ -157,7 +157,7 @@ namespace OpenSim.Server.Handlers.Login m_log.Info("[LOGIN]: LLSD Login Requested for: '" + map["first"].AsString() + "' '" + map["last"].AsString() + "' / " + startLocation); LoginResponse reply = null; - reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, remoteClient); + reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, String.Empty, remoteClient); return reply.ToOSDMap(); } -- cgit v1.1 From 1c040d8c1ed5ee1ba1e80aa1d248a9b06d1790a5 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Tue, 18 May 2010 03:24:43 -0700 Subject: Fix to the scenario where we send an agent to a neighbouring sim (via teleport), then tell our neighbours to close the agents.. thereby disconnecting the user. Added a new CloseChildAgent method in lieu of CloseAgent. This has been a long standing problem - with any luck this will cure it. --- .../Server/Handlers/Simulation/AgentHandlers.cs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index ab3250d..b648e12 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -108,6 +108,11 @@ namespace OpenSim.Server.Handlers.Simulation DoAgentDelete(request, responsedata, agentID, action, regionID); return responsedata; } + else if (method.Equals("DELETECHILD")) + { + DoChildAgentDelete(request, responsedata, agentID, action, regionID); + return responsedata; + } else { m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method); @@ -320,6 +325,24 @@ namespace OpenSim.Server.Handlers.Simulation } } + protected void DoChildAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) + { + m_log.Debug(" >>> DoChildAgentDelete action:" + action + "; RegionID:" + regionID); + + GridRegion destination = new GridRegion(); + destination.RegionID = regionID; + + if (action.Equals("release")) + ReleaseAgent(regionID, id); + else + m_SimulationService.CloseChildAgent(destination, id); + + responsedata["int_response_code"] = HttpStatusCode.OK; + responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); + + m_log.Debug("[AGENT HANDLER]: Child Agent Released/Deleted."); + } + protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) { m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); -- cgit v1.1 From ac5373427f99d259a55147e097a8a76050a60db6 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 27 May 2010 20:08:12 +0200 Subject: Comment noisy "CONNECTION DEBUGGING" messages, because they push more important stuff off screen too fast. Clean this time --- OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 14 +++++++------- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index 17d7850..e50481a 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -61,13 +61,13 @@ namespace OpenSim.Server.Handlers.Hypergrid public Hashtable Handler(Hashtable request) { - m_log.Debug("[CONNECTION DEBUGGING]: HomeAgentHandler Called"); - - m_log.Debug("---------------------------"); - m_log.Debug(" >> uri=" + request["uri"]); - m_log.Debug(" >> content-type=" + request["content-type"]); - m_log.Debug(" >> http-method=" + request["http-method"]); - m_log.Debug("---------------------------\n"); +// m_log.Debug("[CONNECTION DEBUGGING]: HomeAgentHandler Called"); +// +// m_log.Debug("---------------------------"); +// m_log.Debug(" >> uri=" + request["uri"]); +// m_log.Debug(" >> content-type=" + request["content-type"]); +// m_log.Debug(" >> http-method=" + request["http-method"]); +// m_log.Debug("---------------------------\n"); Hashtable responsedata = new Hashtable(); responsedata["content_type"] = "text/html"; diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index b648e12..c4117f5 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -61,13 +61,13 @@ namespace OpenSim.Server.Handlers.Simulation public Hashtable Handler(Hashtable request) { - m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); - - m_log.Debug("---------------------------"); - m_log.Debug(" >> uri=" + request["uri"]); - m_log.Debug(" >> content-type=" + request["content-type"]); - m_log.Debug(" >> http-method=" + request["http-method"]); - m_log.Debug("---------------------------\n"); +// m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); +// +// m_log.Debug("---------------------------"); +// m_log.Debug(" >> uri=" + request["uri"]); +// m_log.Debug(" >> content-type=" + request["content-type"]); +// m_log.Debug(" >> http-method=" + request["http-method"]); +// m_log.Debug("---------------------------\n"); Hashtable responsedata = new Hashtable(); responsedata["content_type"] = "text/html"; -- cgit v1.1 From 4921d5ac2dc1f439b7820a22c89fd8239ff33bbc Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 8 Jun 2010 22:03:08 +0200 Subject: Make the text mode remote console really work. It can now be used to send multi-word commands with proper quoting, handles arguments with spaces and allows interactive use, e.g. user creation. --- OpenSim/Server/Base/ServicesServerBase.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 63ba673..a5bebb8 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -236,6 +236,11 @@ namespace OpenSim.Server.Base Initialise(); } + public bool Running + { + get { return m_Running; } + } + public virtual int Run() { while (m_Running) -- cgit v1.1 From a390541e1c114db419d9a2eb1ac576a582c35e67 Mon Sep 17 00:00:00 2001 From: sacha Date: Fri, 6 Aug 2010 14:38:11 +0000 Subject: Allowing the expected purge trash folder... Please validate !!! --- OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index ac6a3ab..e3d30e5 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -408,6 +408,7 @@ namespace OpenSim.Server.Handlers.Asset byte[] HandlePurgeFolder(Dictionary request) { + Dictionary result = new Dictionary(); UUID folderID = UUID.Zero; UUID.TryParse(request["ID"].ToString(), out folderID); -- cgit v1.1 From c554de75010a442753cce29ee06d2b60d7b4701a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 7 Aug 2010 05:45:52 +0200 Subject: Correct display of landmark about info. Also correct region maturity rating in LM info. Maturity is NOT the parcel's setting, that is only for the image and text. Parcel maturity is governed by region maturity. --- OpenSim/Server/Handlers/Land/LandHandlers.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Land/LandHandlers.cs b/OpenSim/Server/Handlers/Land/LandHandlers.cs index a21f9de..561f285 100644 --- a/OpenSim/Server/Handlers/Land/LandHandlers.cs +++ b/OpenSim/Server/Handlers/Land/LandHandlers.cs @@ -66,7 +66,8 @@ namespace OpenSim.Server.Handlers.Land uint y = Convert.ToUInt32(requestData["y"]); m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle); - LandData landData = m_LocalService.GetLandData(regionHandle, x, y); + byte regionAccess; + LandData landData = m_LocalService.GetLandData(regionHandle, x, y, out regionAccess); Hashtable hash = new Hashtable(); if (landData != null) { @@ -83,6 +84,7 @@ namespace OpenSim.Server.Handlers.Land hash["SalePrice"] = landData.SalePrice.ToString(); hash["SnapshotID"] = landData.SnapshotID.ToString(); hash["UserLocation"] = landData.UserLocation.ToString(); + hash["RegionAccess"] = regionAccess.ToString(); } XmlRpcResponse response = new XmlRpcResponse(); -- cgit v1.1 From 4f15b8d4e6be1e1fe88ad32aa43595861d1005ad Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 16 Nov 2010 20:44:39 +0100 Subject: Change the way attachments are persisted. Editing a worn attachment will now save properly, as will the results of a resizer script working. Attachment positions are no longer saved on each move, but instead are saved once on logout. Attachment script states are saved as part of the attachment now when detaching. --- OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs index 33e5aa6..04ff83f 100644 --- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs @@ -162,6 +162,11 @@ namespace OpenSim.Server.Handlers.Simulation return; } + if (args.ContainsKey("modified")) + sog.HasGroupChanged = args["modified"].AsBoolean(); + else + sog.HasGroupChanged = false; + if ((args["state"] != null) && s.AllowScriptCrossings) { stateXmlStr = args["state"].AsString(); @@ -243,4 +248,4 @@ namespace OpenSim.Server.Handlers.Simulation } } -} \ No newline at end of file +} -- cgit v1.1 From 1cf8eb8a90749b215bc4e8b7beb37b927e101dce Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 21 Nov 2010 20:59:01 +0000 Subject: Start implementing Freeswitch in ROBUST --- .../Freeswitch/FreeswitchServerConnector.cs | 46 +++++++++++++- .../Freeswitch/FreeswitchServerGetHandler.cs | 72 ---------------------- 2 files changed, 45 insertions(+), 73 deletions(-) delete mode 100644 OpenSim/Server/Handlers/Freeswitch/FreeswitchServerGetHandler.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs index 07bafc8..150df45 100644 --- a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs +++ b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs @@ -26,18 +26,25 @@ */ using System; +using System.Collections; +using System.Web; +using System.Reflection; using Nini.Config; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; +using log4net; namespace OpenSim.Server.Handlers.Freeswitch { public class FreeswitchServerConnector : ServiceConnector { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private IFreeswitchService m_FreeswitchService; private string m_ConfigName = "FreeswitchService"; + protected readonly string m_freeSwitchAPIPrefix = "/fsapi"; public FreeswitchServerConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) @@ -59,7 +66,44 @@ namespace OpenSim.Server.Handlers.Freeswitch m_FreeswitchService = ServerUtils.LoadPlugin(freeswitchService, args); - server.AddStreamHandler(new FreeswitchServerGetHandler(m_FreeswitchService)); + server.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix), FreeSwitchConfigHTTPHandler); + } + + public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request) + { + Hashtable response = new Hashtable(); + response["str_response_string"] = string.Empty; + + Hashtable requestBody = ParseRequestBody((string) request["body"]); + + string section = (string) requestBody["section"]; + + if (section == "directory") + response = m_FreeswitchService.HandleDirectoryRequest(requestBody); + else if (section == "dialplan") + response = m_FreeswitchService.HandleDialplanRequest(requestBody); + else + m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section); + + return response; + } + + private Hashtable ParseRequestBody(string body) + { + Hashtable bodyParams = new Hashtable(); + // split string + string [] nvps = body.Split(new Char [] {'&'}); + + foreach (string s in nvps) + { + if (s.Trim() != "") + { + string [] nvp = s.Split(new Char [] {'='}); + bodyParams.Add(HttpUtility.UrlDecode(nvp[0]), HttpUtility.UrlDecode(nvp[1])); + } + } + + return bodyParams; } } } diff --git a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerGetHandler.cs b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerGetHandler.cs deleted file mode 100644 index 8b41742..0000000 --- a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerGetHandler.cs +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using Nini.Config; -using log4net; -using System; -using System.IO; -using System.Reflection; -using System.Net; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Serialization; -using OpenSim.Server.Base; -using OpenSim.Services.Interfaces; -using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; - -namespace OpenSim.Server.Handlers.Freeswitch -{ - public class FreeswitchServerGetHandler : BaseStreamHandler - { - // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - //private IFreeswitchService m_FreeswitchService; - - public FreeswitchServerGetHandler(IFreeswitchService service) : - base("GET", "/api") - { - //m_FreeswitchService = service; - } - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - byte[] result = new byte[0]; - - string[] p = SplitParams(path); - - if (p.Length == 0) - return result; - - // Process web request - - return result; - } - } -} -- cgit v1.1 From 4a54b3318b202d75bde2f1fcde3e80114df91d2e Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 23 Nov 2010 00:31:09 +0100 Subject: Fix more potential nullrefs --- OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 456b6fc..ce72c78 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -601,8 +601,10 @@ namespace OpenSim.Server.Handlers.Asset ret["AssetType"] = item.AssetType.ToString(); ret["BasePermissions"] = item.BasePermissions.ToString(); ret["CreationDate"] = item.CreationDate.ToString(); - ret["CreatorId"] = item.CreatorId.ToString(); - ret["CreatorData"] = item.CreatorData.ToString(); + if (item.CreatorId != null) + ret["CreatorId"] = item.CreatorId.ToString(); + else + ret["CreatorId"] = String.Empty; ret["CurrentPermissions"] = item.CurrentPermissions.ToString(); ret["Description"] = item.Description.ToString(); ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString(); -- cgit v1.1 From f28dc77ab4f0abeac942b25d3547f43184d5cf2e Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 9 Dec 2010 02:01:41 +0100 Subject: Plumb a code path for the entity transfer module to ask a destination scene whether or not an agent is allowed there as a root agent. --- .../Server/Handlers/Simulation/AgentHandlers.cs | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 26516ab..8aa410b 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -115,6 +115,11 @@ namespace OpenSim.Server.Handlers.Simulation DoChildAgentDelete(request, responsedata, agentID, action, regionID); return responsedata; } + else if (method.Equals("QUERYACCESSS")) + { + DoQueryAccess(request, responsedata, agentID, regionID); + return responsedata; + } else { m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method); @@ -305,6 +310,27 @@ namespace OpenSim.Server.Handlers.Simulation return m_SimulationService.UpdateAgent(destination, agent); } + protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) + { + if (m_SimulationService == null) + { + m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless."); + responsedata["content_type"] = "application/json"; + responsedata["int_response_code"] = HttpStatusCode.NotImplemented; + responsedata["str_response_string"] = string.Empty; + + return; + } + + GridRegion destination = new GridRegion(); + destination.RegionID = regionID; + + bool result = m_SimulationService.QueryAccess(destination, id); + + responsedata["int_response_code"] = HttpStatusCode.OK; + responsedata["str_response_string"] = result.ToString(); + } + protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) { if (m_SimulationService == null) -- cgit v1.1 From 6820deed34fa87bc9b02376b382bae902052af9f Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 31 Dec 2010 15:45:08 +0100 Subject: Implement Scope ID lookup on GetLandData. Stacked regions were not handled properly --- OpenSim/Server/Handlers/Land/LandHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Land/LandHandlers.cs b/OpenSim/Server/Handlers/Land/LandHandlers.cs index 561f285..b45289a 100644 --- a/OpenSim/Server/Handlers/Land/LandHandlers.cs +++ b/OpenSim/Server/Handlers/Land/LandHandlers.cs @@ -67,7 +67,7 @@ namespace OpenSim.Server.Handlers.Land m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle); byte regionAccess; - LandData landData = m_LocalService.GetLandData(regionHandle, x, y, out regionAccess); + LandData landData = m_LocalService.GetLandData(UUID.Zero, regionHandle, x, y, out regionAccess); Hashtable hash = new Hashtable(); if (landData != null) { -- cgit v1.1 From 11c742a5a8b1edd97923cc445aa43e0ba92f1bce Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 27 Jan 2011 02:16:41 +0100 Subject: Make bans work for teleport. Now teleport will complete block if the user is not allowed on the estate. If the user is allowed on no parcel, the teleport will also be blocked. If the user is allowed on a parcel, but not the desired one, the user will be shifted to the closest allowed location. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 6d01f80..89832f4 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -115,7 +115,7 @@ namespace OpenSim.Server.Handlers.Simulation DoChildAgentDelete(request, responsedata, agentID, action, regionID); return responsedata; } - else if (method.Equals("QUERYACCESSS")) + else if (method.Equals("QUERYACCESS")) { DoQueryAccess(request, responsedata, agentID, regionID); return responsedata; -- cgit v1.1 From 657c14c5db8b0c882484926ba76aa64ec757ee07 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 28 Jan 2011 03:07:25 +0100 Subject: Fix up QueryAccess to also check parcels --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 89832f4..b33b0d5 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -331,10 +331,17 @@ namespace OpenSim.Server.Handlers.Simulation return; } + // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); + OSDMap args = Utils.GetOSDMap((string)request["body"]); + + Vector3 position = Vector3.Zero; + if (args.ContainsKey("position")) + position = Vector3.Parse(args["position"].AsString()); + GridRegion destination = new GridRegion(); destination.RegionID = regionID; - bool result = m_SimulationService.QueryAccess(destination, id); + bool result = m_SimulationService.QueryAccess(destination, id, position); responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["str_response_string"] = result.ToString(); -- cgit v1.1 From cfce0aa4482c50e3046ae44fe76d71fb70c82201 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 16 Feb 2011 05:22:05 +0100 Subject: Change the QUERYACCESS method to eliminate spurious access denied messages --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 448e321..616aef3 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -346,10 +346,17 @@ namespace OpenSim.Server.Handlers.Simulation GridRegion destination = new GridRegion(); destination.RegionID = regionID; - bool result = m_SimulationService.QueryAccess(destination, id, position); + string reason; + bool result = m_SimulationService.QueryAccess(destination, id, position, out reason); responsedata["int_response_code"] = HttpStatusCode.OK; - responsedata["str_response_string"] = result.ToString(); + + OSDMap resp = new OSDMap(2); + + resp["success"] = OSD.FromBoolean(result); + resp["reason"] = OSD.FromString(reason); + + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); } protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) -- cgit v1.1 From 763666e2d6e82dac4ae1514df8dcbe376c6f4cac Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 May 2011 19:50:35 +0200 Subject: Enable compressed (gzip) fatpack transfers. --- OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | 6 +- .../Hypergrid/GatekeeperServerConnector.cs | 2 +- .../Server/Handlers/Simulation/AgentHandlers.cs | 299 +++++++++++++-------- .../Simulation/SimulationServiceInConnector.cs | 23 +- 4 files changed, 194 insertions(+), 136 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs index f3f81b0..cf1af15 100644 --- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs @@ -49,13 +49,13 @@ using log4net; namespace OpenSim.Server.Handlers.Hypergrid { - public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentHandler + public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentPostHandler { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IGatekeeperService m_GatekeeperService; - public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy) + public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy) : base("/foreignagent") { m_GatekeeperService = gatekeeper; m_Proxy = proxy; @@ -65,7 +65,5 @@ namespace OpenSim.Server.Handlers.Hypergrid { return m_GatekeeperService.LoginAgent(aCircuit, destination, out reason); } - } - } diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs index 3d0967f..0d4990a 100644 --- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs @@ -73,7 +73,7 @@ namespace OpenSim.Server.Handlers.Hypergrid server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); - server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy).Handler); + server.AddStreamHandler(new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy)); } public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index b51290d..55f011a 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -28,6 +28,7 @@ using System; using System.Collections; using System.IO; +using System.IO.Compression; using System.Reflection; using System.Net; using System.Text; @@ -53,8 +54,6 @@ namespace OpenSim.Server.Handlers.Simulation private ISimulationService m_SimulationService; - protected bool m_Proxy = false; - public AgentHandler() { } public AgentHandler(ISimulationService sim) @@ -91,16 +90,12 @@ namespace OpenSim.Server.Handlers.Simulation // Next, let's parse the verb string method = (string)request["http-method"]; + m_log.DebugFormat("[SIMULATION]: Got verb {0} in HTTP handler", method); if (method.Equals("PUT")) { DoAgentPut(request, responsedata); return responsedata; } - else if (method.Equals("POST")) - { - DoAgentPost(request, responsedata, agentID); - return responsedata; - } else if (method.Equals("GET")) { DoAgentGet(request, responsedata, agentID, regionID); @@ -132,111 +127,6 @@ namespace OpenSim.Server.Handlers.Simulation } - protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) - { - OSDMap args = Utils.GetOSDMap((string)request["body"]); - if (args == null) - { - responsedata["int_response_code"] = HttpStatusCode.BadRequest; - responsedata["str_response_string"] = "Bad request"; - return; - } - - // retrieve the input arguments - int x = 0, y = 0; - UUID uuid = UUID.Zero; - string regionname = string.Empty; - uint teleportFlags = 0; - if (args.ContainsKey("destination_x") && args["destination_x"] != null) - Int32.TryParse(args["destination_x"].AsString(), out x); - else - m_log.WarnFormat(" -- request didn't have destination_x"); - if (args.ContainsKey("destination_y") && args["destination_y"] != null) - Int32.TryParse(args["destination_y"].AsString(), out y); - else - m_log.WarnFormat(" -- request didn't have destination_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(); - if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) - teleportFlags = args["teleport_flags"].AsUInteger(); - - GridRegion destination = new GridRegion(); - destination.RegionID = uuid; - destination.RegionLocX = x; - destination.RegionLocY = y; - destination.RegionName = regionname; - - AgentCircuitData aCircuit = new AgentCircuitData(); - try - { - aCircuit.UnpackAgentCircuitData(args); - } - catch (Exception ex) - { - m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message); - responsedata["int_response_code"] = HttpStatusCode.BadRequest; - responsedata["str_response_string"] = "Bad request"; - return; - } - - OSDMap resp = new OSDMap(2); - string reason = String.Empty; - - // This is the meaning of POST agent - //m_regionClient.AdjustUserInformation(aCircuit); - //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); - bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason); - - resp["reason"] = OSD.FromString(reason); - resp["success"] = OSD.FromBoolean(result); - // Let's also send out the IP address of the caller back to the caller (HG 1.5) - resp["your_ip"] = OSD.FromString(GetCallerIP(request)); - - // TODO: add reason if not String.Empty? - responsedata["int_response_code"] = HttpStatusCode.OK; - responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); - } - - private string GetCallerIP(Hashtable request) - { - if (!m_Proxy) - return Util.GetCallerIP(request); - - // We're behind a proxy - Hashtable headers = (Hashtable)request["headers"]; - - //// DEBUG - //foreach (object o in headers.Keys) - // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString())); - - string xff = "X-Forwarded-For"; - if (headers.ContainsKey(xff.ToLower())) - xff = xff.ToLower(); - - if (!headers.ContainsKey(xff) || headers[xff] == null) - { - m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); - return Util.GetCallerIP(request); - } - - m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); - - IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); - if (ep != null) - return ep.Address.ToString(); - - // Oops - return Util.GetCallerIP(request); - } - - // subclasses can override this - protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) - { - return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); - } - protected void DoAgentPut(Hashtable request, Hashtable responsedata) { OSDMap args = Utils.GetOSDMap((string)request["body"]); @@ -457,4 +347,189 @@ namespace OpenSim.Server.Handlers.Simulation } + public class AgentPostHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private ISimulationService m_SimulationService; + protected bool m_Proxy = false; + + public AgentPostHandler(ISimulationService service) : + base("POST", "/agent") + { + m_SimulationService = service; + } + + public AgentPostHandler(string path) : + base("POST", path) + { + m_SimulationService = null; + } + + public override byte[] Handle(string path, Stream request, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + m_log.DebugFormat("[SIMULATION]: Stream handler called"); + + Hashtable keysvals = new Hashtable(); + Hashtable headervals = new Hashtable(); + + string[] querystringkeys = httpRequest.QueryString.AllKeys; + string[] rHeaders = httpRequest.Headers.AllKeys; + + keysvals.Add("uri", httpRequest.RawUrl); + keysvals.Add("content-type", httpRequest.ContentType); + keysvals.Add("http-method", httpRequest.HttpMethod); + + foreach (string queryname in querystringkeys) + keysvals.Add(queryname, httpRequest.QueryString[queryname]); + + foreach (string headername in rHeaders) + headervals[headername] = httpRequest.Headers[headername]; + + keysvals.Add("headers", headervals); + keysvals.Add("querystringkeys", querystringkeys); + + Stream inputStream; + if (httpRequest.ContentType == "application/x-gzip") + inputStream = new GZipStream(request, CompressionMode.Decompress); + else + inputStream = request; + + Encoding encoding = Encoding.UTF8; + StreamReader reader = new StreamReader(inputStream, encoding); + + string requestBody = reader.ReadToEnd(); + keysvals.Add("body", requestBody); + + httpResponse.StatusCode = 200; + httpResponse.ContentType = "text/html"; + httpResponse.KeepAlive = false; + + Hashtable responsedata = new Hashtable(); + + UUID agentID; + UUID regionID; + string action; + + if (!Utils.GetParams((string)keysvals["uri"], out agentID, out regionID, out action)) + { + m_log.InfoFormat("[AGENT HANDLER]: Invalid parameters for agent message {0}", keysvals["uri"]); + + httpResponse.StatusCode = 404; + + return encoding.GetBytes("false"); + } + + DoAgentPost(keysvals, responsedata, agentID); + + httpResponse.StatusCode = (int)responsedata["int_response_code"]; + return encoding.GetBytes((string)responsedata["str_response_string"]); + } + + protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) + { + OSDMap args = Utils.GetOSDMap((string)request["body"]); + if (args == null) + { + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + // retrieve the input arguments + int x = 0, y = 0; + UUID uuid = UUID.Zero; + string regionname = string.Empty; + uint teleportFlags = 0; + if (args.ContainsKey("destination_x") && args["destination_x"] != null) + Int32.TryParse(args["destination_x"].AsString(), out x); + else + m_log.WarnFormat(" -- request didn't have destination_x"); + if (args.ContainsKey("destination_y") && args["destination_y"] != null) + Int32.TryParse(args["destination_y"].AsString(), out y); + else + m_log.WarnFormat(" -- request didn't have destination_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(); + if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) + teleportFlags = args["teleport_flags"].AsUInteger(); + + GridRegion destination = new GridRegion(); + destination.RegionID = uuid; + destination.RegionLocX = x; + destination.RegionLocY = y; + destination.RegionName = regionname; + + AgentCircuitData aCircuit = new AgentCircuitData(); + try + { + aCircuit.UnpackAgentCircuitData(args); + } + catch (Exception ex) + { + m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message); + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + OSDMap resp = new OSDMap(2); + string reason = String.Empty; + + // This is the meaning of POST agent + //m_regionClient.AdjustUserInformation(aCircuit); + //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason); + + resp["reason"] = OSD.FromString(reason); + resp["success"] = OSD.FromBoolean(result); + // Let's also send out the IP address of the caller back to the caller (HG 1.5) + resp["your_ip"] = OSD.FromString(GetCallerIP(request)); + + // TODO: add reason if not String.Empty? + responsedata["int_response_code"] = HttpStatusCode.OK; + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); + } + + private string GetCallerIP(Hashtable request) + { + if (!m_Proxy) + return Util.GetCallerIP(request); + + // We're behind a proxy + Hashtable headers = (Hashtable)request["headers"]; + + //// DEBUG + //foreach (object o in headers.Keys) + // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString())); + + string xff = "X-Forwarded-For"; + if (headers.ContainsKey(xff.ToLower())) + xff = xff.ToLower(); + + if (!headers.ContainsKey(xff) || headers[xff] == null) + { + m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); + return Util.GetCallerIP(request); + } + + m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); + + IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); + if (ep != null) + return ep.Address.ToString(); + + // Oops + return Util.GetCallerIP(request); + } + + // subclasses can override this + protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) + { + return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + } + } } diff --git a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs index f33eda7..42d8eca 100644 --- a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs @@ -43,30 +43,15 @@ namespace OpenSim.Server.Handlers.Simulation public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : base(config, server, String.Empty) { - //IConfig serverConfig = config.Configs["SimulationService"]; - //if (serverConfig == null) - // throw new Exception("No section 'SimulationService' in config file"); - - //string simService = serverConfig.GetString("LocalServiceModule", - // String.Empty); - - //if (simService == String.Empty) - // throw new Exception("No SimulationService in config file"); - - //Object[] args = new Object[] { config }; m_LocalSimulationService = scene.RequestModuleInterface(); m_LocalSimulationService = m_LocalSimulationService.GetInnerService(); - //ServerUtils.LoadPlugin(simService, args); - //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no")); - //server.AddStreamHandler(new AgentGetHandler(m_SimulationService, m_AuthenticationService)); - //server.AddStreamHandler(new AgentPostHandler(m_SimulationService, m_AuthenticationService)); - //server.AddStreamHandler(new AgentPutHandler(m_SimulationService, m_AuthenticationService)); - //server.AddStreamHandler(new AgentDeleteHandler(m_SimulationService, m_AuthenticationService)); + // This one MUST be a stream handler because compressed fatpacks + // are pure binary and shoehorning that into a string with UTF-8 + // encoding breaks it + server.AddStreamHandler(new AgentPostHandler(m_LocalSimulationService)); server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler); server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler); - - //server.AddStreamHandler(new ObjectPostHandler(m_SimulationService, authentication)); } } } -- cgit v1.1 From 1fbf4c83004345891f7e09834a2fc35c33387ed9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 May 2011 21:36:51 +0200 Subject: Remove a spammy debug I left in. Disable TP cancel button at the point of no return. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 55f011a..6d06cb8 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -90,7 +90,6 @@ namespace OpenSim.Server.Handlers.Simulation // Next, let's parse the verb string method = (string)request["http-method"]; - m_log.DebugFormat("[SIMULATION]: Got verb {0} in HTTP handler", method); if (method.Equals("PUT")) { DoAgentPut(request, responsedata); -- cgit v1.1 From ade09d0fa1e4c1331bedcf2a5f99402436d8f187 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 May 2011 23:23:33 +0200 Subject: Also compress the actual fatpacks --- .../Server/Handlers/Simulation/AgentHandlers.cs | 264 +++++++++++++-------- .../Simulation/SimulationServiceInConnector.cs | 1 + 2 files changed, 171 insertions(+), 94 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 6d06cb8..9f581ca 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -90,12 +90,7 @@ namespace OpenSim.Server.Handlers.Simulation // Next, let's parse the verb string method = (string)request["http-method"]; - if (method.Equals("PUT")) - { - DoAgentPut(request, responsedata); - return responsedata; - } - else if (method.Equals("GET")) + if (method.Equals("GET")) { DoAgentGet(request, responsedata, agentID, regionID); return responsedata; @@ -126,94 +121,6 @@ namespace OpenSim.Server.Handlers.Simulation } - protected void DoAgentPut(Hashtable request, Hashtable responsedata) - { - OSDMap args = Utils.GetOSDMap((string)request["body"]); - if (args == null) - { - responsedata["int_response_code"] = HttpStatusCode.BadRequest; - responsedata["str_response_string"] = "Bad request"; - 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; - - string messageType; - if (args["message_type"] != null) - messageType = args["message_type"].AsString(); - else - { - m_log.Warn("[AGENT HANDLER]: Agent Put Message Type not found. "); - messageType = "AgentData"; - } - - bool result = true; - if ("AgentData".Equals(messageType)) - { - AgentData agent = new AgentData(); - try - { - agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); - } - catch (Exception ex) - { - m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); - responsedata["int_response_code"] = HttpStatusCode.BadRequest; - responsedata["str_response_string"] = "Bad request"; - return; - } - - //agent.Dump(); - // This is one of the meanings of PUT agent - result = UpdateAgent(destination, agent); - - } - else if ("AgentPosition".Equals(messageType)) - { - AgentPosition agent = new AgentPosition(); - try - { - agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); - } - catch (Exception ex) - { - m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); - return; - } - //agent.Dump(); - // This is one of the meanings of PUT agent - result = m_SimulationService.UpdateAgent(destination, agent); - - } - - responsedata["int_response_code"] = HttpStatusCode.OK; - responsedata["str_response_string"] = result.ToString(); - //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead - } - - // subclasses can override this - protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) - { - return m_SimulationService.UpdateAgent(destination, agent); - } - protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) { if (m_SimulationService == null) @@ -531,4 +438,173 @@ namespace OpenSim.Server.Handlers.Simulation return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); } } + + public class AgentPutHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private ISimulationService m_SimulationService; + protected bool m_Proxy = false; + + public AgentPutHandler(ISimulationService service) : + base("PUT", "/agent") + { + m_SimulationService = service; + } + + public AgentPutHandler(string path) : + base("PUT", path) + { + m_SimulationService = null; + } + + public override byte[] Handle(string path, Stream request, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + m_log.DebugFormat("[SIMULATION]: Stream handler called"); + + Hashtable keysvals = new Hashtable(); + Hashtable headervals = new Hashtable(); + + string[] querystringkeys = httpRequest.QueryString.AllKeys; + string[] rHeaders = httpRequest.Headers.AllKeys; + + keysvals.Add("uri", httpRequest.RawUrl); + keysvals.Add("content-type", httpRequest.ContentType); + keysvals.Add("http-method", httpRequest.HttpMethod); + + foreach (string queryname in querystringkeys) + keysvals.Add(queryname, httpRequest.QueryString[queryname]); + + foreach (string headername in rHeaders) + headervals[headername] = httpRequest.Headers[headername]; + + keysvals.Add("headers", headervals); + keysvals.Add("querystringkeys", querystringkeys); + + Stream inputStream; + if (httpRequest.ContentType == "application/x-gzip") + inputStream = new GZipStream(request, CompressionMode.Decompress); + else + inputStream = request; + + Encoding encoding = Encoding.UTF8; + StreamReader reader = new StreamReader(inputStream, encoding); + + string requestBody = reader.ReadToEnd(); + keysvals.Add("body", requestBody); + + httpResponse.StatusCode = 200; + httpResponse.ContentType = "text/html"; + httpResponse.KeepAlive = false; + + Hashtable responsedata = new Hashtable(); + + UUID agentID; + UUID regionID; + string action; + + if (!Utils.GetParams((string)keysvals["uri"], out agentID, out regionID, out action)) + { + m_log.InfoFormat("[AGENT HANDLER]: Invalid parameters for agent message {0}", keysvals["uri"]); + + httpResponse.StatusCode = 404; + + return encoding.GetBytes("false"); + } + + DoAgentPut(keysvals, responsedata); + + httpResponse.StatusCode = (int)responsedata["int_response_code"]; + return encoding.GetBytes((string)responsedata["str_response_string"]); + } + + protected void DoAgentPut(Hashtable request, Hashtable responsedata) + { + OSDMap args = Utils.GetOSDMap((string)request["body"]); + if (args == null) + { + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + 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; + + string messageType; + if (args["message_type"] != null) + messageType = args["message_type"].AsString(); + else + { + m_log.Warn("[AGENT HANDLER]: Agent Put Message Type not found. "); + messageType = "AgentData"; + } + + bool result = true; + if ("AgentData".Equals(messageType)) + { + AgentData agent = new AgentData(); + try + { + agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); + } + catch (Exception ex) + { + m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + //agent.Dump(); + // This is one of the meanings of PUT agent + result = UpdateAgent(destination, agent); + + } + else if ("AgentPosition".Equals(messageType)) + { + AgentPosition agent = new AgentPosition(); + try + { + agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); + } + catch (Exception ex) + { + m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); + return; + } + //agent.Dump(); + // This is one of the meanings of PUT agent + result = m_SimulationService.UpdateAgent(destination, agent); + + } + + responsedata["int_response_code"] = HttpStatusCode.OK; + responsedata["str_response_string"] = result.ToString(); + //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead + } + + // subclasses can override this + protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) + { + return m_SimulationService.UpdateAgent(destination, agent); + } + } } diff --git a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs index 42d8eca..0da08f8 100644 --- a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs @@ -50,6 +50,7 @@ namespace OpenSim.Server.Handlers.Simulation // are pure binary and shoehorning that into a string with UTF-8 // encoding breaks it server.AddStreamHandler(new AgentPostHandler(m_LocalSimulationService)); + server.AddStreamHandler(new AgentPutHandler(m_LocalSimulationService)); server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler); server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler); } -- cgit v1.1 From d6b9504c84f620f0205f2f1fcf024fda7e68ea5c Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 16 Jan 2012 02:19:19 +0100 Subject: Add methods to allow the groups modules to query online status and last login --- .../Handlers/GridUser/GridUserServerPostHandler.cs | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 4c0d52e..bf21255 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs @@ -88,6 +88,8 @@ namespace OpenSim.Server.Handlers.GridUser return SetPosition(request); case "getgriduserinfo": return GetGridUserInfo(request); + case "getgriduserinfos": + return GetGridUserInfos(request); } m_log.DebugFormat("[GRID USER HANDLER]: unknown method request: {0}", method); } @@ -193,6 +195,46 @@ namespace OpenSim.Server.Handlers.GridUser } + byte[] GetGridUserInfos(Dictionary request) + { + + string[] userIDs; + + if (!request.ContainsKey("AgentIDs")) + { + m_log.DebugFormat("[GRID USER HANDLER]: GetGridUserInfos called without required uuids argument"); + return FailureResult(); + } + + if (!(request["AgentIDs"] is List)) + { + m_log.DebugFormat("[GRID USER HANDLER]: GetGridUserInfos input argument was of unexpected type {0}", request["uuids"].GetType().ToString()); + return FailureResult(); + } + + userIDs = ((List)request["AgentIDs"]).ToArray(); + + GridUserInfo[] pinfos = m_GridUserService.GetGridUserInfo(userIDs); + + Dictionary result = new Dictionary(); + if ((pinfos == null) || ((pinfos != null) && (pinfos.Length == 0))) + result["result"] = "null"; + else + { + int i = 0; + foreach (GridUserInfo pinfo in pinfos) + { + Dictionary rinfoDict = pinfo.ToKeyValuePairs(); + result["griduser" + i] = rinfoDict; + i++; + } + } + + string xmlString = ServerUtils.BuildXmlResponse(result); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + private bool UnpackArgs(Dictionary request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt) { user = string.Empty; -- cgit v1.1 From d3b778ebbe617a37a32c866101c75284dad8f15a Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 Jul 2012 06:06:33 +0200 Subject: Address map lag issue seen with non-avination viewers --- OpenSim/Server/Handlers/Map/MapGetServerConnector.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs index fb85d1c..4502b7d 100644 --- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs @@ -29,6 +29,7 @@ using System; using System.IO; using System.Net; using System.Reflection; +using System.Threading; using Nini.Config; using log4net; @@ -70,6 +71,8 @@ namespace OpenSim.Server.Handlers.MapImage class MapServerGetHandler : BaseStreamHandler { + public static ManualResetEvent ev = new ManualResetEvent(true); + // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IMapImageService m_MapService; @@ -82,8 +85,13 @@ namespace OpenSim.Server.Handlers.MapImage public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - byte[] result = new byte[0]; + ev.WaitOne(); + lock (ev) + { + ev.Reset(); + } + byte[] result = new byte[0]; string format = string.Empty; result = m_MapService.GetMapTile(path.Trim('/'), out format); if (result.Length > 0) @@ -100,6 +108,11 @@ namespace OpenSim.Server.Handlers.MapImage httpResponse.ContentType = "text/plain"; } + lock (ev) + { + ev.Set(); + } + return result; } -- cgit v1.1 From 8dae7928d39399c2ac3d6a0dbd9a1362b2e0f68d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 16 Sep 2012 23:41:34 +0200 Subject: Make agent creation at destination asynchronous. Failures here are pretty much guaranteed to be fatal and the few times this would dosconnect an agent are more than made up for by the increased throughput of replying and closing the connection vs. keeping it open during the heavy work. Also causes better feedback to the viewer as the time is now split between Requesting Teleport and Connectiong to Destination. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index d772c39..0bd8269 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -443,7 +443,15 @@ namespace OpenSim.Server.Handlers.Simulation // subclasses can override this protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) { - return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + reason = String.Empty; + + Util.FireAndForget(x => + { + string r; + m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r); + }); + + return true; } } -- cgit v1.1 From 1c240cd55574fe76af25b3824ab7f74b76c25a26 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 15 Jan 2013 01:07:20 +0000 Subject: Print full stacktrace from plugin loading failure to help determine what went wrong, rather than a possibly unhelpful simple exception message. --- OpenSim/Server/Base/ServerUtils.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 3f208bf..2e6d279 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -280,8 +280,11 @@ namespace OpenSim.Server.Base { if (!(e is System.MissingMethodException)) { - m_log.ErrorFormat("Error loading plugin {0} from {1}. Exception: {2}", - interfaceName, dllName, e.InnerException == null ? e.Message : e.InnerException.Message); + m_log.ErrorFormat("Error loading plugin {0} from {1}. Exception: {2}, {3}", + interfaceName, + dllName, + e.InnerException == null ? e.Message : e.InnerException.Message, + e.StackTrace); } return null; } -- cgit v1.1 From 1f1da230976451d30d920c237d53c699ba96b9d9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Feb 2013 00:23:17 +0000 Subject: Bump version and assembly version numbers from 0.7.5 to 0.7.6 This is mostly Bluewall's work but I am also bumping the general version number OpenSimulator 0.7.5 remains in the release candidate stage. I'm doing this because master is significantly adding things that will not be in 0.7.5 This update should not cause issues with existing external binary DLLs because our DLLs do not have strong names and so the exact version match requirement is not in force. --- OpenSim/Server/Base/Properties/AssemblyInfo.cs | 2 +- OpenSim/Server/Handlers/Properties/AssemblyInfo.cs | 2 +- OpenSim/Server/Properties/AssemblyInfo.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs index 4bbe358..8b45564 100644 --- a/OpenSim/Server/Base/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs index 53e9737..d72d36a 100644 --- a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Server/Properties/AssemblyInfo.cs b/OpenSim/Server/Properties/AssemblyInfo.cs index ebc10fb..ee45e10 100644 --- a/OpenSim/Server/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] -- cgit v1.1 From 4779f7d7d5ce0e284d9ed15104389f8479b11545 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 19 Feb 2013 17:14:55 -0800 Subject: Deleted all AssemblyFileVersion directives --- OpenSim/Server/Base/Properties/AssemblyInfo.cs | 2 +- OpenSim/Server/Handlers/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs index 8b45564..b4732b8 100644 --- a/OpenSim/Server/Base/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs @@ -30,4 +30,4 @@ using System.Runtime.InteropServices; // Revision // [assembly: AssemblyVersion("0.7.6.*")] -[assembly: AssemblyFileVersion("1.0.0.0")] + diff --git a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs index d72d36a..3295ffd 100644 --- a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs @@ -30,4 +30,4 @@ using System.Runtime.InteropServices; // Revision // [assembly: AssemblyVersion("0.7.6.*")] -[assembly: AssemblyFileVersion("1.0.0.0")] + -- cgit v1.1 From e515cdddec435e97e9ed4722de08ee410e94a7e6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 21 Feb 2013 17:26:19 -0800 Subject: Simplification of HG configs: HomeURI and GatekeeperURI now are defined as default under [Startup]. They can then be overwritten in the other sections (but probably shouldn't). I kept the existing code for backwards compatibility, so this should not cause any breaks from people's current configurations. But people should move to have these 2 vars under [Startup] -- see OpenSim.ini.example and Robust.HG.ini.example. And yes, both names now end with "URI" for consistency. --- OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index 965a54e..35f86c5 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs @@ -170,14 +170,6 @@ namespace OpenSim.Server.Handlers.Grid public string JsonGetGridInfoMethod(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - string HomeURI = String.Empty; - IConfig cfg = m_Config.Configs["LoginService"]; - - if (null != cfg) - { - HomeURI = cfg.GetString("SRV_HomeURI", HomeURI); - } - OSDMap map = new OSDMap(); foreach (string k in _info.Keys) @@ -185,9 +177,19 @@ namespace OpenSim.Server.Handlers.Grid map[k] = OSD.FromString(_info[k].ToString()); } + string HomeURI = Util.GetConfigVarWithDefaultSection(m_Config, "HomeURI", string.Empty); + if (!String.IsNullOrEmpty(HomeURI)) + map["home"] = OSD.FromString(HomeURI); + else // Legacy. Remove soon! { - map["home"] = OSD.FromString(HomeURI); + IConfig cfg = m_Config.Configs["LoginService"]; + + if (null != cfg) + HomeURI = cfg.GetString("SRV_HomeURI", HomeURI); + + if (!String.IsNullOrEmpty(HomeURI)) + map["home"] = OSD.FromString(HomeURI); } return OSDParser.SerializeJsonString(map).ToString(); -- cgit v1.1 From 0e8289cd002b1947e172d1bfc77fdd0b16d92ffb Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 22 Feb 2013 15:57:33 -0800 Subject: Added new Util function for reading config vars that's more generic than the one I added yesterday -- this is for helping move config vars out of [Startup] --- OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index 35f86c5..d85aab0 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs @@ -177,7 +177,7 @@ namespace OpenSim.Server.Handlers.Grid map[k] = OSD.FromString(_info[k].ToString()); } - string HomeURI = Util.GetConfigVarWithDefaultSection(m_Config, "HomeURI", string.Empty); + string HomeURI = Util.GetConfigVarFromSections(m_Config, "HomeURI", new string[] {"Startup"}); if (!String.IsNullOrEmpty(HomeURI)) map["home"] = OSD.FromString(HomeURI); -- cgit v1.1 From f1010d7b152b68e2961b40482006221e28e976af Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 27 Feb 2013 20:49:41 -0800 Subject: Moved the HG default variables out of [Startup] and into their own section [Hypergrid] in *Common.ini.example. Backwards compatible for now. --- OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index d85aab0..bfcdc4b 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs @@ -177,7 +177,7 @@ namespace OpenSim.Server.Handlers.Grid map[k] = OSD.FromString(_info[k].ToString()); } - string HomeURI = Util.GetConfigVarFromSections(m_Config, "HomeURI", new string[] {"Startup"}); + string HomeURI = Util.GetConfigVarFromSections(m_Config, "HomeURI", new string[] { "Startup", "Hypergrid" }); if (!String.IsNullOrEmpty(HomeURI)) map["home"] = OSD.FromString(HomeURI); -- cgit v1.1 From bb447581795cb622e88a071d3050370c64ace946 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 27 Feb 2013 20:59:16 -0800 Subject: Switched to using the other Util function with a default value. --- OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index bfcdc4b..346af32 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs @@ -177,7 +177,8 @@ namespace OpenSim.Server.Handlers.Grid map[k] = OSD.FromString(_info[k].ToString()); } - string HomeURI = Util.GetConfigVarFromSections(m_Config, "HomeURI", new string[] { "Startup", "Hypergrid" }); + string HomeURI = Util.GetConfigVarFromSections(m_Config, "HomeURI", + new string[] { "Startup", "Hypergrid" }, String.Empty); if (!String.IsNullOrEmpty(HomeURI)) map["home"] = OSD.FromString(HomeURI); -- cgit v1.1 From faf96f5c854a9f928797f170b07c32236a7559e3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 28 Feb 2013 23:59:26 +0000 Subject: minor: Log location in which simulator/robust was started. Useful information for system debugging, especially if logging and ini files locations have been changed from defaults. --- OpenSim/Server/Base/ServicesServerBase.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index ecd69b0..5aff72a 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -186,6 +186,10 @@ namespace OpenSim.Server.Base XmlConfigurator.Configure(); } + // FIXME: This should be done down in ServerBase but we need to sort out and refactor the log4net + // XmlConfigurator calls first accross servers. + m_log.InfoFormat("[SERVER BASE]: Starting in {0}", m_startupDirectory); + RegisterCommonAppenders(startupConfig); if (startupConfig.GetString("PIDFile", String.Empty) != String.Empty) -- cgit v1.1 From 12900ea84e699f84943009f2d3218fcf5013c6f9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 14 Mar 2013 23:39:15 +0000 Subject: Log same environment information to Robust log as is already done for simulator logs, for debug purposes --- OpenSim/Server/Base/ServicesServerBase.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 5aff72a..7c8e6b7 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -186,10 +186,7 @@ namespace OpenSim.Server.Base XmlConfigurator.Configure(); } - // FIXME: This should be done down in ServerBase but we need to sort out and refactor the log4net - // XmlConfigurator calls first accross servers. - m_log.InfoFormat("[SERVER BASE]: Starting in {0}", m_startupDirectory); - + LogEnvironmentInformation(); RegisterCommonAppenders(startupConfig); if (startupConfig.GetString("PIDFile", String.Empty) != String.Empty) -- cgit v1.1 From 3a7d9f740e3574bb3091d40fa35c7abf642c1f3c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Mar 2013 22:05:18 +0000 Subject: minor: Make logged message in ServerUtils more consistent. --- OpenSim/Server/Base/ServerUtils.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 2e6d279..210a314 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -138,17 +138,17 @@ namespace OpenSim.Server.Base case ExtensionChange.Add: if (a.AddinFile.Contains(Registry.DefaultAddinsFolder)) { - m_log.InfoFormat("[SERVER]: Adding {0} from registry", a.Name); + m_log.InfoFormat("[SERVER UTILS]: Adding {0} from registry", a.Name); connector.PluginPath = System.IO.Path.Combine(Registry.DefaultAddinsFolder,a.Name.Replace(',', '.')); } else { - m_log.InfoFormat("[SERVER]: Adding {0} from ./bin", a.Name); + m_log.InfoFormat("[SERVER UTILS]: Adding {0} from ./bin", a.Name); connector.PluginPath = a.AddinFile; } LoadPlugin(connector); break; case ExtensionChange.Remove: - m_log.InfoFormat("[SERVER]: Removing {0}", a.Name); + m_log.InfoFormat("[SERVER UTILS]: Removing {0}", a.Name); UnloadPlugin(connector); break; } @@ -166,13 +166,13 @@ namespace OpenSim.Server.Base } else { - m_log.InfoFormat("[SERVER]: {0} Disabled.", connector.ConfigName); + m_log.InfoFormat("[SERVER UTILS]: {0} Disabled.", connector.ConfigName); } } private void UnloadPlugin(IRobustConnector connector) { - m_log.InfoFormat("[Server]: Unloading {0}", connector.ConfigName); + m_log.InfoFormat("[SERVER UTILS]: Unloading {0}", connector.ConfigName); connector.Unload(); } @@ -280,7 +280,7 @@ namespace OpenSim.Server.Base { if (!(e is System.MissingMethodException)) { - m_log.ErrorFormat("Error loading plugin {0} from {1}. Exception: {2}, {3}", + m_log.ErrorFormat("[SERVER UTILS]: Error loading plugin {0} from {1}. Exception: {2}, {3}", interfaceName, dllName, e.InnerException == null ? e.Message : e.InnerException.Message, @@ -298,14 +298,14 @@ namespace OpenSim.Server.Base } catch (ReflectionTypeLoadException rtle) { - m_log.Error(string.Format("Error loading plugin from {0}:\n{1}", dllName, + m_log.Error(string.Format("[SERVER UTILS]: Error loading plugin from {0}:\n{1}", dllName, String.Join("\n", Array.ConvertAll(rtle.LoaderExceptions, e => e.ToString()))), rtle); return null; } catch (Exception e) { - m_log.Error(string.Format("Error loading plugin from {0}", dllName), e); + m_log.Error(string.Format("[SERVER UTILS]: Error loading plugin from {0}", dllName), e); return null; } } @@ -517,7 +517,7 @@ namespace OpenSim.Server.Base public static IConfigSource LoadInitialConfig(string url) { IConfigSource source = new XmlConfigSource(); - m_log.InfoFormat("[CONFIG]: {0} is a http:// URI, fetching ...", url); + m_log.InfoFormat("[SERVER UTILS]: {0} is a http:// URI, fetching ...", url); // The ini file path is a http URI // Try to read it @@ -529,7 +529,7 @@ namespace OpenSim.Server.Base } catch (Exception e) { - m_log.FatalFormat("[CONFIG]: Exception reading config from URI {0}\n" + e.ToString(), url); + m_log.FatalFormat("[SERVER UTILS]: Exception reading config from URI {0}\n" + e.ToString(), url); Environment.Exit(1); } -- cgit v1.1 From 7fb458b05517089ae3d072cde167258aa6a129ff Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Mar 2013 22:08:11 +0000 Subject: minor: log an error rather than info if a connector fails to load. --- OpenSim/Server/ServerMain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 8be69a9..65e9287 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -145,7 +145,7 @@ namespace OpenSim.Server } else { - m_log.InfoFormat("[SERVER]: Failed to load {0}", conn); + m_log.ErrorFormat("[SERVER]: Failed to load {0}", conn); } } -- cgit v1.1 From 90a6891a7d5af39013efc49f12dc69a8d7b240de Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 27 Apr 2013 10:34:23 -0700 Subject: Better error reporting --- OpenSim/Server/Base/ServerUtils.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 210a314..25957d3 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -286,6 +286,7 @@ namespace OpenSim.Server.Base e.InnerException == null ? e.Message : e.InnerException.Message, e.StackTrace); } + m_log.ErrorFormat("[SERVER UTILS]: Error loading plugin {0}: {1}", dllName, e.Message); return null; } -- cgit v1.1 From 3ce198165c3533d416148a9f4ffa056bf22c602d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 29 Apr 2013 22:21:57 +0100 Subject: minor: remove some mono compiler warnings in ServicesServerBase --- OpenSim/Server/Base/ServicesServerBase.cs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 7c8e6b7..b13c87d 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -171,11 +171,6 @@ namespace OpenSim.Server.Base m_console = MainConsole.Instance; - // Configure the appenders for log4net - // - OpenSimAppender consoleAppender = null; - FileAppender fileAppender = null; - if (logConfig != null) { FileInfo cfg = new FileInfo(logConfig); -- cgit v1.1 From 4194d935ecd21a922859a640cb28acec7e5bae45 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 13 May 2013 13:07:39 -0700 Subject: Fixed mantis #6609 -- LoadPlugin error messages on Robust. --- OpenSim/Server/Base/ServerUtils.cs | 2 +- OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | 8 ++++++-- .../Server/Handlers/Hypergrid/InstantMessageServerConnector.cs | 7 ++++++- OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs | 7 ++++++- OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs | 9 +++++++-- 5 files changed, 26 insertions(+), 7 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 25957d3..08ba50d 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -286,7 +286,7 @@ namespace OpenSim.Server.Base e.InnerException == null ? e.Message : e.InnerException.Message, e.StackTrace); } - m_log.ErrorFormat("[SERVER UTILS]: Error loading plugin {0}: {1}", dllName, e.Message); + m_log.ErrorFormat("[SERVER UTILS]: Error loading plugin {0}: {1} args.Length {2}", dllName, e.Message, args.Length); return null; } diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs index 0d4990a..ffe2f36 100644 --- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs @@ -76,10 +76,14 @@ namespace OpenSim.Server.Handlers.Hypergrid server.AddStreamHandler(new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy)); } - public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) - : this(config, server, null) + public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, string configName) + : this(config, server, (ISimulationService)null) { } + public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) + : this(config, server, String.Empty) + { + } } } diff --git a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs index 80eb5d2..8145a21 100644 --- a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs @@ -54,10 +54,15 @@ namespace OpenSim.Server.Handlers.Hypergrid private IInstantMessage m_IMService; public InstantMessageServerConnector(IConfigSource config, IHttpServer server) : - this(config, server, null) + this(config, server, (IInstantMessageSimConnector)null) { } + public InstantMessageServerConnector(IConfigSource config, IHttpServer server, string configName) : + this(config, server) + { + } + public InstantMessageServerConnector(IConfigSource config, IHttpServer server, IInstantMessageSimConnector simConnector) : base(config, server, String.Empty) { diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index db62aaa..b20f467 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -62,10 +62,15 @@ namespace OpenSim.Server.Handlers.Hypergrid private bool m_VerifyCallers = false; public UserAgentServerConnector(IConfigSource config, IHttpServer server) : - this(config, server, null) + this(config, server, (IFriendsSimConnector)null) { } + public UserAgentServerConnector(IConfigSource config, IHttpServer server, string configName) : + this(config, server) + { + } + public UserAgentServerConnector(IConfigSource config, IHttpServer server, IFriendsSimConnector friendsConnector) : base(config, server, String.Empty) { diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs index 9a7ad34..1fb0dbc 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs @@ -60,8 +60,8 @@ namespace OpenSim.Server.Handlers.Login InitializeHandlers(server); } - public LLLoginServiceInConnector(IConfigSource config, IHttpServer server) : - base(config, server, String.Empty) + public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { string loginService = ReadLocalServiceFromConfig(config); @@ -72,6 +72,11 @@ namespace OpenSim.Server.Handlers.Login InitializeHandlers(server); } + public LLLoginServiceInConnector(IConfigSource config, IHttpServer server) : + this(config, server, String.Empty) + { + } + private string ReadLocalServiceFromConfig(IConfigSource config) { IConfig serverConfig = config.Configs["LoginService"]; -- cgit v1.1 From 3bc8cf65a4e933cfdd0597affc1685c74fb29dba Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 16 May 2013 17:30:30 +0100 Subject: Where this is not already happening, trigger asychoronous calls to CloseChildAgent() above the LocalSimulationConnector level. This is so that other callers (such as SceneCommunicationService.SendCloseChildAgentConnections() can perform all closes asynchronously without pointlessly firing another thread for local closes). No functional change apart from elimination of unnecessary chaining of new threads. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 012b14e..ae37ca7 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -218,7 +218,7 @@ namespace OpenSim.Server.Handlers.Simulation if (action.Equals("release")) ReleaseAgent(regionID, id); else - m_SimulationService.CloseAgent(destination, id); + Util.FireAndForget(delegate { m_SimulationService.CloseAgent(destination, id); }); responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); -- cgit v1.1 From 328883700a15e4216bf7b251ac099d38f413375e Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 13 May 2013 22:11:28 -0400 Subject: UserProfiles UserProfiles for Robust and Standalone. Includes service and connectors for Robust and standalone opensim plus matching region module. --- .../Handlers/Profiles/UserProfilesConnector.cs | 92 +++++ .../Handlers/Profiles/UserProfilesHandlers.cs | 434 +++++++++++++++++++++ 2 files changed, 526 insertions(+) create mode 100644 OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs create mode 100644 OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs new file mode 100644 index 0000000..4ad7297 --- /dev/null +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs @@ -0,0 +1,92 @@ +using System; +using System.Reflection; +using Nini.Config; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Framework; +using OpenSim.Server.Handlers.Base; +using log4net; + +namespace OpenSim.Server.Handlers.Profiles +{ + public class UserProfilesConnector: ServiceConnector + { + static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + + // Our Local Module + public IUserProfilesService ServiceModule + { + get; private set; + } + + // The HTTP server. + public IHttpServer Server + { + get; private set; + } + + public string ConfigName + { + get; private set; + } + + public bool Enabled + { + get; private set; + } + + public UserProfilesConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) + { + ConfigName = "UserProfilesService"; + if(!string.IsNullOrEmpty(configName)) + ConfigName = configName; + + IConfig serverConfig = config.Configs[ConfigName]; + if (serverConfig == null) + throw new Exception(String.Format("No section {0} in config file", ConfigName)); + + if(!serverConfig.GetBoolean("Enabled",false)) + { + Enabled = false; + return; + } + + Enabled = true; + + Server = server; + + string service = serverConfig.GetString("LocalServiceModule", String.Empty); + + Object[] args = new Object[] { config, ConfigName }; + ServiceModule = ServerUtils.LoadPlugin(service, args); + + JsonRpcProfileHandlers handler = new JsonRpcProfileHandlers(ServiceModule); + + Server.AddJsonRPCHandler("avatarclassifiedsrequest", handler.AvatarClassifiedsRequest); + Server.AddJsonRPCHandler("classified_update", handler.ClassifiedUpdate); + Server.AddJsonRPCHandler("classifieds_info_query", handler.ClassifiedInfoRequest); + Server.AddJsonRPCHandler("classified_delete", handler.ClassifiedDelete); + Server.AddJsonRPCHandler("avatarpicksrequest", handler.AvatarPicksRequest); + Server.AddJsonRPCHandler("pickinforequest", handler.PickInfoRequest); + Server.AddJsonRPCHandler("picks_update", handler.PicksUpdate); + Server.AddJsonRPCHandler("picks_delete", handler.PicksDelete); + Server.AddJsonRPCHandler("avatarnotesrequest", handler.AvatarNotesRequest); + Server.AddJsonRPCHandler("avatar_notes_update", handler.NotesUpdate); + Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); + Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); + Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); + Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); +// Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest); +// Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferencesUpdate); +// Server.AddJsonRPCHandler("user_account_create", handler.UserAccountCreate); +// Server.AddJsonRPCHandler("user_account_auth", handler.UserAccountAuth); +// Server.AddJsonRPCHandler("user_account_test", handler.UserAccountTest); + Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); + Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); + } + } +} + diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs new file mode 100644 index 0000000..93da102 --- /dev/null +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -0,0 +1,434 @@ +using System; +using System.Reflection; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using log4net; +using OpenSim.Services.Interfaces; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Framework; + +namespace OpenSim.Server.Handlers +{ + public class UserProfilesHandlers + { + public UserProfilesHandlers () + { + } + } + + public class JsonRpcProfileHandlers + { + static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + public IUserProfilesService Service + { + get; private set; + } + + public JsonRpcProfileHandlers(IUserProfilesService service) + { + Service = service; + } + + #region Classifieds + /// + /// Request avatar's classified ads. + /// + /// + /// An array containing all the calassified uuid and it's name created by the creator id + /// + /// + /// Our parameters are in the OSDMap json["params"] + /// + /// + /// If set to true response. + /// + public bool AvatarClassifiedsRequest(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + m_log.DebugFormat ("Classified Request"); + return false; + } + + OSDMap request = (OSDMap)json["params"]; + UUID creatorId = new UUID(request["creatorId"].AsString()); + + + OSDArray data = (OSDArray) Service.AvatarClassifiedsRequest(creatorId); + response.Result = data; + + return true; + } + + public bool ClassifiedUpdate(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + response.Error.Message = "Error parsing classified update request"; + m_log.DebugFormat ("Classified Update Request"); + return false; + } + + string result = string.Empty; + UserClassifiedAdd ad = new UserClassifiedAdd(); + object Ad = (object)ad; + OSD.DeserializeMembers(ref Ad, (OSDMap)json["params"]); + if(Service.ClassifiedUpdate(ad, ref result)) + { + response.Result = OSD.SerializeMembers(ad); + return true; + } + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = string.Format("{0}", result); + return false; + } + + public bool ClassifiedDelete(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + m_log.DebugFormat ("Classified Delete Request"); + return false; + } + + OSDMap request = (OSDMap)json["params"]; + UUID classifiedId = new UUID(request["classifiedID"].AsString()); + + OSDMap res = new OSDMap(); + res["result"] = OSD.FromString("success"); + response.Result = res; + + return true; + + } + + public bool ClassifiedInfoRequest(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + response.Error.Message = "no parameters supplied"; + m_log.DebugFormat ("Classified Info Request"); + return false; + } + + string result = string.Empty; + UserClassifiedAdd ad = new UserClassifiedAdd(); + object Ad = (object)ad; + OSD.DeserializeMembers(ref Ad, (OSDMap)json["params"]); + if(Service.ClassifiedInfoRequest(ref ad, ref result)) + { + response.Result = OSD.SerializeMembers(ad); + return true; + } + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = string.Format("{0}", result); + return false; + } + #endregion Classifieds + + #region Picks + public bool AvatarPicksRequest(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + m_log.DebugFormat ("Avatar Picks Request"); + return false; + } + + OSDMap request = (OSDMap)json["params"]; + UUID creatorId = new UUID(request["creatorId"].AsString()); + + + OSDArray data = (OSDArray) Service.AvatarPicksRequest(creatorId); + response.Result = data; + + return true; + } + + public bool PickInfoRequest(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + response.Error.Message = "no parameters supplied"; + m_log.DebugFormat ("Avatar Picks Info Request"); + return false; + } + + string result = string.Empty; + UserProfilePick pick = new UserProfilePick(); + object Pick = (object)pick; + OSD.DeserializeMembers(ref Pick, (OSDMap)json["params"]); + if(Service.PickInfoRequest(ref pick, ref result)) + { + response.Result = OSD.SerializeMembers(pick); + return true; + } + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = string.Format("{0}", result); + return false; + } + + public bool PicksUpdate(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + response.Error.Message = "no parameters supplied"; + m_log.DebugFormat ("Avatar Picks Update Request"); + return false; + } + + string result = string.Empty; + UserProfilePick pick = new UserProfilePick(); + object Pick = (object)pick; + OSD.DeserializeMembers(ref Pick, (OSDMap)json["params"]); + if(Service.PicksUpdate(ref pick, ref result)) + { + response.Result = OSD.SerializeMembers(pick); + return true; + } + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = "unable to update pick"; + + return false; + } + + public bool PicksDelete(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + m_log.DebugFormat ("Avatar Picks Delete Request"); + return false; + } + + OSDMap request = (OSDMap)json["params"]; + UUID pickId = new UUID(request["pickId"].AsString()); + if(Service.PicksDelete(pickId)) + return true; + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = "data error removing record"; + return false; + } + #endregion Picks + + #region Notes + public bool AvatarNotesRequest(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + response.Error.Message = "Params missing"; + m_log.DebugFormat ("Avatar Notes Request"); + return false; + } + + string result = string.Empty; + UserProfileNotes note = new UserProfileNotes(); + object Note = (object)note; + OSD.DeserializeMembers(ref Note, (OSDMap)json["params"]); + if(Service.AvatarNotesRequest(ref note)) + { + response.Result = OSD.SerializeMembers(note); + return true; + } + + object Notes = (object) note; + OSD.DeserializeMembers(ref Notes, (OSDMap)json["params"]); + return true; + } + + public bool NotesUpdate(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + response.Error.Message = "No parameters"; + m_log.DebugFormat ("Avatar Notes Update Request"); + return false; + } + + string result = string.Empty; + UserProfileNotes note = new UserProfileNotes(); + object Notes = (object) note; + OSD.DeserializeMembers(ref Notes, (OSDMap)json["params"]); + if(Service.NotesUpdate(ref note, ref result)) + { + response.Result = OSD.SerializeMembers(note); + return true; + } + return true; + } + #endregion Notes + + #region Profile Properties + public bool AvatarPropertiesRequest(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + response.Error.Message = "no parameters supplied"; + m_log.DebugFormat ("Avatar Properties Request"); + return false; + } + + string result = string.Empty; + UserProfileProperties props = new UserProfileProperties(); + object Props = (object)props; + OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]); + if(Service.AvatarPropertiesRequest(ref props, ref result)) + { + response.Result = OSD.SerializeMembers(props); + return true; + } + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = string.Format("{0}", result); + return false; + } + + public bool AvatarPropertiesUpdate(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + response.Error.Message = "no parameters supplied"; + m_log.DebugFormat ("Avatar Properties Update Request"); + return false; + } + + string result = string.Empty; + UserProfileProperties props = new UserProfileProperties(); + object Props = (object)props; + OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]); + if(Service.AvatarPropertiesUpdate(ref props, ref result)) + { + response.Result = OSD.SerializeMembers(props); + return true; + } + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = string.Format("{0}", result); + return false; + } + #endregion Profile Properties + + #region Interests + public bool AvatarInterestsUpdate(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + response.Error.Message = "no parameters supplied"; + m_log.DebugFormat ("Avatar Interests Update Request"); + return false; + } + + string result = string.Empty; + UserProfileProperties props = new UserProfileProperties(); + object Props = (object)props; + OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]); + if(Service.AvatarInterestsUpdate(props, ref result)) + { + response.Result = OSD.SerializeMembers(props); + return true; + } + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = string.Format("{0}", result); + return false; + } + #endregion Interests + + #region Utility + public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + m_log.DebugFormat ("Avatar Image Assets Request"); + return false; + } + + OSDMap request = (OSDMap)json["params"]; + UUID avatarId = new UUID(request["avatarId"].AsString()); + + OSDArray data = (OSDArray) Service.AvatarImageAssetsRequest(avatarId); + response.Result = data; + + return true; + } + #endregion Utiltiy + + #region UserData + public bool RequestUserAppData(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + response.Error.Message = "no parameters supplied"; + m_log.DebugFormat ("User Application Service URL Request: No Parameters!"); + return false; + } + + string result = string.Empty; + UserAppData props = new UserAppData(); + object Props = (object)props; + OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]); + if(Service.RequestUserAppData(ref props, ref result)) + { + OSDMap res = new OSDMap(); + res["result"] = OSD.FromString("success"); + res["token"] = OSD.FromString (result); + response.Result = res; + + return true; + } + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = string.Format("{0}", result); + return false; + } + + public bool UpdateUserAppData(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + response.Error.Message = "no parameters supplied"; + m_log.DebugFormat ("User App Data Update Request"); + return false; + } + + string result = string.Empty; + UserAppData props = new UserAppData(); + object Props = (object)props; + OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]); + if(Service.SetUserAppData(props, ref result)) + { + response.Result = OSD.SerializeMembers(props); + return true; + } + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = string.Format("{0}", result); + return false; + } + #endregion UserData + } +} + -- cgit v1.1 From d7fa9f671eefebd49c0e8f56e56088b0c0b3d93c Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 31 May 2013 22:03:27 -0400 Subject: Adding standard OpenSim header to source files --- .../Handlers/Profiles/UserProfilesConnector.cs | 27 ++++++++++++++++++++++ .../Handlers/Profiles/UserProfilesHandlers.cs | 27 ++++++++++++++++++++++ 2 files changed, 54 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs index 4ad7297..5a24ee3 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs @@ -1,3 +1,30 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + using System; using System.Reflection; using Nini.Config; diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index 93da102..f5f0794 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -1,3 +1,30 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + using System; using System.Reflection; using OpenMetaverse; -- cgit v1.1 From cd64da87461937b2a46ff6f5e8250ee9a8d15889 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 5 Jun 2013 18:41:55 -0400 Subject: Cleanup --- OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs index 5a24ee3..f9a520a 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs @@ -106,11 +106,6 @@ namespace OpenSim.Server.Handlers.Profiles Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); -// Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest); -// Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferencesUpdate); -// Server.AddJsonRPCHandler("user_account_create", handler.UserAccountCreate); -// Server.AddJsonRPCHandler("user_account_auth", handler.UserAccountAuth); -// Server.AddJsonRPCHandler("user_account_test", handler.UserAccountTest); Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); } -- cgit v1.1 From 824a4b480873721a4a10598299b185b602e1931d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 12 Jun 2013 23:47:47 +0100 Subject: After calls to GetSuitcaseXFolder() in HGSuitcaseInventoryService, consistently check for null return and log warning rather than throw exception. This was being done already in some places. If an exception is thrown it is now an error rather than debug --- OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 64127c2..9d28dc3 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -155,7 +155,7 @@ namespace OpenSim.Server.Handlers.Asset } catch (Exception e) { - m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace); + m_log.ErrorFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace); } return FailureResult(); -- cgit v1.1 From 0d2fd0d914581f755661455b8db2b9e399154632 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 17 Jun 2013 22:39:00 +0100 Subject: Make general server stats available on the robust console as well as the simulator console This means the "show stats" command is now active on the robust console. --- OpenSim/Server/Base/ServicesServerBase.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index b13c87d..8243900 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -190,16 +190,7 @@ namespace OpenSim.Server.Base } RegisterCommonCommands(); - - // Register the quit command - // - MainConsole.Instance.Commands.AddCommand("General", false, "quit", - "quit", - "Quit the application", HandleQuit); - - MainConsole.Instance.Commands.AddCommand("General", false, "shutdown", - "shutdown", - "Quit the application", HandleQuit); + RegisterCommonComponents(Config); // Allow derived classes to perform initialization that // needs to be done after the console has opened @@ -231,11 +222,12 @@ namespace OpenSim.Server.Base return 0; } - protected virtual void HandleQuit(string module, string[] args) + protected override void ShutdownSpecific() { m_Running = false; m_log.Info("[CONSOLE] Quitting"); + base.ShutdownSpecific(); } protected virtual void ReadConfig() @@ -246,4 +238,4 @@ namespace OpenSim.Server.Base { } } -} +} \ No newline at end of file -- cgit v1.1 From 9501a583cbc8fd819d2b13db4f9ad76958520ce7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 18 Jun 2013 23:07:18 +0100 Subject: Make number of inbound http requests handled available as a httpserver..IncomingHTTPRequestsProcessed stat --- OpenSim/Server/Base/ServicesServerBase.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 8243900..667cef8 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -34,6 +34,7 @@ using System.Text; using System.Xml; using OpenSim.Framework; using OpenSim.Framework.Console; +using OpenSim.Framework.Monitoring; using OpenSim.Framework.Servers; using log4net; using log4net.Config; @@ -205,6 +206,9 @@ namespace OpenSim.Server.Base public virtual int Run() { + Watchdog.Enabled = true; + MemoryWatchdog.Enabled = true; + while (m_Running) { try -- cgit v1.1 From 4778d67005c3364ee3f75bdd6640f03ff945d885 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 21 Jun 2013 20:52:46 -0700 Subject: Finally moved HG agent transfers to use agent fatpacks. --- OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | 2 +- .../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 200 +++++---------------- .../Handlers/Hypergrid/UserAgentServerConnector.cs | 2 +- .../Server/Handlers/Simulation/AgentHandlers.cs | 76 +++++--- 4 files changed, 100 insertions(+), 180 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs index cf1af15..adc2fbc 100644 --- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs @@ -61,7 +61,7 @@ namespace OpenSim.Server.Handlers.Hypergrid m_Proxy = proxy; } - protected override bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) + protected override bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { return m_GatekeeperService.LoginAgent(aCircuit, destination, out reason); } diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index 968c1e6..df875af 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -49,191 +49,87 @@ using log4net; namespace OpenSim.Server.Handlers.Hypergrid { - public class HomeAgentHandler + public class HomeAgentHandler : AgentPostHandler { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IUserAgentService m_UserAgentService; private string m_LoginServerIP; - private bool m_Proxy = false; - public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP, bool proxy) + public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP, bool proxy) : + base("/homeagent") { m_UserAgentService = userAgentService; m_LoginServerIP = loginServerIP; m_Proxy = proxy; } - public Hashtable Handler(Hashtable request) + protected override AgentDestinationData CreateAgentDestinationData() { -// m_log.Debug("[CONNECTION DEBUGGING]: HomeAgentHandler Called"); -// -// m_log.Debug("---------------------------"); -// m_log.Debug(" >> uri=" + request["uri"]); -// m_log.Debug(" >> content-type=" + request["content-type"]); -// m_log.Debug(" >> http-method=" + request["http-method"]); -// m_log.Debug("---------------------------\n"); - - Hashtable responsedata = new Hashtable(); - responsedata["content_type"] = "text/html"; - responsedata["keepalive"] = false; - - - UUID agentID; - UUID regionID; - string action; - if (!Utils.GetParams((string)request["uri"], out agentID, out regionID, out action)) + return new ExtendedAgentDestinationData(); + } + protected override void UnpackData(OSDMap args, AgentDestinationData d, Hashtable request) + { + base.UnpackData(args, d, request); + ExtendedAgentDestinationData data = (ExtendedAgentDestinationData)d; + try { - m_log.InfoFormat("[HOME AGENT HANDLER]: Invalid parameters for agent message {0}", request["uri"]); - responsedata["int_response_code"] = 404; - responsedata["str_response_string"] = "false"; + if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null) + data.host = args["gatekeeper_host"].AsString(); + if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null) + Int32.TryParse(args["gatekeeper_port"].AsString(), out data.port); + if (args.ContainsKey("gatekeeper_serveruri") && args["gatekeeper_serveruri"] != null) + data.gatekeeperServerURI = args["gatekeeper_serveruri"]; + if (args.ContainsKey("destination_serveruri") && args["destination_serveruri"] != null) + data.destinationServerURI = args["destination_serveruri"]; - return responsedata; } - - // Next, let's parse the verb - string method = (string)request["http-method"]; - if (method.Equals("POST")) + catch (InvalidCastException e) { - DoAgentPost(request, responsedata, agentID); - return responsedata; + m_log.ErrorFormat("[HOME AGENT HANDLER]: Bad cast in UnpackData"); } - else - { - m_log.InfoFormat("[HOME AGENT HANDLER]: method {0} not supported in agent message", method); - responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed; - responsedata["str_response_string"] = "Method not allowed"; - return responsedata; - } + string callerIP = GetCallerIP(request); + // Verify if this call came from the login server + if (callerIP == m_LoginServerIP) + data.fromLogin = true; } - protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) + protected override GridRegion ExtractGatekeeper(AgentDestinationData d) { - OSDMap args = Utils.GetOSDMap((string)request["body"]); - if (args == null) + if (d is ExtendedAgentDestinationData) { - responsedata["int_response_code"] = HttpStatusCode.BadRequest; - responsedata["str_response_string"] = "Bad request"; - return; + ExtendedAgentDestinationData data = (ExtendedAgentDestinationData)d; + GridRegion gatekeeper = new GridRegion(); + gatekeeper.ServerURI = data.gatekeeperServerURI; + gatekeeper.ExternalHostName = data.host; + gatekeeper.HttpPort = (uint)data.port; + gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); + + return gatekeeper; } - - // retrieve the input arguments - int x = 0, y = 0; - UUID uuid = UUID.Zero; - string regionname = string.Empty; - string gatekeeper_host = string.Empty; - string gatekeeper_serveruri = string.Empty; - string destination_serveruri = string.Empty; - int gatekeeper_port = 0; - IPEndPoint client_ipaddress = null; - - if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null) - gatekeeper_host = args["gatekeeper_host"].AsString(); - if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null) - Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port); - if (args.ContainsKey("gatekeeper_serveruri") && args["gatekeeper_serveruri"] !=null) - gatekeeper_serveruri = args["gatekeeper_serveruri"]; - if (args.ContainsKey("destination_serveruri") && args["destination_serveruri"] !=null) - destination_serveruri = args["destination_serveruri"]; - - GridRegion gatekeeper = new GridRegion(); - gatekeeper.ServerURI = gatekeeper_serveruri; - gatekeeper.ExternalHostName = gatekeeper_host; - gatekeeper.HttpPort = (uint)gatekeeper_port; - gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); - - if (args.ContainsKey("destination_x") && args["destination_x"] != null) - Int32.TryParse(args["destination_x"].AsString(), out x); else - m_log.WarnFormat(" -- request didn't have destination_x"); - if (args.ContainsKey("destination_y") && args["destination_y"] != null) - Int32.TryParse(args["destination_y"].AsString(), out y); - else - m_log.WarnFormat(" -- request didn't have destination_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(); - - if (args.ContainsKey("client_ip") && args["client_ip"] != null) - { - string ip_str = args["client_ip"].ToString(); - try - { - string callerIP = GetCallerIP(request); - // Verify if this caller has authority to send the client IP - if (callerIP == m_LoginServerIP) - client_ipaddress = new IPEndPoint(IPAddress.Parse(ip_str), 0); - else // leaving this for now, but this warning should be removed - m_log.WarnFormat("[HOME AGENT HANDLER]: Unauthorized machine {0} tried to set client ip to {1}", callerIP, ip_str); - } - catch - { - m_log.DebugFormat("[HOME AGENT HANDLER]: Exception parsing client ip address from {0}", ip_str); - } - } - - GridRegion destination = new GridRegion(); - destination.RegionID = uuid; - destination.RegionLocX = x; - destination.RegionLocY = y; - destination.RegionName = regionname; - destination.ServerURI = destination_serveruri; - - AgentCircuitData aCircuit = new AgentCircuitData(); - try - { - aCircuit.UnpackAgentCircuitData(args); - } - catch (Exception ex) - { - m_log.InfoFormat("[HOME AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message); - responsedata["int_response_code"] = HttpStatusCode.BadRequest; - responsedata["str_response_string"] = "Bad request"; - return; - } - - OSDMap resp = new OSDMap(2); - string reason = String.Empty; + m_log.WarnFormat("[HOME AGENT HANDLER]: Wrong data type"); - bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, client_ipaddress, out reason); - - resp["reason"] = OSD.FromString(reason); - resp["success"] = OSD.FromBoolean(result); - - // TODO: add reason if not String.Empty? - responsedata["int_response_code"] = HttpStatusCode.OK; - responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); + return null; } - private string GetCallerIP(Hashtable request) - { - if (!m_Proxy) - return Util.GetCallerIP(request); - - // We're behind a proxy - Hashtable headers = (Hashtable)request["headers"]; - string xff = "X-Forwarded-For"; - if (headers.ContainsKey(xff.ToLower())) - xff = xff.ToLower(); - if (!headers.ContainsKey(xff) || headers[xff] == null) - { - m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); - return Util.GetCallerIP(request); - } + protected override bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) + { + return m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, fromLogin, out reason); + } - m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); + } - IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); - if (ep != null) - return ep.Address.ToString(); + public class ExtendedAgentDestinationData : AgentDestinationData + { + public string host; + public int port; + public string gatekeeperServerURI; + public string destinationServerURI; - // Oops - return Util.GetCallerIP(request); - } } } diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index b20f467..d9c1bd3 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -108,7 +108,7 @@ namespace OpenSim.Server.Handlers.Hypergrid server.AddXmlRPCHandler("get_uui", GetUUI, false); server.AddXmlRPCHandler("get_uuid", GetUUID, false); - server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler); + server.AddStreamHandler(new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy)); } public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient) diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index ae37ca7..334d313 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -328,31 +328,16 @@ namespace OpenSim.Server.Handlers.Simulation return; } - // retrieve the input arguments - int x = 0, y = 0; - UUID uuid = UUID.Zero; - string regionname = string.Empty; - uint teleportFlags = 0; - if (args.ContainsKey("destination_x") && args["destination_x"] != null) - Int32.TryParse(args["destination_x"].AsString(), out x); - else - m_log.WarnFormat(" -- request didn't have destination_x"); - if (args.ContainsKey("destination_y") && args["destination_y"] != null) - Int32.TryParse(args["destination_y"].AsString(), out y); - else - m_log.WarnFormat(" -- request didn't have destination_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(); - if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) - teleportFlags = args["teleport_flags"].AsUInteger(); + AgentDestinationData data = CreateAgentDestinationData(); + UnpackData(args, data, request); GridRegion destination = new GridRegion(); - destination.RegionID = uuid; - destination.RegionLocX = x; - destination.RegionLocY = y; - destination.RegionName = regionname; + destination.RegionID = data.uuid; + destination.RegionLocX = data.x; + destination.RegionLocY = data.y; + destination.RegionName = data.name; + + GridRegion gatekeeper = ExtractGatekeeper(data); AgentCircuitData aCircuit = new AgentCircuitData(); try @@ -373,7 +358,7 @@ namespace OpenSim.Server.Handlers.Simulation // This is the meaning of POST agent //m_regionClient.AdjustUserInformation(aCircuit); //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); - bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason); + bool result = CreateAgent(gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason); resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); @@ -385,7 +370,36 @@ namespace OpenSim.Server.Handlers.Simulation responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); } - private string GetCallerIP(Hashtable request) + protected virtual AgentDestinationData CreateAgentDestinationData() + { + return new AgentDestinationData(); + } + + protected virtual void UnpackData(OSDMap args, AgentDestinationData data, Hashtable request) + { + // retrieve the input arguments + if (args.ContainsKey("destination_x") && args["destination_x"] != null) + Int32.TryParse(args["destination_x"].AsString(), out data.x); + else + m_log.WarnFormat(" -- request didn't have destination_x"); + if (args.ContainsKey("destination_y") && args["destination_y"] != null) + Int32.TryParse(args["destination_y"].AsString(), out data.y); + else + m_log.WarnFormat(" -- request didn't have destination_y"); + if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) + UUID.TryParse(args["destination_uuid"].AsString(), out data.uuid); + if (args.ContainsKey("destination_name") && args["destination_name"] != null) + data.name = args["destination_name"].ToString(); + if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) + data.flags = args["teleport_flags"].AsUInteger(); + } + + protected virtual GridRegion ExtractGatekeeper(AgentDestinationData data) + { + return null; + } + + protected string GetCallerIP(Hashtable request) { if (!m_Proxy) return Util.GetCallerIP(request); @@ -418,7 +432,7 @@ namespace OpenSim.Server.Handlers.Simulation } // subclasses can override this - protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) + protected virtual bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); } @@ -593,4 +607,14 @@ namespace OpenSim.Server.Handlers.Simulation return m_SimulationService.UpdateAgent(destination, agent); } } + + public class AgentDestinationData + { + public int x; + public int y; + public string name; + public UUID uuid; + public uint flags; + public bool fromLogin; + } } -- cgit v1.1 From 6c7e33fe472014688837b993118fc48878f134ff Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 22 Jun 2013 08:29:06 -0700 Subject: Change IsLocalRegion from using region handle to using regionID. This was affecting UpdateAgent and CloseAgent in cases where the foreign region is on the same coordinates as *some* local region. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 334d313..71a9e6f 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -576,7 +576,6 @@ namespace OpenSim.Server.Handlers.Simulation //agent.Dump(); // This is one of the meanings of PUT agent result = UpdateAgent(destination, agent); - } else if ("AgentPosition".Equals(messageType)) { -- cgit v1.1 From e26e8b882965430f66c6459987a8b219d68e5da1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 28 Jun 2013 19:19:38 +0100 Subject: Remove "Asset deletion not supported by database" message from "delete asset" robust/standalone console command since it actually was implemented and performed. Improve other associated messages. --- OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index ff45d94..cc4325a 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs @@ -119,16 +119,14 @@ namespace OpenSim.Server.Handlers.Asset if (asset == null || asset.Data.Length == 0) { - MainConsole.Instance.Output("Asset not found"); + MainConsole.Instance.OutputFormat("Could not find asset with ID {0}", args[2]); return; } - m_AssetService.Delete(args[2]); - - //MainConsole.Instance.Output("Asset deleted"); - // TODO: Implement this - - MainConsole.Instance.Output("Asset deletion not supported by database"); + if (!m_AssetService.Delete(asset.ID)) + MainConsole.Instance.OutputFormat("ERROR: Could not delete asset {0} {1}", asset.ID, asset.Name); + else + MainConsole.Instance.OutputFormat("Deleted asset {0} {1}", asset.ID, asset.Name); } void HandleDumpAsset(string module, string[] args) -- cgit v1.1 From 4d24bf75fd695a12683987d9803018c2ec4cae60 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 2 Jul 2013 16:46:35 -0700 Subject: Deleted debug messages. Fixed a null ref exception on the POST handler of GridUserServerPostHandler.cs --- OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 687cf8d..7483395 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs @@ -185,10 +185,12 @@ namespace OpenSim.Server.Handlers.GridUser GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user); Dictionary result = new Dictionary(); - result["result"] = guinfo.ToKeyValuePairs(); + if (guinfo != null) + result["result"] = guinfo.ToKeyValuePairs(); + else + result["result"] = "null"; string xmlString = ServerUtils.BuildXmlResponse(result); - //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); return Util.UTF8NoBomEncoding.GetBytes(xmlString); } -- cgit v1.1 From bbb9af363de5cabf44dec2b5aba6fb386a1e7fad Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 7 Jul 2013 20:43:42 -0700 Subject: Print out caller IP when unusual requests are received. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 71a9e6f..b01de7a 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -107,7 +107,7 @@ namespace OpenSim.Server.Handlers.Simulation } else { - m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method); + m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message (caller is {1})", method, Util.GetCallerIP(request)); responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed; responsedata["str_response_string"] = "Method not allowed"; -- cgit v1.1 From e19defde36ddbd5ff90d8304c6fe3b57110f8078 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 8 Jul 2013 22:03:07 +0100 Subject: Add "show caps stats by user" and "show caps stats by cap" console commands to print various counts of capability invocation by user and by cap This currently prints caps requests received and handled, so that overload of received compared to handled or deadlock can be detected. This involves making BaseStreamHandler and BaseOutputStream record the ints, which means inheritors should subclass ProcessRequest() instead of Handle() However, existing inheriting classes overriding Handle() will still work, albeit without stats recording. "show caps" becomes "show caps list" to disambiguate between show caps commands --- .../Handlers/Asset/AssetServerDeleteHandler.cs | 2 +- .../Server/Handlers/Asset/AssetServerGetHandler.cs | 2 +- .../Handlers/Asset/AssetServerPostHandler.cs | 2 +- .../AuthenticationServerPostHandler.cs | 2 +- .../Handlers/Authentication/OpenIdServerHandler.cs | 30 ++++++++-------------- .../AuthorizationServerPostHandler.cs | 2 +- .../Handlers/Avatar/AvatarServerPostHandler.cs | 2 +- .../Handlers/Friends/FriendsServerPostHandler.cs | 2 +- .../Server/Handlers/Grid/GridServerPostHandler.cs | 2 +- .../Handlers/GridUser/GridUserServerPostHandler.cs | 2 +- .../Hypergrid/HGFriendsServerPostHandler.cs | 2 +- .../Handlers/Hypergrid/HeloServerConnector.cs | 2 +- .../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 1 + .../Inventory/InventoryServerMoveItemsHandler.cs | 2 +- .../Handlers/Inventory/XInventoryInConnector.cs | 2 +- .../Server/Handlers/Map/MapAddServerConnector.cs | 2 +- .../Server/Handlers/Map/MapGetServerConnector.cs | 2 +- .../Server/Handlers/Neighbour/NeighbourHandlers.cs | 8 +++--- .../Handlers/Presence/PresenceServerPostHandler.cs | 2 +- .../Server/Handlers/Simulation/AgentHandlers.cs | 4 +-- .../UserAccounts/UserAccountServerPostHandler.cs | 2 +- 21 files changed, 35 insertions(+), 42 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs index 986394b..941b97d 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs @@ -70,7 +70,7 @@ namespace OpenSim.Server.Handlers.Asset m_allowedTypes = allowedTypes; } - public override byte[] Handle(string path, Stream request, + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { bool result = false; diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index 8f7412b..8b23a83 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs @@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Asset m_AssetService = service; } - public override byte[] Handle(string path, Stream request, + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { byte[] result = new byte[0]; diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs index a006fa8..8eebc61 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs @@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Asset m_AssetService = service; } - public override byte[] Handle(string path, Stream request, + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { AssetBase asset; diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index 6b93cd9..16e011a 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs @@ -70,7 +70,7 @@ namespace OpenSim.Server.Handlers.Authentication } } - public override byte[] Handle(string path, Stream request, + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { string[] p = SplitParams(path); diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs index 18cef15..66a26fc 100644 --- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs @@ -147,7 +147,7 @@ namespace OpenSim.Server.Handlers.Authentication #endregion } - public class OpenIdStreamHandler : IStreamHandler + public class OpenIdStreamHandler : BaseOutputStreamHandler { #region HTML @@ -191,42 +191,34 @@ 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; } } - - string m_contentType; - string m_httpMethod; - string m_path; IAuthenticationService m_authenticationService; IUserAccountService m_userAccountService; ProviderMemoryStore m_openidStore = new ProviderMemoryStore(); + public override string ContentType { get { return "text/html"; } } + /// /// Constructor /// - public OpenIdStreamHandler(string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService) + public OpenIdStreamHandler( + string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService) + : base(httpMethod, path, "OpenId", "OpenID stream handler") { m_authenticationService = authService; m_userAccountService = userService; - m_httpMethod = httpMethod; - m_path = path; - - m_contentType = "text/html"; } /// /// Handles all GET and POST requests for OpenID identifier pages and endpoint /// server communication /// - public void Handle(string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + protected override void ProcessRequest( + string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath)); // Defult to returning HTML content - m_contentType = "text/html"; + httpResponse.ContentType = ContentType; try { @@ -276,7 +268,7 @@ For more information, see http://openid.net/. string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type"); if (contentTypeValues != null && contentTypeValues.Length == 1) - m_contentType = contentTypeValues[0]; + httpResponse.ContentType = contentTypeValues[0]; // Set the response code and document body based on the OpenID result httpResponse.StatusCode = (int)provider.Request.Response.Code; @@ -344,4 +336,4 @@ For more information, see http://openid.net/. return false; } } -} +} \ No newline at end of file diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs index bcf9d47..c9b4e9b 100644 --- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs @@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Authorization m_AuthorizationService = service; } - public override byte[] Handle(string path, Stream request, + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest)); diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs index 8cd747e..d6bbb8f 100644 --- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs @@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Avatar m_AvatarService = service; } - public override byte[] Handle(string path, Stream requestData, + protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { StreamReader sr = new StreamReader(requestData); diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index 47a8558..ca0a24c 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs @@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Friends m_FriendsService = service; } - public override byte[] Handle(string path, Stream requestData, + protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { StreamReader sr = new StreamReader(requestData); diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index ef5f33e..89cba8a 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Grid m_GridService = service; } - public override byte[] Handle(string path, Stream requestData, + protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { StreamReader sr = new StreamReader(requestData); diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 7483395..0b98e9a 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs @@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.GridUser m_GridUserService = service; } - public override byte[] Handle(string path, Stream requestData, + protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { StreamReader sr = new StreamReader(requestData); diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index 0aa2729..a2bdadb 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs @@ -68,7 +68,7 @@ namespace OpenSim.Server.Handlers.Hypergrid m_log.ErrorFormat("[HGFRIENDS HANDLER]: TheService is null!"); } - public override byte[] Handle(string path, Stream requestData, + protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { StreamReader sr = new StreamReader(requestData); diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs index f306b1c..06eaf2e 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs @@ -91,7 +91,7 @@ namespace OpenSim.Server.Handlers.Hypergrid m_HandlersType = handlersType; } - public override byte[] Handle(string path, Stream requestData, + protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { return OKResponse(httpResponse); diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index df875af..f37f2f1 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -68,6 +68,7 @@ namespace OpenSim.Server.Handlers.Hypergrid { return new ExtendedAgentDestinationData(); } + protected override void UnpackData(OSDMap args, AgentDestinationData d, Hashtable request) { base.UnpackData(args, d, request); diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs index 231e32f..e2c50fe 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs @@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Inventory m_InventoryService = service; } - public override byte[] Handle(string path, Stream request, + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { XmlSerializer xs = new XmlSerializer(typeof (List)); diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 9d28dc3..0d7c136 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -87,7 +87,7 @@ namespace OpenSim.Server.Handlers.Asset m_InventoryService = service; } - public override byte[] Handle(string path, Stream requestData, + protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { StreamReader sr = new StreamReader(requestData); diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 4a61969..d438fc7 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -99,7 +99,7 @@ namespace OpenSim.Server.Handlers.MapImage m_Proxy = proxy; } - public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { // m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path); StreamReader sr = new StreamReader(requestData); diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs index fb85d1c..7bb2f39 100644 --- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs @@ -80,7 +80,7 @@ namespace OpenSim.Server.Handlers.MapImage m_MapService = service; } - public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { byte[] result = new byte[0]; diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs index 8a1f824..3525a01 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs @@ -58,7 +58,7 @@ namespace OpenSim.Server.Handlers.Neighbour // TODO: unused: m_AuthenticationService = authentication; } - public override byte[] Handle(string path, Stream request, + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { // Not implemented yet @@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.Neighbour // TODO: unused: m_AllowForeignGuests = foreignGuests; } - public override byte[] Handle(string path, Stream request, + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { byte[] result = new byte[0]; @@ -176,7 +176,7 @@ namespace OpenSim.Server.Handlers.Neighbour // TODO: unused: m_AuthenticationService = authentication; } - public override byte[] Handle(string path, Stream request, + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { // Not implemented yet @@ -197,7 +197,7 @@ namespace OpenSim.Server.Handlers.Neighbour // TODO: unused: m_AuthenticationService = authentication; } - public override byte[] Handle(string path, Stream request, + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { // Not implemented yet diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 2d67c6d..abb4b19 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Presence m_PresenceService = service; } - public override byte[] Handle(string path, Stream requestData, + protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { StreamReader sr = new StreamReader(requestData); diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 71a9e6f..a9fd4ed 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -251,7 +251,7 @@ namespace OpenSim.Server.Handlers.Simulation m_SimulationService = null; } - public override byte[] Handle(string path, Stream request, + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { // m_log.DebugFormat("[SIMULATION]: Stream handler called"); @@ -457,7 +457,7 @@ namespace OpenSim.Server.Handlers.Simulation m_SimulationService = null; } - public override byte[] Handle(string path, Stream request, + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { // m_log.DebugFormat("[SIMULATION]: Stream handler called"); diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index 72551ef..24c9de6 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -68,7 +68,7 @@ namespace OpenSim.Server.Handlers.UserAccounts } } - public override byte[] Handle(string path, Stream requestData, + protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { StreamReader sr = new StreamReader(requestData); -- cgit v1.1 From 931eb892d92bcd61194655ec02def6264d8b182e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 13 Jul 2013 17:56:42 -0700 Subject: Deleted GET agent all around. Not used. --- .../Server/Handlers/Simulation/AgentHandlers.cs | 61 +--------------------- 1 file changed, 2 insertions(+), 59 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 40a34c6..17a8ef4 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -90,12 +90,7 @@ namespace OpenSim.Server.Handlers.Simulation // Next, let's parse the verb string method = (string)request["http-method"]; - if (method.Equals("GET")) - { - DoAgentGet(request, responsedata, agentID, regionID); - return responsedata; - } - else if (method.Equals("DELETE")) + if (method.Equals("DELETE")) { DoAgentDelete(request, responsedata, agentID, action, regionID); return responsedata; @@ -107,7 +102,7 @@ namespace OpenSim.Server.Handlers.Simulation } else { - m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message (caller is {1})", method, Util.GetCallerIP(request)); + m_log.ErrorFormat("[AGENT HANDLER]: method {0} not supported in agent message {1} (caller is {2})", method, (string)request["uri"], Util.GetCallerIP(request)); responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed; responsedata["str_response_string"] = "Method not allowed"; @@ -156,58 +151,6 @@ namespace OpenSim.Server.Handlers.Simulation // Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]); } - protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) - { - if (m_SimulationService == null) - { - m_log.Debug("[AGENT HANDLER]: Agent GET called. Harmless but useless."); - responsedata["content_type"] = "application/json"; - responsedata["int_response_code"] = HttpStatusCode.NotImplemented; - responsedata["str_response_string"] = string.Empty; - - return; - } - - GridRegion destination = new GridRegion(); - destination.RegionID = regionID; - - IAgentData agent = null; - bool result = m_SimulationService.RetrieveAgent(destination, id, out agent); - OSDMap map = null; - if (result) - { - if (agent != null) // just to make sure - { - map = agent.Pack(); - string strBuffer = ""; - try - { - strBuffer = OSDParser.SerializeJsonString(map); - } - catch (Exception e) - { - m_log.WarnFormat("[AGENT HANDLER]: Exception thrown on serialization of DoAgentGet: {0}", e.Message); - responsedata["int_response_code"] = HttpStatusCode.InternalServerError; - // ignore. buffer will be empty, caller should check. - } - - responsedata["content_type"] = "application/json"; - responsedata["int_response_code"] = HttpStatusCode.OK; - responsedata["str_response_string"] = strBuffer; - } - else - { - responsedata["int_response_code"] = HttpStatusCode.InternalServerError; - responsedata["str_response_string"] = "Internal error"; - } - } - else - { - responsedata["int_response_code"] = HttpStatusCode.NotFound; - responsedata["str_response_string"] = "Not Found"; - } - } - protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) { m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); -- cgit v1.1 From b4f1b9acf65f9e782d56602e60c58be6145c5cca Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 13 Jul 2013 21:28:46 -0700 Subject: Guard against unauthorized agent deletes. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 17a8ef4..cd172e4 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -27,11 +27,13 @@ using System; using System.Collections; +using System.Collections.Specialized; using System.IO; using System.IO.Compression; using System.Reflection; using System.Net; using System.Text; +using System.Web; using OpenSim.Server.Base; using OpenSim.Server.Handlers.Base; @@ -92,7 +94,11 @@ namespace OpenSim.Server.Handlers.Simulation string method = (string)request["http-method"]; if (method.Equals("DELETE")) { - DoAgentDelete(request, responsedata, agentID, action, regionID); + string auth_token = string.Empty; + if (request.ContainsKey("auth")) + auth_token = request["auth"].ToString(); + + DoAgentDelete(request, responsedata, agentID, action, regionID, auth_token); return responsedata; } else if (method.Equals("QUERYACCESS")) @@ -151,9 +157,9 @@ namespace OpenSim.Server.Handlers.Simulation // Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]); } - protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) + protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID, string auth_token) { - m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); + m_log.DebugFormat("[AGENT HANDLER]: >>> DELETE action: {0}; RegionID: {1}; from: {2}; auth_code: {3}", action, regionID, Util.GetCallerIP(request), auth_token); GridRegion destination = new GridRegion(); destination.RegionID = regionID; @@ -161,12 +167,12 @@ namespace OpenSim.Server.Handlers.Simulation if (action.Equals("release")) ReleaseAgent(regionID, id); else - Util.FireAndForget(delegate { m_SimulationService.CloseAgent(destination, id); }); + Util.FireAndForget(delegate { m_SimulationService.CloseAgent(destination, id, auth_token); }); responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); - m_log.DebugFormat("[AGENT HANDLER]: Agent {0} Released/Deleted from region {1}", id, regionID); + //m_log.DebugFormat("[AGENT HANDLER]: Agent {0} Released/Deleted from region {1}", id, regionID); } protected virtual void ReleaseAgent(UUID regionID, UUID id) -- cgit v1.1 From f3b3e21dea98b4ea974ae7649a63d00b69e6dfed Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 14 Jul 2013 07:28:40 -0700 Subject: Change the auth token to be the user's sessionid. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index cd172e4..4ac477f 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -159,7 +159,10 @@ namespace OpenSim.Server.Handlers.Simulation protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID, string auth_token) { - m_log.DebugFormat("[AGENT HANDLER]: >>> DELETE action: {0}; RegionID: {1}; from: {2}; auth_code: {3}", action, regionID, Util.GetCallerIP(request), auth_token); + if (string.IsNullOrEmpty(action)) + m_log.DebugFormat("[AGENT HANDLER]: >>> DELETE <<< RegionID: {0}; from: {1}; auth_code: {2}", regionID, Util.GetCallerIP(request), auth_token); + else + m_log.DebugFormat("[AGENT HANDLER]: Release {0} to RegionID: {1}", id, regionID); GridRegion destination = new GridRegion(); destination.RegionID = regionID; -- cgit v1.1 From b3052c425effe7eed6f4a8ab8e25fd4de907bc86 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 17 Aug 2013 01:08:19 +0100 Subject: Remove some mono compiler warnings from OpenSim/Server/Handlers --- OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 2 +- OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs | 6 +----- OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs | 6 ++---- 3 files changed, 4 insertions(+), 10 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index f37f2f1..04bb9e8 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -85,7 +85,7 @@ namespace OpenSim.Server.Handlers.Hypergrid data.destinationServerURI = args["destination_serveruri"]; } - catch (InvalidCastException e) + catch (InvalidCastException) { m_log.ErrorFormat("[HOME AGENT HANDLER]: Bad cast in UnpackData"); } diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index d9c1bd3..7137836 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -453,7 +453,6 @@ namespace OpenSim.Server.Handlers.Hypergrid XmlRpcResponse response = new XmlRpcResponse(); response.Value = hash; return response; - } /// @@ -471,9 +470,7 @@ namespace OpenSim.Server.Handlers.Hypergrid //string portstr = (string)requestData["port"]; if (requestData.ContainsKey("first") && requestData.ContainsKey("last")) { - UUID userID = UUID.Zero; string first = (string)requestData["first"]; - string last = (string)requestData["last"]; UUID uuid = m_HomeUsersService.GetUUID(first, last); hash["UUID"] = uuid.ToString(); @@ -482,7 +479,6 @@ namespace OpenSim.Server.Handlers.Hypergrid XmlRpcResponse response = new XmlRpcResponse(); response.Value = hash; return response; - } } -} +} \ No newline at end of file diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs index f9a520a..28dbbc2 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs @@ -39,8 +39,7 @@ namespace OpenSim.Server.Handlers.Profiles { public class UserProfilesConnector: ServiceConnector { - static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - +// static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // Our Local Module public IUserProfilesService ServiceModule @@ -110,5 +109,4 @@ namespace OpenSim.Server.Handlers.Profiles Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); } } -} - +} \ No newline at end of file -- cgit v1.1 From 4cbadc3c4984b8bebc7098a720846309f645ad7b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 2 Sep 2013 17:27:45 +0100 Subject: Allow one to specify a DefaultHGRegion flag in [GridService] in order to allow different default regions for HG and direct grid logins. This requires a new GridService.GetDefaultHypergridRegions() so ROBUST services require updating but not simulators. This method still returns regions flagged with just DefaultRegion after any DefaultHGRegions, so if no DefaultHGRegions are specified then existing configured defaults will still work. Immediate use is for conference where we need to be able to specify different defaults However, this is also generally useful to send experienced HG users to one default location and local users whose specified region fails (e.g. no "home" or "last") to another. --- .../Server/Handlers/Grid/GridServerPostHandler.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 89cba8a..c63b409 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -106,6 +106,9 @@ namespace OpenSim.Server.Handlers.Grid case "get_default_regions": return GetDefaultRegions(request); + case "get_default_hypergrid_regions": + return GetDefaultHypergridRegions(request); + case "get_fallback_regions": return GetFallbackRegions(request); @@ -444,6 +447,36 @@ namespace OpenSim.Server.Handlers.Grid return Util.UTF8NoBomEncoding.GetBytes(xmlString); } + byte[] GetDefaultHypergridRegions(Dictionary request) + { + //m_log.DebugFormat("[GRID HANDLER]: GetDefaultRegions"); + UUID scopeID = UUID.Zero; + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); + else + m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range"); + + List rinfos = m_GridService.GetDefaultHypergridRegions(scopeID); + + Dictionary result = new Dictionary(); + if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) + result["result"] = "null"; + else + { + int i = 0; + foreach (GridRegion rinfo in rinfos) + { + Dictionary rinfoDict = rinfo.ToKeyValuePairs(); + result["region" + i] = rinfoDict; + i++; + } + } + string xmlString = ServerUtils.BuildXmlResponse(result); + + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + } + byte[] GetFallbackRegions(Dictionary request) { //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange"); -- cgit v1.1 From 42bdf446585007029faf4cd21abd289487f0f797 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Oct 2013 23:33:47 +0100 Subject: Bump OPenSimulator version and assembly versions up to 0.8.0 Dev --- OpenSim/Server/Base/Properties/AssemblyInfo.cs | 2 +- OpenSim/Server/Handlers/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs index b4732b8..67340c7 100644 --- a/OpenSim/Server/Base/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.6.*")] +[assembly: AssemblyVersion("0.8.0.*")] diff --git a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs index 3295ffd..04cd798 100644 --- a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.6.*")] +[assembly: AssemblyVersion("0.8.0.*")] -- cgit v1.1 From 31246ecd04c0f57631587e25ae0245d086098ddc Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 4 Oct 2013 20:53:01 -0500 Subject: * Added a unique and interesting WebSocket grid login processor by hijacking the LLSD login code. This sends the data through the normal login channels and spits out a JSON object back that mimics the login response. Feel free to comment on the best way to set this up as a config option. --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 56 ++++++++++++++++++++++ .../Handlers/Login/LLLoginServiceInConnector.cs | 1 + 2 files changed, 57 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index f83a239..e4a0ffa 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -53,6 +53,7 @@ namespace OpenSim.Server.Handlers.Login private ILoginService m_LocalService; private bool m_Proxy; + public LLLoginHandlers(ILoginService service, bool hasProxy) { @@ -213,6 +214,61 @@ namespace OpenSim.Server.Handlers.Login return FailedOSDResponse(); } + public void HandleWebSocketLoginEvents(string path, WebSocketHttpServerHandler sock) + { + sock.MaxPayloadSize = 16384; //16 kb payload + sock.InitialMsgTimeout = 5000; //5 second first message to trigger at least one of these events + sock.NoDelay_TCP_Nagle = true; + sock.OnData += delegate(object sender, WebsocketDataEventArgs data) { sock.Close("fail"); }; + sock.OnPing += delegate(object sender, PingEventArgs pingdata) { sock.Close("fail"); }; + sock.OnPong += delegate(object sender, PongEventArgs pongdata) { sock.Close("fail"); }; + sock.OnText += delegate(object sender, WebsocketTextEventArgs text) + { + OSD request = null; + try + { + request = OSDParser.DeserializeJson(text.Data); + if (!(request is OSDMap)) + { + sock.SendMessage(OSDParser.SerializeJsonString(FailedOSDResponse())); + } + else + { + OSDMap req = request as OSDMap; + string first = req["firstname"].AsString(); + string last = req["lastname"].AsString(); + string passwd = req["passwd"].AsString(); + string start = req["startlocation"].AsString(); + string version = req["version"].AsString(); + string channel = req["channel"].AsString(); + string mac = req["mac"].AsString(); + string id0 = req["id0"].AsString(); + UUID scope = UUID.Zero; + IPEndPoint endPoint = + (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint(); + LoginResponse reply = null; + reply = m_LocalService.Login(first, last, passwd, start, scope, version, + channel, mac, id0, endPoint); + sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap())); + + } + + } + catch (Exception) + { + sock.SendMessage(OSDParser.SerializeJsonString(FailedOSDResponse())); + } + finally + { + sock.Close("success"); + } + }; + + sock.HandshakeAndUpgrade(); + + } + + private XmlRpcResponse FailedXMLRPCResponse() { Hashtable hash = new Hashtable(); diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs index 1fb0dbc..97e8295 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs @@ -98,6 +98,7 @@ namespace OpenSim.Server.Handlers.Login server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); + server.AddWebSocketHandler("/WebSocket/GridLogin", loginHandlers.HandleWebSocketLoginEvents); } } } -- cgit v1.1 From f76cc6036ebf446553ee5201321879538dafe3b2 Mon Sep 17 00:00:00 2001 From: teravus Date: Mon, 7 Oct 2013 21:35:55 -0500 Subject: * Added a Basic DOS protection container/base object for the most common HTTP Server handlers. XMLRPC Handler, GenericHttpHandler and StreamHandler * Applied the XmlRpcBasicDOSProtector.cs to the login service as both an example, and good practice. * Applied the BaseStreamHandlerBasicDOSProtector.cs to the friends service as an example of the DOS Protector on StreamHandlers * Added CircularBuffer, used for CPU and Memory friendly rate monitoring. * DosProtector has 2 states, 1. Just Check for blocked users and check general velocity, 2. Track velocity per user, It only jumps to 2 if it's getting a lot of requests, and state 1 is about as resource friendly as if it wasn't even there. --- OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs | 12 ++++++++++-- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 11 +++++++++++ .../Server/Handlers/Login/LLLoginServiceInConnector.cs | 15 ++++++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index 8b23a83..0bd0235 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs @@ -42,14 +42,22 @@ using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Server.Handlers.Asset { - public class AssetServerGetHandler : BaseStreamHandler + public class AssetServerGetHandler : BaseStreamHandlerBasicDOSProtector { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IAssetService m_AssetService; public AssetServerGetHandler(IAssetService service) : - base("GET", "/assets") + base("GET", "/assets",new BasicDosProtectorOptions() + { + AllowXForwardedFor = true, + ForgetTimeSpan = TimeSpan.FromSeconds(2), + MaxRequestsInTimeframe = 5, + ReportingName = "ASSETGETDOSPROTECTOR", + RequestTimeSpan = TimeSpan.FromSeconds(5), + ThrottledAction = ThrottleAction.DoThrottledMethod + }) { m_AssetService = service; } diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index e4a0ffa..f2a5678 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -145,6 +145,17 @@ namespace OpenSim.Server.Handlers.Login return FailedXMLRPCResponse(); } + public XmlRpcResponse HandleXMLRPCLoginBlocked(XmlRpcRequest request, IPEndPoint client) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable resp = new Hashtable(); + + resp["reason"] = "presence"; + resp["message"] = "Logins are currently restricted. Please try again later."; + resp["login"] = "false"; + response.Value = resp; + return response; + } public XmlRpcResponse HandleXMLRPCSetLoginLevel(XmlRpcRequest request, IPEndPoint remoteClient) { diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs index 97e8295..f60e892 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs @@ -44,6 +44,7 @@ namespace OpenSim.Server.Handlers.Login private ILoginService m_LoginService; private bool m_Proxy; + private BasicDosProtectorOptions m_DosProtectionOptions; public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : base(config, server, String.Empty) @@ -88,6 +89,16 @@ namespace OpenSim.Server.Handlers.Login throw new Exception(String.Format("No LocalServiceModule for LoginService in config file")); m_Proxy = serverConfig.GetBoolean("HasProxy", false); + m_DosProtectionOptions = new BasicDosProtectorOptions(); + // Dos Protection Options + m_DosProtectionOptions.AllowXForwardedFor = serverConfig.GetBoolean("DOSAllowXForwardedForHeader", false); + m_DosProtectionOptions.RequestTimeSpan = + TimeSpan.FromMilliseconds(serverConfig.GetInt("DOSRequestTimeFrameMS", 10000)); + m_DosProtectionOptions.MaxRequestsInTimeframe = serverConfig.GetInt("DOSMaxRequestsInTimeFrame", 5); + m_DosProtectionOptions.ForgetTimeSpan = + TimeSpan.FromMilliseconds(serverConfig.GetInt("DOSForgiveClientAfterMS", 120000)); + m_DosProtectionOptions.ReportingName = "LOGINDOSPROTECTION"; + return loginService; } @@ -95,7 +106,9 @@ namespace OpenSim.Server.Handlers.Login private void InitializeHandlers(IHttpServer server) { LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy); - server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); + server.AddXmlRPCHandler("login_to_simulator", + new XmlRpcBasicDOSProtector(loginHandlers.HandleXMLRPCLogin,loginHandlers.HandleXMLRPCLoginBlocked, + m_DosProtectionOptions).Process, false); server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); server.AddWebSocketHandler("/WebSocket/GridLogin", loginHandlers.HandleWebSocketLoginEvents); -- cgit v1.1 From 75fdd6054d6605877acb511b1bd794de963a15f3 Mon Sep 17 00:00:00 2001 From: teravus Date: Mon, 7 Oct 2013 23:19:50 -0500 Subject: * Refactor * Break out common BasicDOSProtector code into separate class. --- OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index 0bd0235..cd42e70 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs @@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Asset MaxRequestsInTimeframe = 5, ReportingName = "ASSETGETDOSPROTECTOR", RequestTimeSpan = TimeSpan.FromSeconds(5), - ThrottledAction = ThrottleAction.DoThrottledMethod + ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod }) { m_AssetService = service; -- cgit v1.1 From e7ea053c4a4945160980f5e6763ecc4dc8af2609 Mon Sep 17 00:00:00 2001 From: teravus Date: Mon, 7 Oct 2013 23:52:44 -0500 Subject: * Remove a test *cleanup* --- OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index cd42e70..8b23a83 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs @@ -42,22 +42,14 @@ using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Server.Handlers.Asset { - public class AssetServerGetHandler : BaseStreamHandlerBasicDOSProtector + public class AssetServerGetHandler : BaseStreamHandler { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IAssetService m_AssetService; public AssetServerGetHandler(IAssetService service) : - base("GET", "/assets",new BasicDosProtectorOptions() - { - AllowXForwardedFor = true, - ForgetTimeSpan = TimeSpan.FromSeconds(2), - MaxRequestsInTimeframe = 5, - ReportingName = "ASSETGETDOSPROTECTOR", - RequestTimeSpan = TimeSpan.FromSeconds(5), - ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod - }) + base("GET", "/assets") { m_AssetService = service; } -- cgit v1.1 From 7aa00632b90f9c24ff6b0fa0da385744a6573c32 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 28 Nov 2013 08:20:16 -0800 Subject: varregion: many replacements of in-place arithmetic with calls to the Util functions for converting world addresses to region addresses and converting region handles to locations. --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index d438fc7..4d1729e 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -116,9 +116,9 @@ namespace OpenSim.Server.Handlers.MapImage httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest; return FailureResult("Bad request."); } - int x = 0, y = 0; - Int32.TryParse(request["X"].ToString(), out x); - Int32.TryParse(request["Y"].ToString(), out y); + uint x = 0, y = 0; + UInt32.TryParse(request["X"].ToString(), out x); + UInt32.TryParse(request["Y"].ToString(), out y); m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y); @@ -130,7 +130,7 @@ 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); + GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y)); if (r != null) { if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) @@ -151,7 +151,7 @@ namespace OpenSim.Server.Handlers.MapImage byte[] data = Convert.FromBase64String(request["DATA"].ToString()); string reason = string.Empty; - bool result = m_MapService.AddMapTile(x, y, data, out reason); + bool result = m_MapService.AddMapTile((int)x, (int)y, data, out reason); if (result) return SuccessResult(); -- cgit v1.1 From 1842388bb4dcf5ecd57732ffa877b6ca1a3dec7b Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 6 Dec 2013 02:52:13 -0500 Subject: Add support for user preferences (im via email) --- .../Handlers/Profiles/UserProfilesConnector.cs | 2 + .../Handlers/Profiles/UserProfilesHandlers.cs | 53 ++++++++++++++++++++++ 2 files changed, 55 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs index 28dbbc2..6403882 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs @@ -104,6 +104,8 @@ namespace OpenSim.Server.Handlers.Profiles Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); + Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferenecesUpdate); + Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest); Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index f5f0794..d30cc22 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -381,6 +381,59 @@ namespace OpenSim.Server.Handlers } #endregion Interests + #region User Preferences + public bool UserPreferencesRequest(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + m_log.DebugFormat ("User Preferences Request"); + return false; + } + + string result = string.Empty; + UserPreferences prefs = new UserPreferences(); + object Prefs = (object)prefs; + OSD.DeserializeMembers(ref Prefs, (OSDMap)json["params"]); + if(Service.UserPreferencesRequest(ref prefs, ref result)) + { + response.Result = OSD.SerializeMembers(prefs); + return true; + } + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = string.Format("{0}", result); + m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message); + return false; + } + + public bool UserPreferenecesUpdate(OSDMap json, ref JsonRpcResponse response) + { + if(!json.ContainsKey("params")) + { + response.Error.Code = ErrorCode.ParseError; + response.Error.Message = "no parameters supplied"; + m_log.DebugFormat ("User Preferences Update Request"); + return false; + } + + string result = string.Empty; + UserPreferences prefs = new UserPreferences(); + object Prefs = (object)prefs; + OSD.DeserializeMembers(ref Prefs, (OSDMap)json["params"]); + if(Service.UserPreferencesUpdate(ref prefs, ref result)) + { + response.Result = OSD.SerializeMembers(prefs); + return true; + } + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = string.Format("{0}", result); + m_log.InfoFormat("[PROFILES]: User preferences update error - {0}", response.Error.Message); + return false; + } + #endregion User Preferences + #region Utility public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) { -- cgit v1.1 From 958a8f274b8a25703935ab4092f190e9d54b8559 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 7 Dec 2013 01:29:15 +0000 Subject: Revert "Add support for user preferences (im via email)" This reverts commit 1842388bb4dcf5ecd57732ffa877b6ca1a3dec7b. --- .../Handlers/Profiles/UserProfilesConnector.cs | 2 - .../Handlers/Profiles/UserProfilesHandlers.cs | 53 ---------------------- 2 files changed, 55 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs index 6403882..28dbbc2 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs @@ -104,8 +104,6 @@ namespace OpenSim.Server.Handlers.Profiles Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); - Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferenecesUpdate); - Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest); Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index d30cc22..f5f0794 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -381,59 +381,6 @@ namespace OpenSim.Server.Handlers } #endregion Interests - #region User Preferences - public bool UserPreferencesRequest(OSDMap json, ref JsonRpcResponse response) - { - if(!json.ContainsKey("params")) - { - response.Error.Code = ErrorCode.ParseError; - m_log.DebugFormat ("User Preferences Request"); - return false; - } - - string result = string.Empty; - UserPreferences prefs = new UserPreferences(); - object Prefs = (object)prefs; - OSD.DeserializeMembers(ref Prefs, (OSDMap)json["params"]); - if(Service.UserPreferencesRequest(ref prefs, ref result)) - { - response.Result = OSD.SerializeMembers(prefs); - return true; - } - - response.Error.Code = ErrorCode.InternalError; - response.Error.Message = string.Format("{0}", result); - m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message); - return false; - } - - public bool UserPreferenecesUpdate(OSDMap json, ref JsonRpcResponse response) - { - if(!json.ContainsKey("params")) - { - response.Error.Code = ErrorCode.ParseError; - response.Error.Message = "no parameters supplied"; - m_log.DebugFormat ("User Preferences Update Request"); - return false; - } - - string result = string.Empty; - UserPreferences prefs = new UserPreferences(); - object Prefs = (object)prefs; - OSD.DeserializeMembers(ref Prefs, (OSDMap)json["params"]); - if(Service.UserPreferencesUpdate(ref prefs, ref result)) - { - response.Result = OSD.SerializeMembers(prefs); - return true; - } - - response.Error.Code = ErrorCode.InternalError; - response.Error.Message = string.Format("{0}", result); - m_log.InfoFormat("[PROFILES]: User preferences update error - {0}", response.Error.Message); - return false; - } - #endregion User Preferences - #region Utility public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) { -- cgit v1.1 From afb2e0711118706aa9e27246246d08f26e0daca5 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 24 Jan 2014 06:30:38 -0800 Subject: varregion: pass region size in more HG services. --- OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | 4 +++- OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index 5d03097..f25e6e0 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -105,6 +105,8 @@ namespace OpenSim.Server.Handlers.Hypergrid hash["uuid"] = regInfo.RegionID.ToString(); hash["x"] = regInfo.RegionLocX.ToString(); hash["y"] = regInfo.RegionLocY.ToString(); + hash["size_x"] = regInfo.RegionSizeX.ToString(); + hash["size_y"] = regInfo.RegionSizeY.ToString(); hash["region_name"] = regInfo.RegionName; hash["hostname"] = regInfo.ExternalHostName; hash["http_port"] = regInfo.HttpPort.ToString(); diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index 7137836..15b5b31 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -132,6 +132,8 @@ namespace OpenSim.Server.Handlers.Hypergrid hash["uuid"] = regInfo.RegionID.ToString(); hash["x"] = regInfo.RegionLocX.ToString(); hash["y"] = regInfo.RegionLocY.ToString(); + hash["size_x"] = regInfo.RegionSizeX.ToString(); + hash["size_y"] = regInfo.RegionSizeY.ToString(); hash["region_name"] = regInfo.RegionName; hash["hostname"] = regInfo.ExternalHostName; hash["http_port"] = regInfo.HttpPort.ToString(); -- cgit v1.1 From 49af6b53e74123ccebdbd411d456cb8bae528d61 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 26 Jan 2014 19:32:28 -0800 Subject: varregion: enable teleporting to a varregion by clicking on the map and pressing the 'teleport' button. This commit adds returning region map info for all the subregions of a varregion. This also handles the selection of the extra region and then the displacement of the postion so the teleport is to the correct location. --- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index c63b409..16d9b7d 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -48,6 +48,7 @@ namespace OpenSim.Server.Handlers.Grid public class GridServerPostHandler : BaseStreamHandler { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static string LogHeader = "[GRID HANDLER]"; private IGridService m_GridService; @@ -281,8 +282,8 @@ namespace OpenSim.Server.Handlers.Grid else m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position"); + // m_log.DebugFormat("{0} GetRegionByPosition: loc=<{1},{2}>", LogHeader, x, y); GridRegion rinfo = m_GridService.GetRegionByPosition(scopeID, x, y); - //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); Dictionary result = new Dictionary(); if (rinfo == null) -- cgit v1.1 From f0f852b27fa33d8d5e0ee573a9a4a220150c9a44 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 4 Feb 2014 02:29:02 +0000 Subject: Final code drop for appearance. Adding Avination's baked texture storage server. --- OpenSim/Server/Handlers/BakedTextures/XBakes.cs | 150 +++++++++++++++++++++ .../Handlers/BakedTextures/XBakesGetHandler.cs | 70 ++++++++++ .../Server/Handlers/BakedTextures/XBakesHandler.cs | 66 +++++++++ .../Handlers/BakedTextures/XBakesPostHandler.cs | 78 +++++++++++ 4 files changed, 364 insertions(+) create mode 100644 OpenSim/Server/Handlers/BakedTextures/XBakes.cs create mode 100644 OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs create mode 100644 OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs create mode 100644 OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakes.cs b/OpenSim/Server/Handlers/BakedTextures/XBakes.cs new file mode 100644 index 0000000..d1b2e12 --- /dev/null +++ b/OpenSim/Server/Handlers/BakedTextures/XBakes.cs @@ -0,0 +1,150 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Diagnostics; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading; +using System.Reflection; +using OpenSim.Framework; +using OpenSim.Framework.Console; +using OpenSim.Server.Base; +using OpenSim.Services.Base; +using OpenSim.Services.Interfaces; +using Nini.Config; +using log4net; +using OpenMetaverse; + +namespace OpenSim.Server.Handlers.BakedTextures +{ + public class XBakes : ServiceBase, IBakedTextureService + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + protected string m_FSBase; + + private System.Text.UTF8Encoding utf8encoding = + new System.Text.UTF8Encoding(); + + public XBakes(IConfigSource config) : base(config) + { + MainConsole.Instance.Commands.AddCommand("fs", false, + "delete bakes", "delete bakes ", + "Delete agent's baked textures from server", + HandleDeleteBakes); + + IConfig assetConfig = config.Configs["BakedTextureService"]; + if (assetConfig == null) + { + throw new Exception("No BakedTextureService configuration"); + } + + m_FSBase = assetConfig.GetString("BaseDirectory", String.Empty); + if (m_FSBase == String.Empty) + { + m_log.ErrorFormat("[BAKES]: BaseDirectory not specified"); + throw new Exception("Configuration error"); + } + + m_log.Info("[BAKES]: XBakes service enabled"); + } + + public string Get(string id) + { + string file = HashToFile(id); + string diskFile = Path.Combine(m_FSBase, file); + + if (File.Exists(diskFile)) + { + try + { + byte[] content = File.ReadAllBytes(diskFile); + + return utf8encoding.GetString(content); + } + catch + { + } + } + return String.Empty; + } + + public void Store(string id, string sdata) + { + string file = HashToFile(id); + string diskFile = Path.Combine(m_FSBase, file); + + Directory.CreateDirectory(Path.GetDirectoryName(diskFile)); + + File.Delete(diskFile); + + byte[] data = utf8encoding.GetBytes(sdata); + FileStream fs = File.Create(diskFile); + + fs.Write(data, 0, data.Length); + + fs.Close(); + } + + private void HandleDeleteBakes(string module, string[] args) + { + if (args.Length < 3) + { + MainConsole.Instance.Output("Syntax: delete bakes "); + return; + } + + string file = HashToFile(args[2]); + string diskFile = Path.Combine(m_FSBase, file); + + if (File.Exists(diskFile)) + { + File.Delete(diskFile); + MainConsole.Instance.Output("Bakes deleted"); + return; + } + MainConsole.Instance.Output("Bakes not found"); + } + + public string HashToPath(string hash) + { + return Path.Combine(hash.Substring(0, 2), + Path.Combine(hash.Substring(2, 2), + Path.Combine(hash.Substring(4, 2), + hash.Substring(6, 4)))); + } + + public string HashToFile(string hash) + { + return Path.Combine(HashToPath(hash), hash); + } + } +} diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs new file mode 100644 index 0000000..fb4b794 --- /dev/null +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using Nini.Config; +using log4net; +using System; +using System.IO; +using System.Reflection; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; +using System.Xml.Serialization; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework; +using OpenSim.Framework.Servers.HttpServer; + +namespace OpenSim.Server.Handlers.BakedTextures +{ + public class BakesServerGetHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private IBakedTextureService m_BakesService; + private System.Text.UTF8Encoding utf8 = + new System.Text.UTF8Encoding(); + + public BakesServerGetHandler(IBakedTextureService service) : + base("GET", "/bakes") + { + m_BakesService = service; + } + + public override byte[] Handle(string path, Stream request, + IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + string[] p = SplitParams(path); + + if (p.Length == 0) + return new byte[0]; + + return utf8.GetBytes(m_BakesService.Get(p[0])); + } + } +} diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs new file mode 100644 index 0000000..7bf7641 --- /dev/null +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs @@ -0,0 +1,66 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using Nini.Config; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Base; + +namespace OpenSim.Server.Handlers.BakedTextures +{ + public class XBakesConnector : ServiceConnector + { + private IBakedTextureService m_BakesService; + private string m_ConfigName = "BakedTextureService"; + + public XBakesConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) + { + if (configName != String.Empty) + m_ConfigName = configName; + + IConfig serverConfig = config.Configs[m_ConfigName]; + if (serverConfig == null) + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); + + string assetService = serverConfig.GetString("LocalServiceModule", + String.Empty); + + if (assetService == String.Empty) + throw new Exception("No BakedTextureService in config file"); + + Object[] args = new Object[] { config }; + m_BakesService = + ServerUtils.LoadPlugin(assetService, args); + + server.AddStreamHandler(new BakesServerGetHandler(m_BakesService)); + server.AddStreamHandler(new BakesServerPostHandler(m_BakesService)); + } + } +} diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs new file mode 100644 index 0000000..69adb7f --- /dev/null +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs @@ -0,0 +1,78 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using Nini.Config; +using log4net; +using System; +using System.Reflection; +using System.IO; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; +using System.Xml.Serialization; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework; +using OpenSim.Framework.Servers.HttpServer; + +namespace OpenSim.Server.Handlers.BakedTextures +{ + public class BakesServerPostHandler : BaseStreamHandler + { + // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private IBakedTextureService m_BakesService; + + private System.Text.UTF8Encoding utf8 = + new System.Text.UTF8Encoding(); + + public BakesServerPostHandler(IBakedTextureService service) : + base("POST", "/bakes") + { + m_BakesService = service; + } + + public override byte[] Handle(string path, Stream request, + IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + string[] p = SplitParams(path); + + if (p.Length == 0) + { + return new byte[0]; + } + + StreamReader sr = new StreamReader(request); + + m_BakesService.Store(p[0], sr.ReadToEnd()); + sr.Close(); + + return new byte[0]; + } + } +} -- cgit v1.1 From 6955190c7db2563927bc53fd47ed0b47094be45c Mon Sep 17 00:00:00 2001 From: Dev Random Date: Tue, 25 Feb 2014 08:24:22 -0500 Subject: Add Util method to load OpSys env vars --- OpenSim/Server/Base/ServicesServerBase.cs | 34 +++++++++++-------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 667cef8..8352ee2 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -49,9 +49,7 @@ 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); // Command line args // @@ -72,11 +70,9 @@ namespace OpenSim.Server.Base public ServicesServerBase(string prompt, string[] args) : base() { // Save raw arguments - // m_Arguments = args; // Read command line - // ArgvConfigSource argvConfig = new ArgvConfigSource(args); argvConfig.AddSwitch("Startup", "console", "c"); @@ -86,7 +82,6 @@ namespace OpenSim.Server.Base argvConfig.AddSwitch("Startup", "logconfig", "g"); // Automagically create the ini file name - // string fileName = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location); string iniFile = fileName + ".ini"; string logConfig = null; @@ -95,19 +90,17 @@ namespace OpenSim.Server.Base if (startupConfig != null) { // Check if a file name was given on the command line - // iniFile = startupConfig.GetString("inifile", iniFile); - // + // Check if a prompt was given on the command line prompt = startupConfig.GetString("prompt", prompt); - // + // Check for a Log4Net config file on the command line - logConfig =startupConfig.GetString("logconfig",logConfig); + logConfig =startupConfig.GetString("logconfig", logConfig); } - // Find out of the file name is a URI and remote load it - // if it's possible. Load it as a local file otherwise. - // + // Find out of the file name is a URI and remote load it if possible. + // Load it as a local file otherwise. Uri configUri; try @@ -129,13 +122,14 @@ namespace OpenSim.Server.Base Environment.Exit(1); } - // Merge the configuration from the command line into the - // loaded file - // + // Merge OpSys env vars + m_log.Info("[CONFIG]: Loading environment variables for Config"); + Util.MergeEnvironmentToConfig(Config); + + // Merge the configuration from the command line into the loaded file Config.Merge(argvConfig); // Refresh the startupConfig post merge - // if (Config.Configs["Startup"] != null) { startupConfig = Config.Configs["Startup"]; @@ -145,13 +139,10 @@ namespace OpenSim.Server.Base prompt = startupConfig.GetString("Prompt", prompt); - // Allow derived classes to load config before the console is - // opened. - // + // Allow derived classes to load config before the console is opened. ReadConfig(); // Create main console - // string consoleType = "local"; if (startupConfig != null) consoleType = startupConfig.GetString("console", consoleType); @@ -195,7 +186,6 @@ namespace OpenSim.Server.Base // Allow derived classes to perform initialization that // needs to be done after the console has opened - // Initialise(); } -- cgit v1.1 From 6734b94761a4a8b1d03ea97fd6832c51af32bd8c Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Wed, 30 Oct 2013 15:10:29 +0200 Subject: Better error messages This resolves http://opensimulator.org/mantis/view.php?id=6936 --- OpenSim/Server/Base/ServerUtils.cs | 6 +++--- OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 08ba50d..c92e23c 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -280,11 +280,11 @@ namespace OpenSim.Server.Base { if (!(e is System.MissingMethodException)) { - m_log.ErrorFormat("[SERVER UTILS]: Error loading plugin {0} from {1}. Exception: {2}, {3}", + m_log.Error(string.Format("[SERVER UTILS]: Error loading plugin {0} from {1}. Exception: {2}", interfaceName, dllName, - e.InnerException == null ? e.Message : e.InnerException.Message, - e.StackTrace); + e.InnerException == null ? e.Message : e.InnerException.Message), + e); } m_log.ErrorFormat("[SERVER UTILS]: Error loading plugin {0}: {1} args.Length {2}", dllName, e.Message, args.Length); return null; diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 0d7c136..5df3dda 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -155,7 +155,7 @@ namespace OpenSim.Server.Handlers.Asset } catch (Exception e) { - m_log.ErrorFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace); + m_log.Error(string.Format("[XINVENTORY HANDLER]: Exception {0} ", e.Message), e); } return FailureResult(); -- cgit v1.1 From 8cec0b3fa1fa36dd8823cc718dc914e8f7c0b9c8 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 31 Oct 2013 09:00:59 +0200 Subject: If updating a user's profile notes fails then return an error Resolves http://opensimulator.org/mantis/view.php?id=6938 --- OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index d30cc22..d55142e 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -273,10 +273,10 @@ namespace OpenSim.Server.Handlers response.Result = OSD.SerializeMembers(note); return true; } - - object Notes = (object) note; - OSD.DeserializeMembers(ref Notes, (OSDMap)json["params"]); - return true; + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = "Error reading notes"; + return false; } public bool NotesUpdate(OSDMap json, ref JsonRpcResponse response) -- cgit v1.1 From b1d8aa0b6418a4edba8ce3b7b6f3db78616fd523 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 25 Mar 2014 16:20:21 +0200 Subject: Use the "Content-Encoding" header to indicate gzipped streams --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 4ac477f..1254df4 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -232,17 +232,16 @@ namespace OpenSim.Server.Handlers.Simulation httpResponse.KeepAlive = false; Encoding encoding = Encoding.UTF8; - Stream inputStream = null; - if (httpRequest.ContentType == "application/x-gzip") - inputStream = new GZipStream(request, CompressionMode.Decompress); - else if (httpRequest.ContentType == "application/json") - inputStream = request; - else // no go + if (httpRequest.ContentType != "application/json") { httpResponse.StatusCode = 406; return encoding.GetBytes("false"); } + Stream inputStream = request; + if (httpRequest.Headers["Content-Encoding"] == "gzip") + inputStream = new GZipStream(inputStream, CompressionMode.Decompress); + StreamReader reader = new StreamReader(inputStream, encoding); string requestBody = reader.ReadToEnd(); @@ -433,11 +432,9 @@ namespace OpenSim.Server.Handlers.Simulation keysvals.Add("headers", headervals); keysvals.Add("querystringkeys", querystringkeys); - Stream inputStream; - if (httpRequest.ContentType == "application/x-gzip") - inputStream = new GZipStream(request, CompressionMode.Decompress); - else - inputStream = request; + Stream inputStream = request; + if (httpRequest.Headers["Content-Encoding"] == "gzip") + inputStream = new GZipStream(inputStream, CompressionMode.Decompress); Encoding encoding = Encoding.UTF8; StreamReader reader = new StreamReader(inputStream, encoding); -- cgit v1.1 From 6d1d58b6549daea0183b70a1c702e3017abb9663 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 25 Mar 2014 19:09:03 +0200 Subject: Use the "X-Content-Encoding" header to indicate gzipped data, because old OpenSims fail if they get an unknown "Content-Encoding" --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 1254df4..9c7f17e 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -239,7 +239,7 @@ namespace OpenSim.Server.Handlers.Simulation } Stream inputStream = request; - if (httpRequest.Headers["Content-Encoding"] == "gzip") + if ((httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) inputStream = new GZipStream(inputStream, CompressionMode.Decompress); StreamReader reader = new StreamReader(inputStream, encoding); @@ -433,7 +433,7 @@ namespace OpenSim.Server.Handlers.Simulation keysvals.Add("querystringkeys", querystringkeys); Stream inputStream = request; - if (httpRequest.Headers["Content-Encoding"] == "gzip") + if ((httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) inputStream = new GZipStream(inputStream, CompressionMode.Decompress); Encoding encoding = Encoding.UTF8; -- cgit v1.1 From d1c3f8eef58b29eb8760eeb1ac03852a2387f927 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 31 Mar 2014 11:53:12 +0300 Subject: Added assets service method AssetsExist(), which returns whether the given list of assets exist. This method is used to optimize sending assets with embedded assets: e.g., when a Hypergrid visitor takes an item into the inventory. --- .../Server/Handlers/Asset/AssetServerConnector.cs | 3 +- .../Server/Handlers/Asset/AssetServerGetHandler.cs | 74 +++++++++++++------- .../Server/Handlers/Asset/AssetsExistHandler.cs | 80 ++++++++++++++++++++++ 3 files changed, 131 insertions(+), 26 deletions(-) create mode 100644 OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index cc4325a..9b86986 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs @@ -86,6 +86,7 @@ namespace OpenSim.Server.Handlers.Asset server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes)); + server.AddStreamHandler(new AssetsExistHandler(m_AssetService)); MainConsole.Instance.Commands.AddCommand("Assets", false, "show asset", @@ -212,4 +213,4 @@ namespace OpenSim.Server.Handlers.Asset } } } -} \ No newline at end of file +} diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index 8b23a83..ed3b4af 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs @@ -64,45 +64,61 @@ namespace OpenSim.Server.Handlers.Asset if (p.Length == 0) return result; - if (p.Length > 1 && p[1] == "data") + if (p.Length > 1) { - result = m_AssetService.GetData(p[0]); - if (result == null) + string id = p[0]; + string cmd = p[1]; + + if (cmd == "data") { - httpResponse.StatusCode = (int)HttpStatusCode.NotFound; - httpResponse.ContentType = "text/plain"; - result = new byte[0]; + result = m_AssetService.GetData(id); + if (result == null) + { + httpResponse.StatusCode = (int)HttpStatusCode.NotFound; + httpResponse.ContentType = "text/plain"; + result = new byte[0]; + } + else + { + httpResponse.StatusCode = (int)HttpStatusCode.OK; + httpResponse.ContentType = "application/octet-stream"; + } } - else + else if (cmd == "metadata") { - httpResponse.StatusCode = (int)HttpStatusCode.OK; - httpResponse.ContentType = "application/octet-stream"; - } - } - else if (p.Length > 1 && p[1] == "metadata") - { - AssetMetadata metadata = m_AssetService.GetMetadata(p[0]); + AssetMetadata metadata = m_AssetService.GetMetadata(id); - if (metadata != null) - { - XmlSerializer xs = - new XmlSerializer(typeof(AssetMetadata)); - result = ServerUtils.SerializeResult(xs, metadata); + if (metadata != null) + { + XmlSerializer xs = + new XmlSerializer(typeof(AssetMetadata)); + result = ServerUtils.SerializeResult(xs, metadata); - httpResponse.StatusCode = (int)HttpStatusCode.OK; - httpResponse.ContentType = - SLUtil.SLAssetTypeToContentType(metadata.Type); + httpResponse.StatusCode = (int)HttpStatusCode.OK; + httpResponse.ContentType = + SLUtil.SLAssetTypeToContentType(metadata.Type); + } + else + { + httpResponse.StatusCode = (int)HttpStatusCode.NotFound; + httpResponse.ContentType = "text/plain"; + result = new byte[0]; + } } else { - httpResponse.StatusCode = (int)HttpStatusCode.NotFound; + // Unknown request + httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.ContentType = "text/plain"; result = new byte[0]; } } - else + else if (p.Length == 1) { - AssetBase asset = m_AssetService.Get(p[0]); + // Get the entire asset (metadata + data) + + string id = p[0]; + AssetBase asset = m_AssetService.Get(id); if (asset != null) { @@ -120,6 +136,14 @@ namespace OpenSim.Server.Handlers.Asset result = new byte[0]; } } + else + { + // Unknown request + httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; + httpResponse.ContentType = "text/plain"; + result = new byte[0]; + } + return result; } } diff --git a/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs b/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs new file mode 100644 index 0000000..6d01f86 --- /dev/null +++ b/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs @@ -0,0 +1,80 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using Nini.Config; +using log4net; +using System; +using System.Reflection; +using System.IO; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; +using System.Xml.Serialization; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework; +using OpenSim.Framework.Servers.HttpServer; +using OpenMetaverse; + +namespace OpenSim.Server.Handlers.Asset +{ + public class AssetsExistHandler : BaseStreamHandler + { + //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private IAssetService m_AssetService; + + public AssetsExistHandler(IAssetService service) : + base("POST", "/get_assets_exist") + { + m_AssetService = service; + } + + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + XmlSerializer xs; + + string[] ids; + try + { + xs = new XmlSerializer(typeof(string[])); + ids = (string[])xs.Deserialize(request); + } + catch (Exception) + { + httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; + return null; + } + + bool[] exist = m_AssetService.AssetsExist(ids); + + xs = new XmlSerializer(typeof(bool[])); + return ServerUtils.SerializeResult(xs, exist); + } + } +} -- cgit v1.1 From fad0fd7f75a5829303944bb59c940afba3448b17 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 1 Apr 2014 14:58:34 +0300 Subject: Fixed the "Update Asset" handler: it was looking for the Asset ID in the wrong parameter. This doesn't actually matter because the "Update Asset" operation isn't implemented in AssetsServer. But still, the handler should do the right thing... --- OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs index 8eebc61..5122a77 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs @@ -58,7 +58,7 @@ namespace OpenSim.Server.Handlers.Asset IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { AssetBase asset; - XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); + XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); try { @@ -71,18 +71,21 @@ namespace OpenSim.Server.Handlers.Asset } string[] p = SplitParams(path); - if (p.Length > 1) + if (p.Length > 0) { - bool result = m_AssetService.UpdateContent(p[1], asset.Data); + string id = p[0]; + bool result = m_AssetService.UpdateContent(id, asset.Data); xs = new XmlSerializer(typeof(bool)); return ServerUtils.SerializeResult(xs, result); } + else + { + string id = m_AssetService.Store(asset); - string id = m_AssetService.Store(asset); - - xs = new XmlSerializer(typeof(string)); - return ServerUtils.SerializeResult(xs, id); + xs = new XmlSerializer(typeof(string)); + return ServerUtils.SerializeResult(xs, id); + } } } } -- cgit v1.1 From 6d2893be67fd725090b69f5f31c0985c3d211135 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 3 Apr 2014 12:47:20 +0300 Subject: When teleporting using Hypergrid, show more informative error messages in case of error --- OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index f25e6e0..a89d7f7 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs @@ -94,11 +94,14 @@ namespace OpenSim.Server.Handlers.Hypergrid UUID regionID = UUID.Zero; UUID.TryParse(regionID_str, out regionID); - GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID); + string message; + GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID, out message); Hashtable hash = new Hashtable(); if (regInfo == null) + { hash["result"] = "false"; + } else { hash["result"] = "true"; @@ -112,6 +115,10 @@ namespace OpenSim.Server.Handlers.Hypergrid hash["http_port"] = regInfo.HttpPort.ToString(); hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); } + + if (message != null) + hash["message"] = message; + XmlRpcResponse response = new XmlRpcResponse(); response.Value = hash; return response; -- cgit v1.1 From abe0f4a0882942e211b17408767eca664762e062 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 6 Apr 2014 16:18:40 +0300 Subject: When preparing a Hypergrid teleport, tell the receiving grid which user is entering the grid. This can affect which region to use. E.g., returning users may be allowed to enter any region, whereas users from other grids will have to enter a gateway region. Previously per-user decisions were only made later, but by then it's too late to change which region the user enters. --- OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index a89d7f7..c7ac9be 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs @@ -94,8 +94,15 @@ namespace OpenSim.Server.Handlers.Hypergrid UUID regionID = UUID.Zero; UUID.TryParse(regionID_str, out regionID); + UUID agentID = UUID.Zero; + string agentHomeURI = null; + if (requestData.ContainsKey("agent_id")) + agentID = UUID.Parse((string)requestData["agent_id"]); + if (requestData.ContainsKey("agent_home_uri")) + agentHomeURI = (string)requestData["agent_home_uri"]; + string message; - GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID, out message); + GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID, agentID, agentHomeURI, out message); Hashtable hash = new Hashtable(); if (regInfo == null) -- cgit v1.1 From 85d51e57a905ac8f823f345f525837926f4ed2ce Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 7 Apr 2014 09:25:18 +0300 Subject: When sending QueryAccess to a region, also send the user's Home URI --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 9c7f17e..c495b60 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -117,7 +117,7 @@ namespace OpenSim.Server.Handlers.Simulation } - protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) + protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID) { if (m_SimulationService == null) { @@ -136,12 +136,16 @@ namespace OpenSim.Server.Handlers.Simulation if (args.ContainsKey("position")) position = Vector3.Parse(args["position"].AsString()); + string agentHomeURI = null; + if (args.ContainsKey("agent_home_uri")) + agentHomeURI = args["agent_home_uri"].AsString(); + GridRegion destination = new GridRegion(); destination.RegionID = regionID; string reason; string version; - bool result = m_SimulationService.QueryAccess(destination, id, position, out version, out reason); + bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, position, out version, out reason); responsedata["int_response_code"] = HttpStatusCode.OK; -- cgit v1.1 From 06e0528d0b9929cbd8d2b360b0baa00288340d13 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Wed, 9 Apr 2014 08:03:25 +0300 Subject: In teleports, pass the source region to the destination (similar to an HTTP referrer) --- OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | 5 +++-- .../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 5 +++-- .../Server/Handlers/Simulation/AgentHandlers.cs | 23 +++++++++++++++++++--- 3 files changed, 26 insertions(+), 7 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs index adc2fbc..95a0510 100644 --- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs @@ -61,9 +61,10 @@ namespace OpenSim.Server.Handlers.Hypergrid m_Proxy = proxy; } - protected override bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) + protected override bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination, + AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { - return m_GatekeeperService.LoginAgent(aCircuit, destination, out reason); + return m_GatekeeperService.LoginAgent(source, aCircuit, destination, out reason); } } } diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index 04bb9e8..e787f7c 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -117,9 +117,10 @@ namespace OpenSim.Server.Handlers.Hypergrid } - protected override bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) + protected override bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination, + AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { - return m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, fromLogin, out reason); + return m_UserAgentService.LoginAgentToGrid(source, aCircuit, gatekeeper, destination, fromLogin, out reason); } } diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index c495b60..0d7f259 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -307,13 +307,29 @@ namespace OpenSim.Server.Handlers.Simulation return; } + GridRegion source = null; + + if (args.ContainsKey("source_uuid")) + { + source = new GridRegion(); + source.RegionLocX = Int32.Parse(args["source_x"].AsString()); + source.RegionLocY = Int32.Parse(args["source_y"].AsString()); + source.RegionName = args["source_name"].AsString(); + source.RegionID = UUID.Parse(args["source_uuid"].AsString()); + + if (args.ContainsKey("source_server_uri")) + source.RawServerURI = args["source_server_uri"].AsString(); + else + source.RawServerURI = null; + } + OSDMap resp = new OSDMap(2); string reason = String.Empty; // This is the meaning of POST agent //m_regionClient.AdjustUserInformation(aCircuit); //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); - bool result = CreateAgent(gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason); + bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason); resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); @@ -387,9 +403,10 @@ namespace OpenSim.Server.Handlers.Simulation } // subclasses can override this - protected virtual bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) + protected virtual bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination, + AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { - return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + return m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); } } -- cgit v1.1 From 998d7009a65def0a4debc9369d35b63611db5b55 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 22 Apr 2014 20:04:12 +0300 Subject: Eliminated many warnings --- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 3 +++ OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 16d9b7d..37ca5a4 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -48,7 +48,10 @@ namespace OpenSim.Server.Handlers.Grid public class GridServerPostHandler : BaseStreamHandler { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + +#pragma warning disable 414 private static string LogHeader = "[GRID HANDLER]"; +#pragma warning restore 414 private IGridService m_GridService; diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs index 6403882..2dfb862 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs @@ -53,11 +53,6 @@ namespace OpenSim.Server.Handlers.Profiles get; private set; } - public string ConfigName - { - get; private set; - } - public bool Enabled { get; private set; -- cgit v1.1 From 018832522c3c5e37f027bade05c93b88d6ca3827 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Wed, 23 Apr 2014 08:17:25 +0300 Subject: Removed GetUserInventory(). It wasn't being used, and was creating warnings because it's Obsolete. --- .../Inventory/InventoryServerInConnector.cs | 10 ------ .../Handlers/Inventory/XInventoryInConnector.cs | 41 ---------------------- 2 files changed, 51 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index 1d422a7..b295446 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs @@ -86,10 +86,6 @@ namespace OpenSim.Server.Handlers.Inventory protected virtual void AddHttpHandlers(IHttpServer m_httpServer) { m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/GetInventory/", GetUserInventory, CheckAuthSession)); - - m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler>( "POST", "/SystemFolders/", GetSystemFolders, CheckAuthSession)); @@ -178,12 +174,6 @@ namespace OpenSim.Server.Handlers.Inventory #region Wrappers for converting the Guid parameter - public InventoryCollection GetUserInventory(Guid guid) - { - UUID userID = new UUID(guid); - return m_InventoryService.GetUserInventory(userID); - } - public List GetSystemFolders(Guid guid) { UUID userID = new UUID(guid); diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 5df3dda..ce975a8 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -114,8 +114,6 @@ namespace OpenSim.Server.Handlers.Asset return HandleCreateUserInventory(request); case "GETINVENTORYSKELETON": return HandleGetInventorySkeleton(request); - case "GETUSERINVENTORY": - return HandleGetUserInventory(request); case "GETROOTFOLDER": return HandleGetRootFolder(request); case "GETFOLDERFORTYPE": @@ -250,45 +248,6 @@ namespace OpenSim.Server.Handlers.Asset return Util.UTF8NoBomEncoding.GetBytes(xmlString); } - byte[] HandleGetUserInventory(Dictionary request) - { - Dictionary result = new Dictionary(); - UUID principal = UUID.Zero; - UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); - - InventoryCollection icoll = m_InventoryService.GetUserInventory(principal); - if (icoll != null) - { - Dictionary folders = new Dictionary(); - int i = 0; - if (icoll.Folders != null) - { - foreach (InventoryFolderBase f in icoll.Folders) - { - folders["folder_" + i.ToString()] = EncodeFolder(f); - i++; - } - result["FOLDERS"] = folders; - } - if (icoll.Items != null) - { - i = 0; - Dictionary items = new Dictionary(); - foreach (InventoryItemBase it in icoll.Items) - { - items["item_" + i.ToString()] = EncodeItem(it); - i++; - } - result["ITEMS"] = items; - } - } - - string xmlString = ServerUtils.BuildXmlResponse(result); - - //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); - return Util.UTF8NoBomEncoding.GetBytes(xmlString); - } - byte[] HandleGetRootFolder(Dictionary request) { Dictionary result = new Dictionary(); -- cgit v1.1 From 5c661baf6c197caef73e6a8fe5a2223d00a2a6ba Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 26 Apr 2014 02:42:30 +0200 Subject: Allow opening a https port using only http so that nginx can be used for ssl --- OpenSim/Server/Base/HttpServerBase.cs | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 954783c..eed2645 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -40,7 +40,7 @@ namespace OpenSim.Server.Base { public class HttpServerBase : ServicesServerBase { -// 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; @@ -69,6 +69,7 @@ namespace OpenSim.Server.Base bool ssl_main = networkConfig.GetBoolean("https_main",false); bool ssl_listener = networkConfig.GetBoolean("https_listener",false); + bool ssl_external = networkConfig.GetBoolean("https_external",false); m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); @@ -113,20 +114,29 @@ namespace OpenSim.Server.Base uint https_port = (uint)networkConfig.GetInt("https_port", 0); - string cert_path = networkConfig.GetString("cert_path",String.Empty); - if ( cert_path == String.Empty ) + m_log.WarnFormat("[SSL]: External flag is {0}", ssl_external); + if (!ssl_external) { - System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); - Thread.CurrentThread.Abort(); + string cert_path = networkConfig.GetString("cert_path",String.Empty); + if ( cert_path == String.Empty ) + { + System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); + Thread.CurrentThread.Abort(); + } + string cert_pass = networkConfig.GetString("cert_pass",String.Empty); + if ( cert_pass == String.Empty ) + { + System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); + Thread.CurrentThread.Abort(); + } + + MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass)); } - string cert_pass = networkConfig.GetString("cert_pass",String.Empty); - if ( cert_pass == String.Empty ) + else { - System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); - Thread.CurrentThread.Abort(); + m_log.WarnFormat("[SSL]: SSL port is active but no SSL is used because external SSL was requested."); + MainServer.AddHttpServer(new BaseHttpServer(https_port)); } - - MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass)); } } -- cgit v1.1 From 7f570636f8056ec24dd7f28207af62b44a8811ba Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 4 May 2014 11:41:52 -0700 Subject: Please note: older simulators (0.7.6) still send the info about gzip in ContentType --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 0d7f259..06392f7 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -243,7 +243,7 @@ namespace OpenSim.Server.Handlers.Simulation } Stream inputStream = request; - if ((httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) + if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) inputStream = new GZipStream(inputStream, CompressionMode.Decompress); StreamReader reader = new StreamReader(inputStream, encoding); @@ -454,7 +454,7 @@ namespace OpenSim.Server.Handlers.Simulation keysvals.Add("querystringkeys", querystringkeys); Stream inputStream = request; - if ((httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) + if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) inputStream = new GZipStream(inputStream, CompressionMode.Decompress); Encoding encoding = Encoding.UTF8; -- cgit v1.1 From ef262799ca2795cabf9e2f63e29698872e0c9414 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 6 May 2014 09:43:07 +0300 Subject: Better error handling in AssetServerPostHandler. Invalid XML causes an InvalidOperationException, not an XmlException --- OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs index 5122a77..a77e67d 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs @@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Asset { asset = (AssetBase)xs.Deserialize(request); } - catch (XmlException) + catch (Exception) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; return null; -- cgit v1.1 From 47b84875fd2b9f01140288a2695c33f5ef4466c0 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 18 May 2014 19:45:27 +0300 Subject: Tell QueryAccess explicitly whether the user is coming in via Teleport or Cross, because the permission checks are different. Previously we used a heuristic of checking if the entry position is 0 to differentiate between Teleport and Cross, but that doesn't work anymore since we've started providing the precise entry position for cross, too. That's required in order to ensure that the user is allowed to enter the parcel that he's walking into. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 06392f7..7291931 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -132,6 +132,10 @@ namespace OpenSim.Server.Handlers.Simulation // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); OSDMap args = Utils.GetOSDMap((string)request["body"]); + bool viaTeleport = true; + if (args.ContainsKey("viaTeleport")) + viaTeleport = args["viaTeleport"].AsBoolean(); + Vector3 position = Vector3.Zero; if (args.ContainsKey("position")) position = Vector3.Parse(args["position"].AsString()); @@ -145,7 +149,7 @@ namespace OpenSim.Server.Handlers.Simulation string reason; string version; - bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, position, out version, out reason); + bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason); responsedata["int_response_code"] = HttpStatusCode.OK; -- cgit v1.1 From 20f20895cf1444071d5edc42e11a1fb94b1b1079 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 23 May 2014 16:19:43 -0700 Subject: Adds optional HTTP Basic Authentication to Robust service connectors. --- OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | 9 ++++++--- OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs | 7 +++++++ OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs | 9 ++++++++- OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs | 7 +++++++ OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs | 7 +++++++ .../Handlers/Authentication/AuthenticationServerConnector.cs | 5 ++++- .../Authentication/AuthenticationServerPostHandler.cs | 8 +++++--- OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs | 5 ++++- OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs | 5 +++-- OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs | 9 +++++---- OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs | 7 +++++-- OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs | 11 ++++++----- OpenSim/Server/Handlers/Friends/FriendServerConnector.cs | 4 +++- OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs | 5 +++-- OpenSim/Server/Handlers/Grid/GridServerConnector.cs | 5 ++++- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 5 +++-- OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs | 5 ++++- OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | 5 +++-- OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 9 ++++++--- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 8 +++++--- OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs | 5 ++++- OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | 5 +++-- .../Handlers/UserAccounts/UserAccountServerConnector.cs | 5 ++++- .../Handlers/UserAccounts/UserAccountServerPostHandler.cs | 7 ++++--- 24 files changed, 113 insertions(+), 44 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index 9b86986..df9a51b 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs @@ -30,6 +30,7 @@ using System.IO; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Console; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; @@ -83,9 +84,11 @@ namespace OpenSim.Server.Handlers.Asset allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile; } - server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); - server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); - server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + + server.AddStreamHandler(new AssetServerGetHandler(m_AssetService, auth)); + server.AddStreamHandler(new AssetServerPostHandler(m_AssetService, auth)); + server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes, auth)); server.AddStreamHandler(new AssetsExistHandler(m_AssetService)); MainConsole.Instance.Commands.AddCommand("Assets", false, diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs index 941b97d..d85d471 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs @@ -38,6 +38,7 @@ using System.Xml.Serialization; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Server.Handlers.Asset @@ -70,6 +71,12 @@ namespace OpenSim.Server.Handlers.Asset m_allowedTypes = allowedTypes; } + public AssetServerDeleteHandler(IAssetService service, AllowedRemoteDeleteTypes allowedTypes, IServiceAuth auth) : + base("DELETE", "/assets", auth) + { + m_AssetService = service; + m_allowedTypes = allowedTypes; + } protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index ed3b4af..500ec50 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs @@ -38,19 +38,26 @@ using System.Xml.Serialization; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Server.Handlers.Asset { public class AssetServerGetHandler : BaseStreamHandler { - // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IAssetService m_AssetService; public AssetServerGetHandler(IAssetService service) : base("GET", "/assets") { + m_AssetService = service; + } + + public AssetServerGetHandler(IAssetService service, IServiceAuth auth) : + base("GET", "/assets", auth) + { m_AssetService = service; } diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs index a77e67d..1c706a7 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs @@ -38,6 +38,7 @@ using System.Xml.Serialization; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Server.Handlers.Asset @@ -54,6 +55,12 @@ namespace OpenSim.Server.Handlers.Asset m_AssetService = service; } + public AssetServerPostHandler(IAssetService service, IServiceAuth auth) : + base("POST", "/assets", auth) + { + m_AssetService = service; + } + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { diff --git a/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs b/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs index 6d01f86..32901b3 100644 --- a/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs @@ -38,6 +38,7 @@ using System.Xml.Serialization; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenMetaverse; @@ -55,6 +56,12 @@ namespace OpenSim.Server.Handlers.Asset m_AssetService = service; } + public AssetsExistHandler(IAssetService service, IServiceAuth auth) : + base("POST", "/get_assets_exist", auth) + { + m_AssetService = service; + } + protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { XmlSerializer xs; diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs index 848a037..c9a8dce 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs @@ -29,6 +29,7 @@ using System; using Nini.Config; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; @@ -58,7 +59,9 @@ namespace OpenSim.Server.Handlers.Authentication Object[] args = new Object[] { config }; m_AuthenticationService = ServerUtils.LoadPlugin(authenticationService, args); - server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + + server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig, auth)); } } } diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index 16e011a..e258dde 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs @@ -39,6 +39,7 @@ using System.Collections.Generic; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenMetaverse; @@ -55,10 +56,10 @@ namespace OpenSim.Server.Handlers.Authentication private bool m_AllowSetPassword = false; public AuthenticationServerPostHandler(IAuthenticationService service) : - this(service, null) {} + this(service, null, null) {} - public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config) : - base("POST", "/auth") + public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config, IServiceAuth auth) : + base("POST", "/auth", auth) { m_AuthenticationService = service; @@ -73,6 +74,7 @@ namespace OpenSim.Server.Handlers.Authentication protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { + m_log.Error("[XXX]: Authenticating..."); string[] p = SplitParams(path); if (p.Length > 0) diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs index 9a57cd9..1831e84 100644 --- a/OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs +++ b/OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs @@ -29,6 +29,7 @@ using System; using Nini.Config; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; @@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Avatar Object[] args = new Object[] { config }; m_AvatarService = ServerUtils.LoadPlugin(avatarService, args); - server.AddStreamHandler(new AvatarServerPostHandler(m_AvatarService)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + + server.AddStreamHandler(new AvatarServerPostHandler(m_AvatarService, auth)); } } } diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs index d6bbb8f..59dbed4 100644 --- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs @@ -39,6 +39,7 @@ using System.Collections.Generic; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenMetaverse; @@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.Avatar private IAvatarService m_AvatarService; - public AvatarServerPostHandler(IAvatarService service) : - base("POST", "/avatar") + public AvatarServerPostHandler(IAvatarService service, IServiceAuth auth) : + base("POST", "/avatar", auth) { m_AvatarService = service; } diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs index fb4b794..9e703f1 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs @@ -38,6 +38,7 @@ using System.Xml.Serialization; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Server.Handlers.BakedTextures @@ -50,14 +51,14 @@ namespace OpenSim.Server.Handlers.BakedTextures private System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(); - public BakesServerGetHandler(IBakedTextureService service) : - base("GET", "/bakes") + public BakesServerGetHandler(IBakedTextureService service, IServiceAuth auth) : + base("GET", "/bakes", auth) { m_BakesService = service; } - public override byte[] Handle(string path, Stream request, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + protected override byte[] ProcessRequest( + string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { string[] p = SplitParams(path); diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs index 7bf7641..4c12967 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs @@ -29,6 +29,7 @@ using System; using Nini.Config; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; @@ -59,8 +60,10 @@ namespace OpenSim.Server.Handlers.BakedTextures m_BakesService = ServerUtils.LoadPlugin(assetService, args); - server.AddStreamHandler(new BakesServerGetHandler(m_BakesService)); - server.AddStreamHandler(new BakesServerPostHandler(m_BakesService)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + + server.AddStreamHandler(new BakesServerGetHandler(m_BakesService, auth)); + server.AddStreamHandler(new BakesServerPostHandler(m_BakesService, auth)); } } } diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs index 69adb7f..1aacbc9 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs @@ -38,27 +38,28 @@ using System.Xml.Serialization; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Server.Handlers.BakedTextures { public class BakesServerPostHandler : BaseStreamHandler { - // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IBakedTextureService m_BakesService; private System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(); - public BakesServerPostHandler(IBakedTextureService service) : - base("POST", "/bakes") + public BakesServerPostHandler(IBakedTextureService service, IServiceAuth auth) : + base("POST", "/bakes", auth) { m_BakesService = service; } - public override byte[] Handle(string path, Stream request, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + protected override byte[] ProcessRequest( + string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { string[] p = SplitParams(path); diff --git a/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs b/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs index 5784bdf..b0e6c7d 100644 --- a/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs +++ b/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs @@ -29,6 +29,7 @@ using System; using Nini.Config; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; @@ -55,7 +56,8 @@ namespace OpenSim.Server.Handlers.Friends Object[] args = new Object[] { config }; m_FriendsService = ServerUtils.LoadPlugin(theService, args); - server.AddStreamHandler(new FriendsServerPostHandler(m_FriendsService)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + server.AddStreamHandler(new FriendsServerPostHandler(m_FriendsService, auth)); } } } diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index ca0a24c..d442443 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs @@ -40,6 +40,7 @@ using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenMetaverse; @@ -51,8 +52,8 @@ namespace OpenSim.Server.Handlers.Friends private IFriendsService m_FriendsService; - public FriendsServerPostHandler(IFriendsService service) : - base("POST", "/friends") + public FriendsServerPostHandler(IFriendsService service, IServiceAuth auth) : + base("POST", "/friends", auth) { m_FriendsService = service; } diff --git a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs index 14daf12..6eb6a79 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs @@ -29,6 +29,7 @@ using System; using Nini.Config; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; @@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Grid Object[] args = new Object[] { config }; m_GridService = ServerUtils.LoadPlugin(gridService, args); - server.AddStreamHandler(new GridServerPostHandler(m_GridService)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + + server.AddStreamHandler(new GridServerPostHandler(m_GridService, auth)); } } } diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 37ca5a4..dda4756 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -40,6 +40,7 @@ using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenMetaverse; @@ -55,8 +56,8 @@ namespace OpenSim.Server.Handlers.Grid private IGridService m_GridService; - public GridServerPostHandler(IGridService service) : - base("POST", "/grid") + public GridServerPostHandler(IGridService service, IServiceAuth auth) : + base("POST", "/grid", auth) { m_GridService = service; } diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs index 66f35e3..1e29378 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs @@ -29,6 +29,7 @@ using System; using Nini.Config; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; @@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.GridUser Object[] args = new Object[] { config }; m_GridUserService = ServerUtils.LoadPlugin(service, args); - server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); ; + + server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService, auth)); } } } diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 0b98e9a..006f6ab 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs @@ -39,6 +39,7 @@ using System.Collections.Generic; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenMetaverse; @@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.GridUser private IGridUserService m_GridUserService; - public GridUserServerPostHandler(IGridUserService service) : - base("POST", "/griduser") + public GridUserServerPostHandler(IGridUserService service, IServiceAuth auth) : + base("POST", "/griduser", auth) { m_GridUserService = service; } diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index ce975a8..7283237 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -33,6 +33,7 @@ using System.Collections.Generic; using System.IO; using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; @@ -71,7 +72,9 @@ namespace OpenSim.Server.Handlers.Asset m_InventoryService = ServerUtils.LoadPlugin(inventoryService, args); - server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + + server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService, auth)); } } @@ -81,8 +84,8 @@ namespace OpenSim.Server.Handlers.Asset private IInventoryService m_InventoryService; - public XInventoryConnectorPostHandler(IInventoryService service) : - base("POST", "/xinventory") + public XInventoryConnectorPostHandler(IInventoryService service, IServiceAuth auth) : + base("POST", "/xinventory", auth) { m_InventoryService = service; } diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 4d1729e..a896fdb 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -38,6 +38,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; +using OpenSim.Framework.ServiceAuth; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; @@ -79,7 +80,8 @@ namespace OpenSim.Server.Handlers.MapImage m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF"); bool proxy = serverConfig.GetBoolean("HasProxy", false); - server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy, auth)); } } @@ -91,8 +93,8 @@ namespace OpenSim.Server.Handlers.MapImage private IGridService m_GridService; bool m_Proxy; - public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy) : - base("POST", "/map") + public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy, IServiceAuth auth) : + base("POST", "/map", auth) { m_MapService = service; m_GridService = grid; diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs b/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs index 899cd8f..7a63c36 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs @@ -30,6 +30,7 @@ using Nini.Config; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Handlers.Base; namespace OpenSim.Server.Handlers.Presence @@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Presence Object[] args = new Object[] { config }; m_PresenceService = ServerUtils.LoadPlugin(gridService, args); - server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + + server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService, auth)); } } } diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index abb4b19..0b3b961 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -40,6 +40,7 @@ using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Framework.ServiceAuth; using OpenMetaverse; namespace OpenSim.Server.Handlers.Presence @@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.Presence private IPresenceService m_PresenceService; - public PresenceServerPostHandler(IPresenceService service) : - base("POST", "/presence") + public PresenceServerPostHandler(IPresenceService service, IServiceAuth auth) : + base("POST", "/presence", auth) { m_PresenceService = service; } diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs index 344b513..e95e3dc 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs @@ -30,6 +30,7 @@ using Nini.Config; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Handlers.Base; namespace OpenSim.Server.Handlers.UserAccounts @@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.UserAccounts Object[] args = new Object[] { config }; m_UserAccountService = ServerUtils.LoadPlugin(service, args); - server.AddStreamHandler(new UserAccountServerPostHandler(m_UserAccountService, serverConfig)); + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + + server.AddStreamHandler(new UserAccountServerPostHandler(m_UserAccountService, serverConfig, auth)); } } } diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index 24c9de6..c87e022 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -41,6 +41,7 @@ using OpenSim.Services.Interfaces; using OpenSim.Services.UserAccountService; using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Framework.ServiceAuth; using OpenMetaverse; namespace OpenSim.Server.Handlers.UserAccounts @@ -54,10 +55,10 @@ namespace OpenSim.Server.Handlers.UserAccounts private bool m_AllowSetAccount = false; public UserAccountServerPostHandler(IUserAccountService service) - : this(service, null) {} + : this(service, null, null) {} - public UserAccountServerPostHandler(IUserAccountService service, IConfig config) : - base("POST", "/accounts") + public UserAccountServerPostHandler(IUserAccountService service, IConfig config, IServiceAuth auth) : + base("POST", "/accounts", auth) { m_UserAccountService = service; -- cgit v1.1 From 449548d7a4e3571597b5e4bec53e3f42ebdf6015 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 26 May 2014 08:13:49 -0700 Subject: Adds an optional redirect URL to the asset server handler for when assets are not found locally. --- .../Server/Handlers/Asset/AssetServerConnector.cs | 4 +++- .../Server/Handlers/Asset/AssetServerGetHandler.cs | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index df9a51b..ab81dd6 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs @@ -70,6 +70,8 @@ namespace OpenSim.Server.Handlers.Asset bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false); bool allowDeleteAllTypes = serverConfig.GetBoolean("AllowRemoteDeleteAllTypes", false); + string redirectURL = serverConfig.GetString("RedirectURL", string.Empty); + AllowedRemoteDeleteTypes allowedRemoteDeleteTypes; if (!allowDelete) @@ -86,7 +88,7 @@ namespace OpenSim.Server.Handlers.Asset IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); - server.AddStreamHandler(new AssetServerGetHandler(m_AssetService, auth)); + server.AddStreamHandler(new AssetServerGetHandler(m_AssetService, auth, redirectURL)); server.AddStreamHandler(new AssetServerPostHandler(m_AssetService, auth)); server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes, auth)); server.AddStreamHandler(new AssetsExistHandler(m_AssetService)); diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index 500ec50..91c5c54 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs @@ -48,6 +48,7 @@ namespace OpenSim.Server.Handlers.Asset private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IAssetService m_AssetService; + private string m_RedirectURL; public AssetServerGetHandler(IAssetService service) : base("GET", "/assets") @@ -55,10 +56,13 @@ namespace OpenSim.Server.Handlers.Asset m_AssetService = service; } - public AssetServerGetHandler(IAssetService service, IServiceAuth auth) : + public AssetServerGetHandler(IAssetService service, IServiceAuth auth, string redirectURL) : base("GET", "/assets", auth) { m_AssetService = service; + m_RedirectURL = redirectURL; + if (!m_RedirectURL.EndsWith("/")) + m_RedirectURL = m_RedirectURL.TrimEnd('/'); } protected override byte[] ProcessRequest(string path, Stream request, @@ -71,9 +75,10 @@ namespace OpenSim.Server.Handlers.Asset if (p.Length == 0) return result; + string id = string.Empty; if (p.Length > 1) { - string id = p[0]; + id = p[0]; string cmd = p[1]; if (cmd == "data") @@ -124,7 +129,7 @@ namespace OpenSim.Server.Handlers.Asset { // Get the entire asset (metadata + data) - string id = p[0]; + id = p[0]; AssetBase asset = m_AssetService.Get(id); if (asset != null) @@ -151,6 +156,16 @@ namespace OpenSim.Server.Handlers.Asset result = new byte[0]; } + if (httpResponse.StatusCode == (int)HttpStatusCode.NotFound && !string.IsNullOrEmpty(m_RedirectURL) && !string.IsNullOrEmpty(id)) + { + httpResponse.StatusCode = (int)HttpStatusCode.Redirect; + string rurl = m_RedirectURL; + if (!path.StartsWith("/")) + rurl += "/"; + rurl += path; + httpResponse.AddHeader("Location", rurl); + m_log.DebugFormat("[ASSET GET HANDLER]: Asset not found, redirecting to {0} ({1})", rurl, httpResponse.StatusCode); + } return result; } } -- cgit v1.1 From c32ccfb520cb979988c6bbdc195b0977cced3d06 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 27 May 2014 23:18:33 +0100 Subject: minor: Comment out 2 error level debugging message in authentication code --- .../Server/Handlers/Authentication/AuthenticationServerPostHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index e258dde..5d65f67 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs @@ -74,7 +74,7 @@ namespace OpenSim.Server.Handlers.Authentication protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - m_log.Error("[XXX]: Authenticating..."); +// m_log.Error("[XXX]: Authenticating..."); string[] p = SplitParams(path); if (p.Length > 0) -- cgit v1.1 From fe779128b0c50f44cf479444444754298d829910 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 6 Jun 2014 11:04:53 -0700 Subject: Added simulation version compatibility check so that agents coming from 0.7.6 to a varregion running in 0.8 and above will be denied teleport, rather than be allowed and crash the viewer. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 7291931..6d3a3a7 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -144,12 +144,16 @@ namespace OpenSim.Server.Handlers.Simulation if (args.ContainsKey("agent_home_uri")) agentHomeURI = args["agent_home_uri"].AsString(); + string theirVersion = string.Empty; + if (args.ContainsKey("my_version")) + theirVersion = args["my_version"].AsString(); + GridRegion destination = new GridRegion(); destination.RegionID = regionID; string reason; string version; - bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason); + bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, out version, out reason); responsedata["int_response_code"] = HttpStatusCode.OK; -- cgit v1.1 From 5450b1b0247bb3907f60f2b3f9b0582903de4f83 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 17 Jun 2014 18:37:15 +0100 Subject: Change assembly versions to 0.8.1 --- OpenSim/Server/Base/Properties/AssemblyInfo.cs | 2 +- OpenSim/Server/Handlers/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs index 67340c7..0d583f0 100644 --- a/OpenSim/Server/Base/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.8.0.*")] +[assembly: AssemblyVersion("0.8.1.*")] diff --git a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs index 04cd798..04fe41a 100644 --- a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.8.0.*")] +[assembly: AssemblyVersion("0.8.1.*")] -- cgit v1.1 From 94650c43cdfee1732856da00d64a0984173d6454 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 21 Jun 2014 00:08:39 +0200 Subject: Add forgotten file --- .../Handlers/Map/MapRemoveServerConnector.cs | 249 +++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs new file mode 100644 index 0000000..80e3535 --- /dev/null +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -0,0 +1,249 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +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 MapRemoveServiceConnector : 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 MapRemoveServiceConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) + { + IConfig serverConfig = config.Configs[m_ConfigName]; + if (serverConfig == null) + throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); + + string mapService = serverConfig.GetString("LocalServiceModule", + String.Empty); + + if (mapService == String.Empty) + throw new Exception("No LocalServiceModule in config file"); + + Object[] args = new Object[] { config }; + 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"); + + bool proxy = serverConfig.GetBoolean("HasProxy", false); + server.AddStreamHandler(new MapServerRemoveHandler(m_MapService, m_GridService, proxy)); + + } + } + + class MapServerRemoveHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private IMapImageService m_MapService; + private IGridService m_GridService; + bool m_Proxy; + + public MapServerRemoveHandler(IMapImageService service, IGridService grid, bool proxy) : + base("POST", "/removemap") + { + m_MapService = service; + m_GridService = grid; + m_Proxy = proxy; + } + + public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { +// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path); + StreamReader sr = new StreamReader(requestData); + string body = sr.ReadToEnd(); + sr.Close(); + body = body.Trim(); + + try + { + Dictionary request = ServerUtils.ParseQueryString(body); + + if (!request.ContainsKey("X") || !request.ContainsKey("Y")) + { + httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest; + return FailureResult("Bad request."); + } + int x = 0, y = 0; + Int32.TryParse(request["X"].ToString(), out x); + Int32.TryParse(request["Y"].ToString(), out y); + + m_log.DebugFormat("[MAP REMOVE SERVER CONNECTOR]: Received position data for region at {0}-{1}", x, y); + + 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) + { + 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"); + } + + } + else + { + m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}", + ipAddr, x, y); + return FailureResult("Region not found at given coordinates"); + } + } + + string reason = string.Empty; + bool result = m_MapService.RemoveMapTile(x, y, out reason); + + if (result) + return SuccessResult(); + else + return FailureResult(reason); + + } + catch (Exception e) + { + m_log.ErrorFormat("[MAP SERVICE IMAGE HANDLER]: Exception {0} {1}", e.Message, e.StackTrace); + } + + return FailureResult("Unexpected server error"); + } + + private byte[] SuccessResult() + { + XmlDocument doc = new XmlDocument(); + + XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, + "", ""); + + doc.AppendChild(xmlnode); + + XmlElement rootElement = doc.CreateElement("", "ServerResponse", + ""); + + doc.AppendChild(rootElement); + + XmlElement result = doc.CreateElement("", "Result", ""); + result.AppendChild(doc.CreateTextNode("Success")); + + rootElement.AppendChild(result); + + return DocToBytes(doc); + } + + private byte[] FailureResult(string msg) + { + XmlDocument doc = new XmlDocument(); + + XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, + "", ""); + + doc.AppendChild(xmlnode); + + XmlElement rootElement = doc.CreateElement("", "ServerResponse", + ""); + + doc.AppendChild(rootElement); + + XmlElement result = doc.CreateElement("", "Result", ""); + result.AppendChild(doc.CreateTextNode("Failure")); + + rootElement.AppendChild(result); + + XmlElement message = doc.CreateElement("", "Message", ""); + message.AppendChild(doc.CreateTextNode(msg)); + + rootElement.AppendChild(message); + + return DocToBytes(doc); + } + + private byte[] DocToBytes(XmlDocument doc) + { + MemoryStream ms = new MemoryStream(); + XmlTextWriter xw = new XmlTextWriter(ms, null); + xw.Formatting = Formatting.Indented; + doc.WriteTo(xw); + xw.Flush(); + + 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 99ac770abbe3a95887c4b10c82f3985aa878eeef Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 1 Jun 2014 17:39:11 +0300 Subject: Close streams immediately when we finish using them --- OpenSim/Server/Base/ServerUtils.cs | 20 ++++---- .../AuthenticationServerPostHandler.cs | 17 ++----- .../Handlers/Avatar/AvatarServerPostHandler.cs | 15 +----- .../Handlers/Friends/FriendsServerPostHandler.cs | 15 +----- .../Server/Handlers/Grid/GridServerPostHandler.cs | 15 +----- .../Handlers/GridUser/GridUserServerPostHandler.cs | 16 +------ .../Hypergrid/HGFriendsServerPostHandler.cs | 20 ++------ .../Handlers/Inventory/XInventoryInConnector.cs | 13 +----- .../Server/Handlers/Map/MapAddServerConnector.cs | 15 +----- .../Handlers/Presence/PresenceServerPostHandler.cs | 15 +----- .../Server/Handlers/Simulation/AgentHandlers.cs | 54 +++++++++++++++++----- .../UserAccounts/UserAccountServerPostHandler.cs | 15 +----- 12 files changed, 76 insertions(+), 154 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index c92e23c..8f1d56b 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -196,17 +196,19 @@ namespace OpenSim.Server.Base public static byte[] SerializeResult(XmlSerializer xs, object data) { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8); - xw.Formatting = Formatting.Indented; - xs.Serialize(xw, data); - xw.Flush(); + using (MemoryStream ms = new MemoryStream()) + using (XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8)) + { + xw.Formatting = Formatting.Indented; + xs.Serialize(xw, data); + xw.Flush(); - ms.Seek(0, SeekOrigin.Begin); - byte[] ret = ms.GetBuffer(); - Array.Resize(ref ret, (int)ms.Length); + ms.Seek(0, SeekOrigin.Begin); + byte[] ret = ms.GetBuffer(); + Array.Resize(ref ret, (int)ms.Length); - return ret; + return ret; + } } /// diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index 5d65f67..6ee98b3 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs @@ -209,7 +209,7 @@ namespace OpenSim.Server.Handlers.Authentication rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } byte[] GetAuthInfo(UUID principalID) @@ -279,7 +279,7 @@ namespace OpenSim.Server.Handlers.Authentication rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } private byte[] SuccessResult(string token) @@ -306,18 +306,7 @@ namespace OpenSim.Server.Handlers.Authentication rootElement.AppendChild(t); - return DocToBytes(doc); - } - - private byte[] DocToBytes(XmlDocument doc) - { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - - return ms.GetBuffer(); + return Util.DocToBytes(doc); } private byte[] ResultToBytes(Dictionary result) diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs index 59dbed4..ff8699f 100644 --- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs @@ -247,7 +247,7 @@ namespace OpenSim.Server.Handlers.Avatar rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } private byte[] FailureResult() @@ -269,18 +269,7 @@ namespace OpenSim.Server.Handlers.Avatar rootElement.AppendChild(result); - return DocToBytes(doc); - } - - private byte[] DocToBytes(XmlDocument doc) - { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - - return ms.ToArray(); + return Util.DocToBytes(doc); } } diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index d442443..3aab30b 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs @@ -229,7 +229,7 @@ namespace OpenSim.Server.Handlers.Friends rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } private byte[] FailureResult() @@ -261,18 +261,7 @@ namespace OpenSim.Server.Handlers.Friends rootElement.AppendChild(message); - return DocToBytes(doc); - } - - private byte[] DocToBytes(XmlDocument doc) - { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - - return ms.ToArray(); + return Util.DocToBytes(doc); } void FromKeyValuePairs(Dictionary kvp, out string principalID, out string friend, out int flags) diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index dda4756..d5a9d67 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -602,7 +602,7 @@ namespace OpenSim.Server.Handlers.Grid rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } private byte[] FailureResult() @@ -634,18 +634,7 @@ namespace OpenSim.Server.Handlers.Grid rootElement.AppendChild(message); - return DocToBytes(doc); - } - - private byte[] DocToBytes(XmlDocument doc) - { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - - return ms.ToArray(); + return Util.DocToBytes(doc); } #endregion diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 006f6ab..9237c63 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs @@ -279,7 +279,7 @@ namespace OpenSim.Server.Handlers.GridUser rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } private byte[] FailureResult() @@ -301,20 +301,8 @@ namespace OpenSim.Server.Handlers.GridUser rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } - private byte[] DocToBytes(XmlDocument doc) - { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - - return ms.ToArray(); - } - - } } diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index a2bdadb..37b47ed 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs @@ -335,7 +335,7 @@ namespace OpenSim.Server.Handlers.Hypergrid rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } private byte[] SuccessResult(string value) @@ -362,7 +362,7 @@ namespace OpenSim.Server.Handlers.Hypergrid rootElement.AppendChild(message); - return DocToBytes(doc); + return Util.DocToBytes(doc); } @@ -395,7 +395,7 @@ namespace OpenSim.Server.Handlers.Hypergrid rootElement.AppendChild(message); - return DocToBytes(doc); + return Util.DocToBytes(doc); } private byte[] BoolResult(bool value) @@ -417,21 +417,9 @@ namespace OpenSim.Server.Handlers.Hypergrid rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } - private byte[] DocToBytes(XmlDocument doc) - { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - - return ms.ToArray(); - } - - #endregion } } diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 7283237..0288fa6 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -191,18 +191,7 @@ namespace OpenSim.Server.Handlers.Asset rootElement.AppendChild(result); - return DocToBytes(doc); - } - - private byte[] DocToBytes(XmlDocument doc) - { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - - return ms.ToArray(); + return Util.DocToBytes(doc); } byte[] HandleCreateUserInventory(Dictionary request) diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index a896fdb..649a27e 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -188,7 +188,7 @@ namespace OpenSim.Server.Handlers.MapImage rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } private byte[] FailureResult(string msg) @@ -215,18 +215,7 @@ namespace OpenSim.Server.Handlers.MapImage rootElement.AppendChild(message); - return DocToBytes(doc); - } - - private byte[] DocToBytes(XmlDocument doc) - { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - - return ms.ToArray(); + return Util.DocToBytes(doc); } private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 0b3b961..49dbcb5 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -265,7 +265,7 @@ namespace OpenSim.Server.Handlers.Presence rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } private byte[] FailureResult() @@ -287,18 +287,7 @@ namespace OpenSim.Server.Handlers.Presence rootElement.AppendChild(result); - return DocToBytes(doc); - } - - private byte[] DocToBytes(XmlDocument doc) - { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - - return ms.ToArray(); + return Util.DocToBytes(doc); } } diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 6d3a3a7..da2bfeb 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -250,14 +250,30 @@ namespace OpenSim.Server.Handlers.Simulation return encoding.GetBytes("false"); } + string requestBody; + Stream inputStream = request; - if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) - inputStream = new GZipStream(inputStream, CompressionMode.Decompress); + Stream innerStream = null; + try + { + if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) + { + innerStream = inputStream; + inputStream = new GZipStream(innerStream, CompressionMode.Decompress); + } - StreamReader reader = new StreamReader(inputStream, encoding); + using (StreamReader reader = new StreamReader(inputStream, encoding)) + { + requestBody = reader.ReadToEnd(); + } + } + finally + { + if (innerStream != null) + innerStream.Dispose(); + inputStream.Dispose(); + } - string requestBody = reader.ReadToEnd(); - reader.Close(); keysvals.Add("body", requestBody); Hashtable responsedata = new Hashtable(); @@ -461,15 +477,31 @@ namespace OpenSim.Server.Handlers.Simulation keysvals.Add("headers", headervals); keysvals.Add("querystringkeys", querystringkeys); + String requestBody; + Encoding encoding = Encoding.UTF8; + Stream inputStream = request; - if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) - inputStream = new GZipStream(inputStream, CompressionMode.Decompress); + Stream innerStream = null; + try + { + if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) + { + innerStream = inputStream; + inputStream = new GZipStream(innerStream, CompressionMode.Decompress); + } - Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(inputStream, encoding); + using (StreamReader reader = new StreamReader(inputStream, encoding)) + { + requestBody = reader.ReadToEnd(); + } + } + finally + { + if (innerStream != null) + innerStream.Dispose(); + inputStream.Dispose(); + } - string requestBody = reader.ReadToEnd(); - reader.Close(); keysvals.Add("body", requestBody); httpResponse.StatusCode = 200; diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index c87e022..a77d78e 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -315,7 +315,7 @@ namespace OpenSim.Server.Handlers.UserAccounts rootElement.AppendChild(result); - return DocToBytes(doc); + return Util.DocToBytes(doc); } private byte[] FailureResult() @@ -337,18 +337,7 @@ namespace OpenSim.Server.Handlers.UserAccounts rootElement.AppendChild(result); - return DocToBytes(doc); - } - - private byte[] DocToBytes(XmlDocument doc) - { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - - return ms.ToArray(); + return Util.DocToBytes(doc); } private byte[] ResultToBytes(Dictionary result) -- cgit v1.1 From 4a9282e681f9b1a5410028b473af47d0896f81e6 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 21 Jul 2014 12:42:16 -0400 Subject: Add missing parts to profiles - classified delete --- OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index d55142e..6721b08 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -126,14 +126,14 @@ namespace OpenSim.Server.Handlers } OSDMap request = (OSDMap)json["params"]; - UUID classifiedId = new UUID(request["classifiedID"].AsString()); - - OSDMap res = new OSDMap(); - res["result"] = OSD.FromString("success"); - response.Result = res; - - return true; + UUID classifiedId = new UUID(request["classifiedId"].AsString()); + if(Service.ClassifiedDelete(classifiedId)) + return true; + + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = "data error removing record"; + return false; } public bool ClassifiedInfoRequest(OSDMap json, ref JsonRpcResponse response) -- cgit v1.1 From 36920adb9684b201ff9020dd825c448fb4e09613 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Jul 2014 23:58:30 +0100 Subject: minor: convert tabs to spaces that got in on recent commit 4a9282e --- OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index 6721b08..f8f1d00 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -128,12 +128,12 @@ namespace OpenSim.Server.Handlers OSDMap request = (OSDMap)json["params"]; UUID classifiedId = new UUID(request["classifiedId"].AsString()); - if(Service.ClassifiedDelete(classifiedId)) - return true; + if (Service.ClassifiedDelete(classifiedId)) + return true; - response.Error.Code = ErrorCode.InternalError; - response.Error.Message = "data error removing record"; - return false; + response.Error.Code = ErrorCode.InternalError; + response.Error.Message = "data error removing record"; + return false; } public bool ClassifiedInfoRequest(OSDMap json, ref JsonRpcResponse response) -- cgit v1.1 From e0d8f42e6be70974c1cdbf6ba3ff80c2eea7294d Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 30 Jul 2014 11:19:34 -0400 Subject: Simulator Extra Features Service Provide a means for regions to fetch extra features supported by modern viewers from a central location . --- .../Handlers/Grid/GridExtraFeaturesHandlers.cs | 118 +++++++++++++++++++++ .../Grid/GridExtraFeaturesServerInConnector.cs | 50 +++++++++ 2 files changed, 168 insertions(+) create mode 100644 OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs create mode 100644 OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs new file mode 100644 index 0000000..8b9890c --- /dev/null +++ b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs @@ -0,0 +1,118 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections; +using System.IO; +using System.Net; +using System.Reflection; +using System.Security; +using System.Text; +using log4net; +using Nini.Config; +using Nwc.XmlRpc; +using OpenSim.Framework; +using OpenSim.Framework.Servers.HttpServer; +using OpenMetaverse.StructuredData; + + +namespace OpenSim.Server.Handlers.Grid +{ + /// + /// Grid extra features handlers. + /// Allows grid level configuration of OpenSimExtra items. + /// Option to control region override of these settings. + /// + public class GridExtraFeaturesHandlers + { + private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Hashtable m_ExtraFeatures = new Hashtable(); + private bool m_AllowRegionOverride = true; + + public GridExtraFeaturesHandlers(IConfigSource configSource) + { + try + { + IConfig featuresCfg = configSource.Configs["GridExtraFeatures"]; + + foreach( string key in featuresCfg.GetKeys()) + { + if(key != "AllowRegionOverride") + { + string value = featuresCfg.GetString(key); + + // map the value to the viewer supported extra features + // add additional ones here as support is added in the viewer + // and place the configuration option in [GridExtraFeatures]. + switch(key) + { + case "SearchServerURI": + m_ExtraFeatures["search-server-url"] = value; + break; + case "MapImageServerURI": + m_ExtraFeatures["map-server-url"] = value; + break; + case "DestinationGuideURI": + m_ExtraFeatures["destination-guide-url"] = value; + break; + case "ExportSupported": + m_ExtraFeatures["ExportSupported"] = value; + break; + default: + m_Log.InfoFormat("{0} not yet supported."); + break; + } + } + else + m_AllowRegionOverride = featuresCfg.GetBoolean(key); + } + } + catch (Exception) + { + m_Log.Warn("[GRID EXTRA FEATURES SERVICE]: Cannot get grid features from config source, allowing region override"); + } + } + + public bool JsonGetGridFeaturesMethod(OSDMap json, ref JsonRpcResponse response) + { + OSDMap features = new OSDMap(); + OSDMap json_map = new OSDMap(); + + foreach (string key in m_ExtraFeatures.Keys) + { + features[key] = OSD.FromString(m_ExtraFeatures[key].ToString()); + } + + json_map["extra_features"] = features; + json_map["region_override"] = m_AllowRegionOverride.ToString(); + + response.Result = json_map; + + return true; + } + } +} \ No newline at end of file diff --git a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs new file mode 100644 index 0000000..f57a4b3 --- /dev/null +++ b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using log4net; +using OpenMetaverse; +using Nini.Config; +using OpenSim.Framework; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Base; + +namespace OpenSim.Server.Handlers.Grid +{ + public class GridExtraFeaturesServerInConnector : ServiceConnector + { + public GridExtraFeaturesServerInConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) + { + GridExtraFeaturesHandlers handler = new GridExtraFeaturesHandlers(config); + + server.AddJsonRPCHandler("get_extra_features", handler.JsonGetGridFeaturesMethod); + } + } +} -- cgit v1.1 From 3ec695e05b108dac3a3407d70750ca748c0dc00c Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 30 Jul 2014 15:01:26 -0400 Subject: Add Chat module extra feature settings to GridExtraFeatures service --- OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs index 8b9890c..6a62cfc 100644 --- a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs @@ -82,6 +82,15 @@ namespace OpenSim.Server.Handlers.Grid case "ExportSupported": m_ExtraFeatures["ExportSupported"] = value; break; + case "WhisperDistance": + m_ExtraFeatures["whisper-range"] = value; + break; + case "SayDistance": + m_ExtraFeatures["say-range"] = value; + break; + case "ShoutDistance": + m_ExtraFeatures["shout-range"] = value; + break; default: m_Log.InfoFormat("{0} not yet supported."); break; -- cgit v1.1 From 10a8d2852e529fddb029ae333a3ae6a0f06f0182 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 3 Aug 2014 20:33:40 -0400 Subject: OpenSimExtras Move the experimental extra features functionality into the GridService. This sends default values for map, search and destination guide, plus ExportSupported control to the region on startup. Please watch http://opensimulator.org/wiki/SimulatorFeatures_Extras for changes and documentation. --- .../Handlers/Grid/GridExtraFeaturesHandlers.cs | 127 --------------------- .../Grid/GridExtraFeaturesServerInConnector.cs | 50 -------- .../Server/Handlers/Grid/GridServerPostHandler.cs | 19 +++ 3 files changed, 19 insertions(+), 177 deletions(-) delete mode 100644 OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs delete mode 100644 OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs deleted file mode 100644 index 6a62cfc..0000000 --- a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections; -using System.IO; -using System.Net; -using System.Reflection; -using System.Security; -using System.Text; -using log4net; -using Nini.Config; -using Nwc.XmlRpc; -using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; -using OpenMetaverse.StructuredData; - - -namespace OpenSim.Server.Handlers.Grid -{ - /// - /// Grid extra features handlers. - /// Allows grid level configuration of OpenSimExtra items. - /// Option to control region override of these settings. - /// - public class GridExtraFeaturesHandlers - { - private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private Hashtable m_ExtraFeatures = new Hashtable(); - private bool m_AllowRegionOverride = true; - - public GridExtraFeaturesHandlers(IConfigSource configSource) - { - try - { - IConfig featuresCfg = configSource.Configs["GridExtraFeatures"]; - - foreach( string key in featuresCfg.GetKeys()) - { - if(key != "AllowRegionOverride") - { - string value = featuresCfg.GetString(key); - - // map the value to the viewer supported extra features - // add additional ones here as support is added in the viewer - // and place the configuration option in [GridExtraFeatures]. - switch(key) - { - case "SearchServerURI": - m_ExtraFeatures["search-server-url"] = value; - break; - case "MapImageServerURI": - m_ExtraFeatures["map-server-url"] = value; - break; - case "DestinationGuideURI": - m_ExtraFeatures["destination-guide-url"] = value; - break; - case "ExportSupported": - m_ExtraFeatures["ExportSupported"] = value; - break; - case "WhisperDistance": - m_ExtraFeatures["whisper-range"] = value; - break; - case "SayDistance": - m_ExtraFeatures["say-range"] = value; - break; - case "ShoutDistance": - m_ExtraFeatures["shout-range"] = value; - break; - default: - m_Log.InfoFormat("{0} not yet supported."); - break; - } - } - else - m_AllowRegionOverride = featuresCfg.GetBoolean(key); - } - } - catch (Exception) - { - m_Log.Warn("[GRID EXTRA FEATURES SERVICE]: Cannot get grid features from config source, allowing region override"); - } - } - - public bool JsonGetGridFeaturesMethod(OSDMap json, ref JsonRpcResponse response) - { - OSDMap features = new OSDMap(); - OSDMap json_map = new OSDMap(); - - foreach (string key in m_ExtraFeatures.Keys) - { - features[key] = OSD.FromString(m_ExtraFeatures[key].ToString()); - } - - json_map["extra_features"] = features; - json_map["region_override"] = m_AllowRegionOverride.ToString(); - - response.Result = json_map; - - return true; - } - } -} \ No newline at end of file diff --git a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs deleted file mode 100644 index f57a4b3..0000000 --- a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using log4net; -using OpenMetaverse; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Server.Handlers.Base; - -namespace OpenSim.Server.Handlers.Grid -{ - public class GridExtraFeaturesServerInConnector : ServiceConnector - { - public GridExtraFeaturesServerInConnector(IConfigSource config, IHttpServer server, string configName) : - base(config, server, configName) - { - GridExtraFeaturesHandlers handler = new GridExtraFeaturesHandlers(config); - - server.AddJsonRPCHandler("get_extra_features", handler.JsonGetGridFeaturesMethod); - } - } -} diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index d5a9d67..849fa94 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -122,6 +122,9 @@ namespace OpenSim.Server.Handlers.Grid case "get_region_flags": return GetRegionFlags(request); + + case "get_grid_extra_features": + return GetGridExtraFeatures(request); } m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method); @@ -578,6 +581,22 @@ namespace OpenSim.Server.Handlers.Grid //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); return Util.UTF8NoBomEncoding.GetBytes(xmlString); } + + byte[] GetGridExtraFeatures(Dictionary request) + { + + Dictionary result = new Dictionary (); + Dictionary extraFeatures = m_GridService.GetExtraFeatures (); + + foreach (string key in extraFeatures.Keys) + { + result [key] = extraFeatures [key]; + } + + string xmlString = ServerUtils.BuildXmlResponse(result); + + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + } #endregion -- cgit v1.1 From dabb8e62f434f6df71b90291960e71c7e16f50f5 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 13 Aug 2014 20:06:07 -0400 Subject: Update OpenID server handler with proper interface. fixes http://opensimulator.org/mantis/view.php?id=7301 --- OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs index 66a26fc..b201dc7 100644 --- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs @@ -147,7 +147,7 @@ namespace OpenSim.Server.Handlers.Authentication #endregion } - public class OpenIdStreamHandler : BaseOutputStreamHandler + public class OpenIdStreamHandler : BaseOutputStreamHandler, IStreamHandler { #region HTML -- cgit v1.1 From cbd7c7b9ecbe7bbe19d5c675322206bc8a977c5f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 23 Aug 2014 17:27:01 +0200 Subject: Change the map tile system to be multi-grid hosting compatible --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 5 ++++- OpenSim/Server/Handlers/Map/MapGetServerConnector.cs | 12 +++++++++++- OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs | 5 ++++- 3 files changed, 19 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index d438fc7..7ee347c 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -117,8 +117,11 @@ namespace OpenSim.Server.Handlers.MapImage return FailureResult("Bad request."); } int x = 0, y = 0; + UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); Int32.TryParse(request["X"].ToString(), out x); Int32.TryParse(request["Y"].ToString(), out y); + if (request.ContainsKey("SCOPE")) + UUID.TryParse(request["SCOPE"].ToString(), out scopeID); m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y); @@ -151,7 +154,7 @@ namespace OpenSim.Server.Handlers.MapImage byte[] data = Convert.FromBase64String(request["DATA"].ToString()); string reason = string.Empty; - bool result = m_MapService.AddMapTile(x, y, data, out reason); + bool result = m_MapService.AddMapTile(x, y, data, scopeID, out reason); if (result) return SuccessResult(); diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs index bd1ddbd..e2c8f35 100644 --- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs @@ -38,6 +38,7 @@ using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; +using OpenMetaverse; namespace OpenSim.Server.Handlers.MapImage { @@ -93,7 +94,16 @@ namespace OpenSim.Server.Handlers.MapImage byte[] result = new byte[0]; string format = string.Empty; - result = m_MapService.GetMapTile(path.Trim('/'), out format); + + UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); + + string[] bits = path.Trim('/').Split(new char[] {'/'}); + if (bits.Length > 1) + { + scopeID = new UUID(bits[0]); + path = bits[1]; + } + result = m_MapService.GetMapTile(path.Trim('/'), scopeID, out format); if (result.Length > 0) { httpResponse.StatusCode = (int)HttpStatusCode.OK; diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs index 80e3535..8a31579 100644 --- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -119,6 +119,9 @@ namespace OpenSim.Server.Handlers.MapImage int x = 0, y = 0; Int32.TryParse(request["X"].ToString(), out x); Int32.TryParse(request["Y"].ToString(), out y); + UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); + if (request.ContainsKey("SCOPE")) + UUID.TryParse(request["SCOPE"].ToString(), out scopeID); m_log.DebugFormat("[MAP REMOVE SERVER CONNECTOR]: Received position data for region at {0}-{1}", x, y); @@ -144,7 +147,7 @@ namespace OpenSim.Server.Handlers.MapImage } string reason = string.Empty; - bool result = m_MapService.RemoveMapTile(x, y, out reason); + bool result = m_MapService.RemoveMapTile(x, y, scopeID, out reason); if (result) return SuccessResult(); -- cgit v1.1 From 5f51abada98a0edfbfb6823abb0364f0620d0f97 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 23 Aug 2014 18:16:11 +0200 Subject: If GridUserService is asked for a nonexistent user, bail gracefully --- OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 0b98e9a..9199c68 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs @@ -184,6 +184,9 @@ namespace OpenSim.Server.Handlers.GridUser GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user); + if (guinfo == null) + return FailureResult(); + Dictionary result = new Dictionary(); if (guinfo != null) result["result"] = guinfo.ToKeyValuePairs(); -- cgit v1.1 From bde60cc92e0966177a1aeb03dce3183a92b7a38c Mon Sep 17 00:00:00 2001 From: Jak Daniels Date: Mon, 22 Sep 2014 16:54:12 +0100 Subject: Add persistent command history in console Signed-off-by: BlueWall --- OpenSim/Server/Base/ServicesServerBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 8352ee2..86a2551 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -158,7 +158,7 @@ namespace OpenSim.Server.Base } else { - MainConsole.Instance = new LocalConsole(prompt); + MainConsole.Instance = new LocalConsole(prompt, startupConfig); } m_console = MainConsole.Instance; -- cgit v1.1 From 68ea1f7776e5a3457dd995fb80cc10e77b122dad Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 Sep 2014 17:56:58 +0100 Subject: TEST do createAgent sync, forcing grid services and other regions to wait for it to complet. This is not that good, but maybe needed --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 964ccf8..62fe3c9 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -387,14 +387,19 @@ namespace OpenSim.Server.Handlers.Simulation protected virtual bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { reason = String.Empty; - +/* Util.FireAndForget(x => { string r; m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r); - }); + }); + return true; +*/ + + return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + } } -- cgit v1.1 From c9079360b9b44443a9394f6ee5fbff741e7ccced Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 Sep 2014 18:37:59 +0100 Subject: coment out stack trace at newUserConnection, add log msh at createAgent --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 62fe3c9..1087a71 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -397,8 +397,9 @@ namespace OpenSim.Server.Handlers.Simulation return true; */ - - return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + bool ret = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + m_log.DebugFormat("[AGENT HANDLER]: CreateAgent {0} {1}", ret.ToString(),reason); + return ret; } } -- cgit v1.1 From df773ee8c37d3d6c9de32d76cc0632298b30e93b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 Sep 2014 20:57:23 +0100 Subject: make CreateAgent sync for logins, async for other cases --- .../Server/Handlers/Simulation/AgentHandlers.cs | 31 +++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 1087a71..466b6f8 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -387,20 +387,25 @@ namespace OpenSim.Server.Handlers.Simulation protected virtual bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { reason = String.Empty; -/* - Util.FireAndForget(x => + if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0) { - string r; - m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r); - - }); - - return true; -*/ - bool ret = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); - m_log.DebugFormat("[AGENT HANDLER]: CreateAgent {0} {1}", ret.ToString(),reason); - return ret; - + Util.FireAndForget(x => + { + string r; + m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r); + m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0} {1}", r); + }); + + return true; + } + else + { + + bool ret = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason); + return ret; + } + } } -- cgit v1.1 From 45739e3d5ce0ba96bb2c9f2f226cfabf627f6028 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 24 Sep 2014 23:10:15 +0200 Subject: Fix a string format --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 466b6f8..ce0e120 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -393,7 +393,7 @@ namespace OpenSim.Server.Handlers.Simulation { string r; m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r); - m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0} {1}", r); + m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0}", r); }); return true; -- cgit v1.1 From c7a11899f6c5ade7d59b998d78dbe0ef8fbd317c Mon Sep 17 00:00:00 2001 From: BlueWall Date: Thu, 9 Oct 2014 14:20:08 -0400 Subject: Give ability to define constants that may be used throught the configuration --- OpenSim/Server/Base/ServicesServerBase.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 86a2551..d7d1306 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -129,6 +129,8 @@ namespace OpenSim.Server.Base // Merge the configuration from the command line into the loaded file Config.Merge(argvConfig); + Config.ReplaceKeyValues(); + // Refresh the startupConfig post merge if (Config.Configs["Startup"] != null) { -- cgit v1.1 From c19183932e8daae7a178ae034985365c7af2bcb6 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 13 Oct 2014 23:22:18 +0200 Subject: Set connection limit to 20 for all servers. --- OpenSim/Server/ServerMain.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 65e9287..a05effe 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -53,6 +53,10 @@ namespace OpenSim.Server public static int Main(string[] args) { + // Make sure we don't get outbound connections queueing + ServicePointManager.DefaultConnectionLimit = 50; + ServicePointManager.UseNagleAlgorithm = false; + m_Server = new HttpServerBase("R.O.B.U.S.T.", args); string registryLocation; -- cgit v1.1 From 0ecc41753467ee1115ef4fd2a5a7a1afccadc8b0 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 13 Oct 2014 23:24:47 +0200 Subject: Allow 20 outbound connections per endpoint for the services --- OpenSim/Server/ServerMain.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index a05effe..ed5a481 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -29,6 +29,7 @@ using Nini.Config; using log4net; using System.Reflection; using System; +using System.Net; using System.Collections.Generic; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; -- cgit v1.1 From fd79f75ba6766e1edc196a73dd05fc5f806f82b2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 24 Oct 2014 02:12:30 +0100 Subject: TEST**** wingridproxy detection at grid login. Untested possible not very reliable. Adds some load even on region servers because of code at BaseHttpServer. --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index f2a5678..5d672c3 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -132,8 +132,13 @@ namespace OpenSim.Server.Handlers.Login //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); + + bool LibOMVclient = false; + if (request.Params.Count > 4 && (string)request.Params[4] == "gridproxy") + LibOMVclient = true; + LoginResponse reply = null; - reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient); + reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient, LibOMVclient); XmlRpcResponse response = new XmlRpcResponse(); response.Value = reply.ToHashtable(); @@ -216,7 +221,7 @@ namespace OpenSim.Server.Handlers.Login LoginResponse reply = null; reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, - map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient); + map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient,false); return reply.ToOSDMap(); } @@ -259,7 +264,7 @@ namespace OpenSim.Server.Handlers.Login (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint(); LoginResponse reply = null; reply = m_LocalService.Login(first, last, passwd, start, scope, version, - channel, mac, id0, endPoint); + channel, mac, id0, endPoint,false); sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap())); } -- cgit v1.1 From fc878a33edcb403018e485ba0e8b7a6b3a8c3a16 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 8 Oct 2014 21:09:25 +0100 Subject: refactor: consistently put all test classes in the OpenSim.Tests.Common package rather than some in OpenSim.Tests.Common.Mock the separate mock package was not useful and was just another using line to always add --- OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs b/OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs index 427fa16..faa6fb7 100644 --- a/OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs +++ b/OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs @@ -39,7 +39,6 @@ using OpenSim.Server.Handlers.Asset; using OpenSim.Services.AssetService; using OpenSim.Services.Interfaces; using OpenSim.Tests.Common; -using OpenSim.Tests.Common.Mock; namespace OpenSim.Server.Handlers.Asset.Test { -- cgit v1.1 From d5ead532cb797f89411d2b253dc4f06aeb457942 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 9 Oct 2014 01:03:45 +0100 Subject: Remove compiler warning from UserProfilesHandlers --- OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index f8f1d00..d143552 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -263,8 +263,7 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Avatar Notes Request"); return false; } - - string result = string.Empty; + UserProfileNotes note = new UserProfileNotes(); object Note = (object)note; OSD.DeserializeMembers(ref Note, (OSDMap)json["params"]); -- cgit v1.1 From 0d77796584df0c041ef9893e52111f8572561145 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 9 Oct 2014 01:07:49 +0100 Subject: minor: resolve warnings from unused fields in XBakesGet and Post handlers --- OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs | 2 +- OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs index 9e703f1..3c61673 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs @@ -45,7 +45,7 @@ namespace OpenSim.Server.Handlers.BakedTextures { public class BakesServerGetHandler : BaseStreamHandler { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IBakedTextureService m_BakesService; private System.Text.UTF8Encoding utf8 = diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs index 1aacbc9..e38543b 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs @@ -45,13 +45,10 @@ namespace OpenSim.Server.Handlers.BakedTextures { public class BakesServerPostHandler : BaseStreamHandler { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IBakedTextureService m_BakesService; - private System.Text.UTF8Encoding utf8 = - new System.Text.UTF8Encoding(); - public BakesServerPostHandler(IBakedTextureService service, IServiceAuth auth) : base("POST", "/bakes", auth) { @@ -76,4 +73,4 @@ namespace OpenSim.Server.Handlers.BakedTextures return new byte[0]; } } -} +} \ No newline at end of file -- cgit v1.1 From f4424bdfcfb5db97d243b65ca30537410b9b2600 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 13 Oct 2014 23:57:46 +0100 Subject: If the port entry in [Network] for a server is missing, then actually tell the user that's the problem rather than simply exiting silently. Also exit with Environment.Exit(), not by aborting the thread. --- OpenSim/Server/Base/HttpServerBase.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 954783c..5dc9eed 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -56,15 +56,16 @@ namespace OpenSim.Server.Base if (networkConfig == null) { - System.Console.WriteLine("Section 'Network' not found, server can't start"); - Thread.CurrentThread.Abort(); + System.Console.WriteLine("ERROR: Section [Network] not found, server can't start"); + Environment.Exit(1); } uint port = (uint)networkConfig.GetInt("port", 0); if (port == 0) { - Thread.CurrentThread.Abort(); + System.Console.WriteLine("ERROR: No 'port' entry found in [Network]. Server can't start"); + Environment.Exit(1); } bool ssl_main = networkConfig.GetBoolean("https_main",false); @@ -93,13 +94,13 @@ namespace OpenSim.Server.Base if ( cert_path == String.Empty ) { System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); - Thread.CurrentThread.Abort(); + Environment.Exit(1); } string cert_pass = networkConfig.GetString("cert_pass",String.Empty); if ( cert_pass == String.Empty ) { System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); - Thread.CurrentThread.Abort(); + Environment.Exit(1); } httpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass); @@ -117,13 +118,13 @@ namespace OpenSim.Server.Base if ( cert_path == String.Empty ) { System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); - Thread.CurrentThread.Abort(); + Environment.Exit(1); } string cert_pass = networkConfig.GetString("cert_pass",String.Empty); if ( cert_pass == String.Empty ) { System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); - Thread.CurrentThread.Abort(); + Environment.Exit(1); } MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass)); -- cgit v1.1 From 90f9cea07b07f59e4b15557a8983f5c9049223c1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 14 Oct 2014 00:35:15 +0100 Subject: minor: be consistent about reporting errors out of HttpServerBase --- OpenSim/Server/Base/HttpServerBase.cs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 5dc9eed..44ef124 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -84,22 +84,23 @@ namespace OpenSim.Server.Base // Then, check for https settings and ADD a server to // m_Servers // - if ( !ssl_main ) + if (!ssl_main) { httpServer = new BaseHttpServer(port); } else { string cert_path = networkConfig.GetString("cert_path",String.Empty); - if ( cert_path == String.Empty ) + if (cert_path == String.Empty) { - System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); + System.Console.WriteLine("ERROR: Path to X509 certificate is missing, server can't start."); Environment.Exit(1); } + string cert_pass = networkConfig.GetString("cert_pass",String.Empty); - if ( cert_pass == String.Empty ) + if (cert_pass == String.Empty) { - System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); + System.Console.WriteLine("ERROR: Password for X509 certificate is missing, server can't start."); Environment.Exit(1); } @@ -110,20 +111,21 @@ namespace OpenSim.Server.Base MainServer.Instance = httpServer; // If https_listener = true, then add an ssl listener on the https_port... - if ( ssl_listener == true ) { - + if (ssl_listener == true) + { uint https_port = (uint)networkConfig.GetInt("https_port", 0); string cert_path = networkConfig.GetString("cert_path",String.Empty); - if ( cert_path == String.Empty ) + if (cert_path == String.Empty) { - System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); + System.Console.WriteLine("ERROR: Path to X509 certificate is missing, server can't start."); Environment.Exit(1); } + string cert_pass = networkConfig.GetString("cert_pass",String.Empty); - if ( cert_pass == String.Empty ) + if (cert_pass == String.Empty) { - System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); + System.Console.WriteLine("ERROR: Password for X509 certificate is missing, server can't start."); Environment.Exit(1); } -- cgit v1.1 From 8c9f82b03555306deb54601ba9a487336eb02203 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 31 Oct 2014 23:04:18 +0000 Subject: Just for now, don't alert the user or log if we couldn't change their server-side preferences due to no e-mail address being sent. This is to avoid user confusion in the oscc rehearsal as they are often not aware that this fails because no e-mail is set. Also may be failing in the hypergrid case, though this may also be a config issue. This is meant as a temporary solution. --- OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index d143552..49aa8ba 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -402,7 +402,7 @@ namespace OpenSim.Server.Handlers response.Error.Code = ErrorCode.InternalError; response.Error.Message = string.Format("{0}", result); - m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message); +// m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message); return false; } -- cgit v1.1 From ec8d21c434a39f46518ee9cf9f5539d1790eacc0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 4 Nov 2014 00:55:48 +0000 Subject: Label all threadpool calls being made in core OpenSimulator. This is to add problem diagnosis. "show threadpool calls" now also returns named (labelled), anonymous (unlabelled) and total call stats. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index da2bfeb..81c9df2 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -182,7 +182,8 @@ namespace OpenSim.Server.Handlers.Simulation if (action.Equals("release")) ReleaseAgent(regionID, id); else - Util.FireAndForget(delegate { m_SimulationService.CloseAgent(destination, id, auth_token); }); + Util.FireAndForget( + o => m_SimulationService.CloseAgent(destination, id, auth_token), null, "AgentHandler.DoAgentDelete"); responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); -- cgit v1.1 From 9edc5cac96eaf65eb0dac0f3697f01f9a5c02055 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 20 Dec 2014 01:32:49 +0000 Subject: In XBakes use proper disposal semantics to always close the stream on Store() no matter what --- OpenSim/Server/Handlers/BakedTextures/XBakes.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakes.cs b/OpenSim/Server/Handlers/BakedTextures/XBakes.cs index d1b2e12..4e55433 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakes.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakes.cs @@ -107,11 +107,9 @@ namespace OpenSim.Server.Handlers.BakedTextures File.Delete(diskFile); byte[] data = utf8encoding.GetBytes(sdata); - FileStream fs = File.Create(diskFile); - fs.Write(data, 0, data.Length); - - fs.Close(); + using (FileStream fs = File.Create(diskFile)) + fs.Write(data, 0, data.Length); } private void HandleDeleteBakes(string module, string[] args) -- cgit v1.1 From 7d1c59b8e3aac54a620171364f55fb66e4ba52e0 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 2 Jan 2015 09:15:30 -0800 Subject: Changed the Robust-as-addin version number to match OpenSim release numbers. --- OpenSim/Server/Base/ServerUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 8f1d56b..f6d26e4 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -41,7 +41,7 @@ using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers; -[assembly:AddinRoot("Robust", "0.1")] +[assembly:AddinRoot("Robust", OpenSim.VersionInfo.VersionNumber)] namespace OpenSim.Server.Base { [TypeExtensionPoint(Path="/Robust/Connector", Name="RobustConnector")] -- cgit v1.1 From 04e76dc5d695515d56d026b59d38f733f84f6d65 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 2 Jan 2015 21:47:23 -0800 Subject: Comment out the suppression of console output for mono addins in robust too. Seriously, ppl, let's not ignore important warning messages! --- OpenSim/Server/Base/ServerUtils.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index f6d26e4..c384406 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -89,9 +89,9 @@ namespace OpenSim.Server.Base Config = config; Registry = new AddinRegistry(registryPath, "."); - suppress_console_output_(true); + //suppress_console_output_(true); AddinManager.Initialize(registryPath); - suppress_console_output_(false); + //suppress_console_output_(false); AddinManager.Registry.Update(); CommandManager commandmanager = new CommandManager(Registry); AddinManager.AddExtensionNodeHandler("/Robust/Connector", OnExtensionChanged); -- cgit v1.1 From 8e562f04d1576bd51138ac656f796ba18965fdcf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 6 Jan 2015 21:24:44 -0800 Subject: Donation of robust network connectors for estate service, as promised. This allows to have one central database for estates without having to open the MySql port. This is off by default, so not to disturb everyone's existing installations. To use it, see GridCommon.ini.example [EstateDataStore] section and Robust*.ini.example's new additions. Note that I also made things consistent by removing both the EstateDataService and the SimulationService into their own dlls, just like all other services. They really didn't belong in Services.Connectors, since everything in that component is about network connectors to robust backends. We may have too many dlls, and at some point it might not be a bad idea to merge all services into one single dll, since they all have more or less the same dependencies. --- .../Handlers/Estate/EstateDataRobustConnector.cs | 345 +++++++++++++++++++++ 1 file changed, 345 insertions(+) create mode 100644 OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs b/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs new file mode 100644 index 0000000..4fe74f9 --- /dev/null +++ b/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs @@ -0,0 +1,345 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Net; + +using Nini.Config; +using log4net; +using OpenMetaverse; + +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Base; + +namespace OpenSim.Server.Handlers +{ + public class EstateDataRobustConnector : ServiceConnector + { + private string m_ConfigName = "EstateService"; + + public EstateDataRobustConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) + { + IConfig serverConfig = config.Configs[m_ConfigName]; + if (serverConfig == null) + throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); + + string service = serverConfig.GetString("LocalServiceModule", + String.Empty); + + if (service == String.Empty) + throw new Exception("No LocalServiceModule in config file"); + + Object[] args = new Object[] { config }; + IEstateDataService e_service = ServerUtils.LoadPlugin(service, args); + + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); ; + + server.AddStreamHandler(new EstateServerGetHandler(e_service, auth)); + server.AddStreamHandler(new EstateServerPostHandler(e_service, auth)); + } + } + + + public class EstateServerGetHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + IEstateDataService m_EstateService; + + // Possibilities + // /estates/estate/?region=uuid&create=[t|f] + // /estates/estate/?eid=int + // /estates/?name=string + // /estates/?owner=uuid + // /estates/ (all) + // /estates/regions/?eid=int + + public EstateServerGetHandler(IEstateDataService service, IServiceAuth auth) : + base("GET", "/estates", auth) + { + m_EstateService = service; + } + + protected override byte[] ProcessRequest(string path, Stream request, + IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + byte[] result = new byte[0]; + Dictionary data = null; + + string[] p = SplitParams(path); + + // /estates/ (all) + // /estates/?name=string + // /estates/?owner=uuid + if (p.Length == 0) + data = GetEstates(httpRequest, httpResponse); + else + { + string resource = p[0]; + + // /estates/estate/?region=uuid&create=[t|f] + // /estates/estate/?eid=int + if ("estate".Equals(resource)) + data = GetEstate(httpRequest, httpResponse); + // /estates/regions/?eid=int + else if ("regions".Equals(resource)) + data = GetRegions(httpRequest, httpResponse); + } + + if (data == null) + data = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(data); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + + } + + private Dictionary GetEstates(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + // /estates/ (all) + // /estates/?name=string + // /estates/?owner=uuid + + Dictionary data = null; + string name = (string)httpRequest.Query["name"]; + string owner = (string)httpRequest.Query["owner"]; + + if (!string.IsNullOrEmpty(name) || !string.IsNullOrEmpty(owner)) + { + List estateIDs = null; + if (!string.IsNullOrEmpty(name)) + { + estateIDs = m_EstateService.GetEstates(name); + } + else if (!string.IsNullOrEmpty(owner)) + { + UUID ownerID = UUID.Zero; + if (UUID.TryParse(owner, out ownerID)) + estateIDs = m_EstateService.GetEstatesByOwner(ownerID); + } + + if (estateIDs == null || (estateIDs != null && estateIDs.Count == 0)) + httpResponse.StatusCode = (int)HttpStatusCode.NotFound; + else + { + httpResponse.StatusCode = (int)HttpStatusCode.OK; + httpResponse.ContentType = "text/xml"; + data = new Dictionary(); + int i = 0; + foreach (int id in estateIDs) + data["estate" + i++] = id; + } + } + else + { + List estates = m_EstateService.LoadEstateSettingsAll(); + if (estates == null || estates.Count == 0) + { + httpResponse.StatusCode = (int)HttpStatusCode.NotFound; + } + else + { + httpResponse.StatusCode = (int)HttpStatusCode.OK; + httpResponse.ContentType = "text/xml"; + data = new Dictionary(); + int i = 0; + foreach (EstateSettings es in estates) + data["estate" + i++] = es.ToMap(); + + } + } + + return data; + } + + private Dictionary GetEstate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + // /estates/estate/?region=uuid&create=[t|f] + // /estates/estate/?eid=int + Dictionary data = null; + string region = (string)httpRequest.Query["region"]; + string eid = (string)httpRequest.Query["eid"]; + + EstateSettings estate = null; + + if (!string.IsNullOrEmpty(region)) + { + UUID regionID = UUID.Zero; + if (UUID.TryParse(region, out regionID)) + { + string create = (string)httpRequest.Query["create"]; + bool createYN = false; + Boolean.TryParse(create, out createYN); + estate = m_EstateService.LoadEstateSettings(regionID, createYN); + } + } + else if (!string.IsNullOrEmpty(eid)) + { + int id = 0; + if (Int32.TryParse(eid, out id)) + estate = m_EstateService.LoadEstateSettings(id); + } + + if (estate != null) + { + httpResponse.StatusCode = (int)HttpStatusCode.OK; + httpResponse.ContentType = "text/xml"; + data = estate.ToMap(); + } + else + httpResponse.StatusCode = (int)HttpStatusCode.NotFound; + + return data; + } + + private Dictionary GetRegions(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + // /estates/regions/?eid=int + Dictionary data = null; + string eid = (string)httpRequest.Query["eid"]; + + httpResponse.StatusCode = (int)HttpStatusCode.NotFound; + if (!string.IsNullOrEmpty(eid)) + { + int id = 0; + if (Int32.TryParse(eid, out id)) + { + List regions = m_EstateService.GetRegions(id); + if (regions != null && regions.Count > 0) + { + data = new Dictionary(); + int i = 0; + foreach (UUID uuid in regions) + data["region" + i++] = uuid.ToString(); + httpResponse.StatusCode = (int)HttpStatusCode.OK; + httpResponse.ContentType = "text/xml"; + } + } + } + + return data; + } + } + + public class EstateServerPostHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + IEstateDataService m_EstateService; + + // Possibilities + // /estates/estate/ (post an estate) + // /estates/estate/?eid=int®ion=uuid (link a region to an estate) + + public EstateServerPostHandler(IEstateDataService service, IServiceAuth auth) : + base("POST", "/estates", auth) + { + m_EstateService = service; + } + + protected override byte[] ProcessRequest(string path, Stream request, + IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + byte[] result = new byte[0]; + Dictionary data = null; + + string[] p = SplitParams(path); + + if (p.Length > 0) + { + string resource = p[0]; + + // /estates/estate/ + // /estates/estate/?eid=int®ion=uuid + if ("estate".Equals(resource)) + { + StreamReader sr = new StreamReader(request); + string body = sr.ReadToEnd(); + sr.Close(); + body = body.Trim(); + + Dictionary requestData = ServerUtils.ParseQueryString(body); + + data = UpdateEstate(requestData, httpRequest, httpResponse); + } + } + + if (data == null) + data = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(data); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + + } + + private Dictionary UpdateEstate(Dictionary requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + // /estates/estate/ + // /estates/estate/?eid=int®ion=uuid + Dictionary result = new Dictionary(); + string eid = (string)httpRequest.Query["eid"]; + string region = (string)httpRequest.Query["region"]; + + httpResponse.StatusCode = (int)HttpStatusCode.NotFound; + + if (string.IsNullOrEmpty(eid) && string.IsNullOrEmpty(region) && + requestData.ContainsKey("OP") && requestData["OP"] != null && "STORE".Equals(requestData["OP"])) + { + // /estates/estate/ + EstateSettings es = new EstateSettings(requestData); + m_EstateService.StoreEstateSettings(es); + //m_log.DebugFormat("[EstateServerPostHandler]: Store estate {0}", es.ToString()); + httpResponse.StatusCode = (int)HttpStatusCode.OK; + result["Result"] = true; + } + else if (!string.IsNullOrEmpty(region) && !string.IsNullOrEmpty(eid) && + requestData.ContainsKey("OP") && requestData["OP"] != null && "LINK".Equals(requestData["OP"])) + { + int id = 0; + UUID regionID = UUID.Zero; + if (UUID.TryParse(region, out regionID) && Int32.TryParse(eid, out id)) + { + m_log.DebugFormat("[EstateServerPostHandler]: Link region {0} to estate {1}", regionID, id); + httpResponse.StatusCode = (int)HttpStatusCode.OK; + result["Result"] = m_EstateService.LinkRegion(regionID, id); + } + } + else + m_log.WarnFormat("[EstateServerPostHandler]: something wrong with POST request {0}", httpRequest.RawUrl); + + return result; + } + + } +} -- cgit v1.1 From cf402812b74f02ca54435c81512db541e5cf13bd Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 10 Mar 2015 01:03:31 +0100 Subject: Fix content type checking to confirm to newer core versions --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index ce0e120..f912758 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -233,7 +233,7 @@ namespace OpenSim.Server.Handlers.Simulation Encoding encoding = Encoding.UTF8; Stream inputStream = null; - if (httpRequest.ContentType == "application/x-gzip") + if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) inputStream = new GZipStream(request, CompressionMode.Decompress); else if (httpRequest.ContentType == "application/json") inputStream = request; -- cgit v1.1 From fec2527e6c2876014b208b49407aa7c30c7e1ba3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 14 Mar 2015 00:18:35 +0000 Subject: minor: fix compiler warnings in EstateDataRobustConnector --- OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs b/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs index 4fe74f9..e0c2810 100644 --- a/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs +++ b/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs @@ -73,7 +73,7 @@ namespace OpenSim.Server.Handlers public class EstateServerGetHandler : BaseStreamHandler { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); IEstateDataService m_EstateService; @@ -94,7 +94,6 @@ namespace OpenSim.Server.Handlers protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - byte[] result = new byte[0]; Dictionary data = null; string[] p = SplitParams(path); @@ -271,7 +270,6 @@ namespace OpenSim.Server.Handlers protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - byte[] result = new byte[0]; Dictionary data = null; string[] p = SplitParams(path); -- cgit v1.1 From 07dead7dcb8b0f2a27a50748e4a460d9669903fc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 29 Mar 2015 14:25:12 -0700 Subject: varregion: any conversions of use of Constants.RegionSize converted into Util.cs routines to convert region coords to and from world coords or handles. --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 2 +- OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs | 2 +- 2 files 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 7ee347c..d2fbfa6 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 (m_GridService != null) { System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); - GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize); + GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y)); if (r != null) { if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs index 8a31579..88d774a 100644 --- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -128,7 +128,7 @@ 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); + GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y)); if (r != null) { if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) -- cgit v1.1 From da32512ea449c2de2d4a6069f899fbd4a8bb03fa Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 29 Apr 2015 18:47:17 -0700 Subject: Updated all occurrences of AssemblyVersion("0.8.1.*") to AssemblyVersion("0.8.2.*") --- OpenSim/Server/Base/Properties/AssemblyInfo.cs | 2 +- OpenSim/Server/Handlers/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs index 0d583f0..e819a2b 100644 --- a/OpenSim/Server/Base/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.8.1.*")] +[assembly: AssemblyVersion("0.8.2.*")] diff --git a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs index 04fe41a..780e454 100644 --- a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.8.1.*")] +[assembly: AssemblyVersion("0.8.2.*")] -- cgit v1.1 From c74cef0f4261191962959e42c7e349adafd42a04 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 7 May 2015 19:24:08 -0700 Subject: Major change in the way inventory is downloaded: added a method throughout IIventoryService that fetches sets of folders at once. Also added folder id in the InventoryCollection data structure, so that we don't need to go to inventory server again just for that. This reduces the chatter between sims and inventory server by... a lot. On my tests, this reduces initial inventory download down to 30% of what it currently is. --- .../Handlers/Inventory/XInventoryInConnector.cs | 74 +++++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 0288fa6..4f01e36 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -41,7 +41,9 @@ using OpenSim.Server.Handlers.Base; using log4net; using OpenMetaverse; -namespace OpenSim.Server.Handlers.Asset +using System.Threading; + +namespace OpenSim.Server.Handlers.Inventory { public class XInventoryInConnector : ServiceConnector { @@ -123,6 +125,8 @@ namespace OpenSim.Server.Handlers.Asset return HandleGetFolderForType(request); case "GETFOLDERCONTENT": return HandleGetFolderContent(request); + case "GETMULTIPLEFOLDERSCONTENT": + return HandleGetMultipleFoldersContent(request); case "GETFOLDERITEMS": return HandleGetFolderItems(request); case "ADDFOLDER": @@ -284,6 +288,8 @@ namespace OpenSim.Server.Handlers.Asset InventoryCollection icoll = m_InventoryService.GetFolderContent(principal, folderID); if (icoll != null) { + result["FID"] = icoll.FolderID.ToString(); + result["VERSION"] = icoll.Version.ToString(); Dictionary folders = new Dictionary(); int i = 0; if (icoll.Folders != null) @@ -314,7 +320,71 @@ namespace OpenSim.Server.Handlers.Asset return Util.UTF8NoBomEncoding.GetBytes(xmlString); } - byte[] HandleGetFolderItems(Dictionary request) + byte[] HandleGetMultipleFoldersContent(Dictionary request) + { + Dictionary resultSet = new Dictionary(); + UUID principal = UUID.Zero; + UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); + string folderIDstr = request["FOLDERS"].ToString(); + int count = 0; + Int32.TryParse(request["COUNT"].ToString(), out count); + + UUID[] fids = new UUID[count]; + string[] uuids = folderIDstr.Split(','); + int i = 0; + foreach (string id in uuids) + { + UUID fid = UUID.Zero; + if (UUID.TryParse(id, out fid)) + fids[i] = fid; + i += 1; + } + + count = 0; + InventoryCollection[] icollList = m_InventoryService.GetMultipleFoldersContent(principal, fids); + if (icollList != null && icollList.Length > 0) + { + foreach (InventoryCollection icoll in icollList) + { + Dictionary result = new Dictionary(); + result["FID"] = icoll.FolderID.ToString(); + result["VERSION"] = icoll.Version.ToString(); + result["OWNER"] = icoll.OwnerID.ToString(); + Dictionary folders = new Dictionary(); + i = 0; + if (icoll.Folders != null) + { + foreach (InventoryFolderBase f in icoll.Folders) + { + folders["folder_" + i.ToString()] = EncodeFolder(f); + i++; + } + result["FOLDERS"] = folders; + } + i = 0; + if (icoll.Items != null) + { + Dictionary items = new Dictionary(); + foreach (InventoryItemBase it in icoll.Items) + { + items["item_" + i.ToString()] = EncodeItem(it); + i++; + } + result["ITEMS"] = items; + } + + resultSet["F_" + fids[count++]] = result; + //m_log.DebugFormat("[XXX]: Sending {0} {1}", fids[count-1], icoll.FolderID); + } + } + + string xmlString = ServerUtils.BuildXmlResponse(resultSet); + + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + } + + byte[] HandleGetFolderItems(Dictionary request) { Dictionary result = new Dictionary(); UUID principal = UUID.Zero; -- cgit v1.1 From 0bf1209f908bb9a384ddb3a4255a75bf2317c478 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 8 May 2015 20:53:28 -0700 Subject: Another major overhaul of inventory downloading, this time pertaining to inventory links. Added yet another function to IInventoryService to get multiple items at once, so that fetching collections of linked items is done once per folder instead of once per item. --- .../Handlers/Inventory/XInventoryInConnector.cs | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 4f01e36..cf0762b 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -149,6 +149,8 @@ namespace OpenSim.Server.Handlers.Inventory return HandleDeleteItems(request); case "GETITEM": return HandleGetItem(request); + case "GETMULTIPLEITEMS": + return HandleGetMultipleItems(request); case "GETFOLDER": return HandleGetFolder(request); case "GETACTIVEGESTURES": @@ -576,6 +578,40 @@ namespace OpenSim.Server.Handlers.Inventory return Util.UTF8NoBomEncoding.GetBytes(xmlString); } + byte[] HandleGetMultipleItems(Dictionary request) + { + Dictionary resultSet = new Dictionary(); + UUID principal = UUID.Zero; + UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); + string itemIDstr = request["ITEMS"].ToString(); + int count = 0; + Int32.TryParse(request["COUNT"].ToString(), out count); + + UUID[] fids = new UUID[count]; + string[] uuids = itemIDstr.Split(','); + int i = 0; + foreach (string id in uuids) + { + UUID fid = UUID.Zero; + if (UUID.TryParse(id, out fid)) + fids[i] = fid; + i += 1; + } + + InventoryItemBase[] itemsList = m_InventoryService.GetMultipleItems(principal, fids); + if (itemsList != null && itemsList.Length > 0) + { + count = 0; + foreach (InventoryItemBase item in itemsList) + resultSet["item_" + count++] = (item == null) ? (object)"NULL" : EncodeItem(item); + } + + string xmlString = ServerUtils.BuildXmlResponse(resultSet); + + //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + } + byte[] HandleGetFolder(Dictionary request) { Dictionary result = new Dictionary(); -- cgit v1.1 From c2cf22ea4fc42d8582aa6aa2df48a3ce06813d56 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 10 May 2015 21:04:46 -0700 Subject: Added the beginning of a new test framework for robust connectors and services. For now, just Grid and Presence. This framework starts a robust server (as a thread) listening on a port in localhost, then the tests are client code. --- OpenSim/Server/Base/ServicesServerBase.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index d7d1306..1f2c54d 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -82,7 +82,9 @@ namespace OpenSim.Server.Base argvConfig.AddSwitch("Startup", "logconfig", "g"); // Automagically create the ini file name - string fileName = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location); + string fileName = ""; + if (Assembly.GetEntryAssembly() != null) + fileName = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location); string iniFile = fileName + ".ini"; string logConfig = null; @@ -158,7 +160,11 @@ namespace OpenSim.Server.Base MainConsole.Instance = new RemoteConsole(prompt); ((RemoteConsole)MainConsole.Instance).ReadConfig(Config); } - else + else if (consoleType == "mock") + { + MainConsole.Instance = new MockConsole(); + } + else if (consoleType == "local") { MainConsole.Instance = new LocalConsole(prompt, startupConfig); } -- cgit v1.1 From 923a57a91fa9629a844da6cd59ca8e9d2b0fbcde Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 11 May 2015 19:55:23 -0700 Subject: Added tests for UserAccountService in Robust. In the process fixed a couple of bugs in the network connectors. For some reason the robust-bound code had a CreateUser method, while the client-bound code had no such method. I assume someone is extending the client-side code with their own connectors. I added the missing method, but didn't add it to the service interface. --- OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index a77d78e..21eb790 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -257,8 +257,7 @@ namespace OpenSim.Server.Handlers.UserAccounts byte[] CreateUser(Dictionary request) { - if (! - request.ContainsKey("FirstName") + if (! request.ContainsKey("FirstName") && request.ContainsKey("LastName") && request.ContainsKey("Password")) return FailureResult(); -- cgit v1.1 From 0fa94f222df8ed7f308730c3692bf2a774138718 Mon Sep 17 00:00:00 2001 From: Cinder Date: Fri, 12 Jun 2015 18:48:07 -0600 Subject: Refactor AgentPreferences so that database operations happen centrally. the opensim way. Signed-off-by: Diva Canto --- .../AgentPreferencesServerPostHandler.cs | 206 +++++++++++++++++++++ .../AgentPreferencesServiceConnector.cs | 64 +++++++ 2 files changed, 270 insertions(+) create mode 100644 OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs create mode 100644 OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServiceConnector.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs b/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs new file mode 100644 index 0000000..713b755 --- /dev/null +++ b/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs @@ -0,0 +1,206 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using Nini.Config; +using log4net; +using System; +using System.Reflection; +using System.IO; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; +using System.Xml.Serialization; +using System.Collections.Generic; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; +using OpenSim.Framework.Servers.HttpServer; +using OpenMetaverse; + +namespace OpenSim.Server.Handlers.AgentPreferences +{ + public class AgentPreferencesServerPostHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private IAgentPreferencesService m_AgentPreferencesService; + + public AgentPreferencesServerPostHandler(IAgentPreferencesService service, IServiceAuth auth) : + base("POST", "/agentprefs", auth) + { + m_AgentPreferencesService = service; + } + + protected override byte[] ProcessRequest(string path, Stream requestData, + IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + StreamReader sr = new StreamReader(requestData); + string body = sr.ReadToEnd(); + sr.Close(); + body = body.Trim(); + + //m_log.DebugFormat("[XXX]: query String: {0}", body); + + try + { + Dictionary request = + ServerUtils.ParseQueryString(body); + + if (!request.ContainsKey("METHOD")) + return FailureResult(); + + string method = request["METHOD"].ToString(); + + switch (method) + { + case "getagentprefs": + return GetAgentPrefs(request); + case "setagentprefs": + return SetAgentPrefs(request); + case "getagentlang": + return GetAgentLang(request); + } + m_log.DebugFormat("[AGENT PREFERENCES HANDLER]: unknown method request: {0}", method); + } + catch (Exception e) + { + m_log.DebugFormat("[AGENT PREFERENCES HANDLER]: Exception {0}", e); + } + + return FailureResult(); + } + + byte[] GetAgentPrefs(Dictionary request) + { + if (!request.ContainsKey("UserID")) + return FailureResult(); + + UUID userID; + if (!UUID.TryParse(request["UserID"].ToString(), out userID)) + return FailureResult(); + AgentPrefs prefs = m_AgentPreferencesService.GetAgentPreferences(userID); + Dictionary result = new Dictionary(); + result = prefs.ToKeyValuePairs(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + } + + byte[] SetAgentPrefs(Dictionary request) + { + if (!request.ContainsKey("PrincipalID") || !request.ContainsKey("AccessPrefs") || !request.ContainsKey("HoverHeight") + || !request.ContainsKey("Language") || !request.ContainsKey("LanguageIsPublic") || !request.ContainsKey("PermEveryone") + || !request.ContainsKey("PermGroup") || !request.ContainsKey("PermNextOwner")) + { + return FailureResult(); + } + + UUID userID; + if (!UUID.TryParse(request["PrincipalID"].ToString(), out userID)) + return FailureResult(); + + AgentPrefs data = new AgentPrefs(userID); + data.AccessPrefs = request["AccessPrefs"].ToString(); + data.HoverHeight = double.Parse(request["HoverHeight"].ToString()); + data.Language = request["Language"].ToString(); + data.LanguageIsPublic = bool.Parse(request["LanguageIsPublic"].ToString()); + data.PermEveryone = int.Parse(request["PermEveryone"].ToString()); + data.PermGroup = int.Parse(request["PermGroup"].ToString()); + data.PermNextOwner = int.Parse(request["PermNextOwner"].ToString()); + + return m_AgentPreferencesService.StoreAgentPreferences(data) ? SuccessResult() : FailureResult(); + } + + byte[] GetAgentLang(Dictionary request) + { + if (!request.ContainsKey("UserID")) + return FailureResult(); + UUID userID; + if (!UUID.TryParse(request["UserID"].ToString(), out userID)) + return FailureResult(); + + string lang = "en-us"; + AgentPrefs prefs = m_AgentPreferencesService.GetAgentPreferences(userID); + if (prefs != null) + { + if (prefs.LanguageIsPublic) + lang = prefs.Language; + } + Dictionary result = new Dictionary(); + result["Language"] = lang; + string xmlString = ServerUtils.BuildXmlResponse(result); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + } + + private byte[] SuccessResult() + { + XmlDocument doc = new XmlDocument(); + + XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, + "", ""); + + doc.AppendChild(xmlnode); + + XmlElement rootElement = doc.CreateElement("", "ServerResponse", + ""); + + doc.AppendChild(rootElement); + + XmlElement result = doc.CreateElement("", "result", ""); + result.AppendChild(doc.CreateTextNode("Success")); + + rootElement.AppendChild(result); + + return Util.DocToBytes(doc); + } + + private byte[] FailureResult() + { + XmlDocument doc = new XmlDocument(); + + XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, + "", ""); + + doc.AppendChild(xmlnode); + + XmlElement rootElement = doc.CreateElement("", "ServerResponse", + ""); + + doc.AppendChild(rootElement); + + XmlElement result = doc.CreateElement("", "result", ""); + result.AppendChild(doc.CreateTextNode("Failure")); + + rootElement.AppendChild(result); + + return Util.DocToBytes(doc); + } + } +} diff --git a/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServiceConnector.cs b/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServiceConnector.cs new file mode 100644 index 0000000..a581ea2 --- /dev/null +++ b/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServiceConnector.cs @@ -0,0 +1,64 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +using System; +using Nini.Config; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework.ServiceAuth; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Base; + +namespace OpenSim.Server.Handlers.AgentPreferences +{ + public class AgentPreferencesServiceConnector : ServiceConnector + { + private IAgentPreferencesService m_AgentPreferencesService; + private string m_ConfigName = "AgentPreferencesService"; + + public AgentPreferencesServiceConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) + { + IConfig serverConfig = config.Configs[m_ConfigName]; + if (serverConfig == null) + throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); + + string service = serverConfig.GetString("LocalServiceModule", String.Empty); + + if (String.IsNullOrWhiteSpace(service)) + throw new Exception("No LocalServiceModule in config file"); + + Object[] args = new Object[] { config }; + m_AgentPreferencesService = ServerUtils.LoadPlugin(service, args); + + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); ; + + server.AddStreamHandler(new AgentPreferencesServerPostHandler(m_AgentPreferencesService, auth)); + } + } +} -- cgit v1.1 From 14b4d8bad796527a05a5f5992d1a1df1c5c43e6f Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Fri, 31 Jul 2015 18:13:39 +0300 Subject: Eliminated several warnings --- OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs | 2 ++ OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs | 2 ++ 2 files changed, 4 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs index 06eaf2e..dac4ca8 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs @@ -44,7 +44,9 @@ namespace OpenSim.Server.Handlers.Hypergrid public HeloServiceInConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) { +#pragma warning disable 0612 server.AddStreamHandler(new HeloServerGetHandler("opensim-robust")); +#pragma warning restore 0612 server.AddStreamHandler(new HeloServerHeadHandler("opensim-robust")); } } diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index 15b5b31..e112e0e 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -99,8 +99,10 @@ namespace OpenSim.Server.Handlers.Hypergrid server.AddXmlRPCHandler("verify_client", VerifyClient, false); server.AddXmlRPCHandler("logout_agent", LogoutAgent, false); +#pragma warning disable 0612 server.AddXmlRPCHandler("status_notification", StatusNotification, false); server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false); +#pragma warning restore 0612 server.AddXmlRPCHandler("get_user_info", GetUserInfo, false); server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false); -- cgit v1.1 From 959872315f67a1a33a2bae7330749f7dd74a4774 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 8 Aug 2015 12:12:50 -0700 Subject: WARNING: massive refactor to follow libomv's latest changes regarding inventory folders. The newest version of libomv itself is committed here. Basically, everything that was using the AssetType enum has been combed through; many of those uses were changed to the new FolderType enum. This means that from now on, [new] root folders have code 8 (FolderType.Root), as the viewers expect, as opposed to 9, which was what we had been doing. Normal folders are as they were, -1. Also now sending folder code 100 for Suitcase folders to viewers, with no filter. All tests pass, but fingers crossed! --- OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index cf0762b..5c4e7a9 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -269,7 +269,7 @@ namespace OpenSim.Server.Handlers.Inventory UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); int type = 0; Int32.TryParse(request["TYPE"].ToString(), out type); - InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (AssetType)type); + InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (FolderType)type); if (folder != null) result["folder"] = EncodeFolder(folder); -- cgit v1.1 From 4cbbbefbf63f6cab4241563ebf56c6b0bea30ed3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 15 Aug 2015 16:08:14 -0700 Subject: Removed ignoreCase=true from the call to Type.GetInterface, because, well, we don't want to ignore case. And this seems to be causing problems in mono 4.3. --- OpenSim/Server/Base/ServerUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index c384406..18a4266 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -268,7 +268,7 @@ namespace OpenSim.Server.Base && pluginType.ToString() != pluginType.Namespace + "." + className) continue; - Type typeInterface = pluginType.GetInterface(interfaceName, true); + Type typeInterface = pluginType.GetInterface(interfaceName); if (typeInterface != null) { -- cgit v1.1 From 028506cf3cecb3666b0c185d9c25e21bab968c93 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 20 Aug 2015 00:18:45 +0200 Subject: Partial plumbing for the agent stateful module features negotiation --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 81c9df2..68cec4b 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -27,6 +27,7 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Collections.Specialized; using System.IO; using System.IO.Compression; @@ -148,12 +149,22 @@ namespace OpenSim.Server.Handlers.Simulation if (args.ContainsKey("my_version")) theirVersion = args["my_version"].AsString(); + List features = new List(); + + if (args.ContainsKey("features")) + { + OSDArray array = (OSDArray)args["features"]; + + foreach (OSD o in array) + features.Add(new UUID(o.AsString())); + } + GridRegion destination = new GridRegion(); destination.RegionID = regionID; string reason; string version; - bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, out version, out reason); + bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, features, out version, out reason); responsedata["int_response_code"] = HttpStatusCode.OK; -- cgit v1.1 From 17e920aacd800cf8f81ac705c5047723434fe974 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 20 Aug 2015 00:40:49 +0200 Subject: More plumbing on agent states --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 68cec4b..e7544b5 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -174,6 +174,12 @@ namespace OpenSim.Server.Handlers.Simulation resp["reason"] = OSD.FromString(reason); resp["version"] = OSD.FromString(version); + OSDArray featuresWanted = new OSDArray(); + foreach (UUID feature in features) + featuresWanted.Add(OSD.FromString(feature.ToString())); + + resp["features"] = featuresWanted; + // 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); -- cgit v1.1 From ce883e9b436a0d63cfe1d5c81f83477a266e727e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Aug 2015 05:29:08 +0100 Subject: add more of the v03 checks and homeURL. Sending side only for now --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index f912758..76b593a 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -117,7 +117,7 @@ namespace OpenSim.Server.Handlers.Simulation } - protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) + protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID) { if (m_SimulationService == null) { @@ -132,16 +132,28 @@ namespace OpenSim.Server.Handlers.Simulation // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); OSDMap args = Utils.GetOSDMap((string)request["body"]); + bool viaTeleport = true; + if (args.ContainsKey("viaTeleport")) + viaTeleport = args["viaTeleport"].AsBoolean(); + Vector3 position = Vector3.Zero; if (args.ContainsKey("position")) position = Vector3.Parse(args["position"].AsString()); + string agentHomeURI = null; + if (args.ContainsKey("agent_home_uri")) + agentHomeURI = args["agent_home_uri"].AsString(); + + string theirVersion = string.Empty; + if (args.ContainsKey("my_version")) + theirVersion = args["my_version"].AsString(); + GridRegion destination = new GridRegion(); destination.RegionID = regionID; string reason; string version; - bool result = m_SimulationService.QueryAccess(destination, id, position, out version, out reason); + bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, out version, out reason); responsedata["int_response_code"] = HttpStatusCode.OK; -- cgit v1.1 From f31f9002de555d8277a6d4cc008bba4069e7cadc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 29 Aug 2015 00:32:36 +0100 Subject: change default scopeID to UUID.Zero --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 3 ++- OpenSim/Server/Handlers/Map/MapGetServerConnector.cs | 3 ++- OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index d2fbfa6..ea68114 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -117,7 +117,8 @@ namespace OpenSim.Server.Handlers.MapImage return FailureResult("Bad request."); } int x = 0, y = 0; - UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); +// UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); + UUID scopeID = UUID.Zero; Int32.TryParse(request["X"].ToString(), out x); Int32.TryParse(request["Y"].ToString(), out y); if (request.ContainsKey("SCOPE")) diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs index e2c8f35..1ae669c 100644 --- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs @@ -95,7 +95,8 @@ namespace OpenSim.Server.Handlers.MapImage byte[] result = new byte[0]; string format = string.Empty; - UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); +// UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); + UUID scopeID = UUID.Zero; string[] bits = path.Trim('/').Split(new char[] {'/'}); if (bits.Length > 1) diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs index 88d774a..4f8f7e1 100644 --- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -119,7 +119,8 @@ namespace OpenSim.Server.Handlers.MapImage int x = 0, y = 0; Int32.TryParse(request["X"].ToString(), out x); Int32.TryParse(request["Y"].ToString(), out y); - UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); +// UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); + UUID scopeID = UUID.Zero; if (request.ContainsKey("SCOPE")) UUID.TryParse(request["SCOPE"].ToString(), out scopeID); -- cgit v1.1 From a11edceb00b5b86f825bd957bdac9edb91f893dd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 2 Sep 2015 19:54:53 +0100 Subject: seems to compile ( tests comented out) --- OpenSim/Server/Base/HttpServerBase.cs | 15 ------------- .../Handlers/BakedTextures/XBakesPostHandler.cs | 7 ------ .../Server/Handlers/Map/MapAddServerConnector.cs | 17 ++------------- .../Handlers/Profiles/UserProfilesHandlers.cs | 4 +--- .../Server/Handlers/Simulation/AgentHandlers.cs | 25 ++-------------------- 5 files changed, 5 insertions(+), 63 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index a18cdc1..42a8c57 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -116,20 +116,6 @@ namespace OpenSim.Server.Base { uint https_port = (uint)networkConfig.GetInt("https_port", 0); -<<<<<<< HEAD - string cert_path = networkConfig.GetString("cert_path",String.Empty); - if (cert_path == String.Empty) - { - System.Console.WriteLine("ERROR: Path to X509 certificate is missing, server can't start."); - Environment.Exit(1); - } - - string cert_pass = networkConfig.GetString("cert_pass",String.Empty); - if (cert_pass == String.Empty) - { - System.Console.WriteLine("ERROR: Password for X509 certificate is missing, server can't start."); - Environment.Exit(1); -======= m_log.WarnFormat("[SSL]: External flag is {0}", ssl_external); if (!ssl_external) { @@ -152,7 +138,6 @@ namespace OpenSim.Server.Base { m_log.WarnFormat("[SSL]: SSL port is active but no SSL is used because external SSL was requested."); MainServer.AddHttpServer(new BaseHttpServer(https_port)); ->>>>>>> avn/ubitvar } } } diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs index 502cecf..24f63d9 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs @@ -45,19 +45,12 @@ namespace OpenSim.Server.Handlers.BakedTextures { public class BakesServerPostHandler : BaseStreamHandler { -<<<<<<< HEAD:OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IBakedTextureService m_BakesService; public BakesServerPostHandler(IBakedTextureService service, IServiceAuth auth) : base("POST", "/bakes", auth) -======= - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public MSSQLAvatarData(string connectionString, string realm) : - base(connectionString, realm, "Avatar") ->>>>>>> avn/ubitvar:OpenSim/Data/MSSQL/MSSQLAvatarData.cs { m_BakesService = service; } diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 083a628..38dfffc 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -118,11 +118,6 @@ namespace OpenSim.Server.Handlers.MapImage httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest; return FailureResult("Bad request."); } -<<<<<<< HEAD - uint x = 0, y = 0; - UInt32.TryParse(request["X"].ToString(), out x); - UInt32.TryParse(request["Y"].ToString(), out y); -======= int x = 0, y = 0; // UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); UUID scopeID = UUID.Zero; @@ -130,7 +125,6 @@ namespace OpenSim.Server.Handlers.MapImage Int32.TryParse(request["Y"].ToString(), out y); if (request.ContainsKey("SCOPE")) UUID.TryParse(request["SCOPE"].ToString(), out scopeID); ->>>>>>> avn/ubitvar m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y); @@ -142,11 +136,7 @@ namespace OpenSim.Server.Handlers.MapImage if (m_GridService != null) { System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); -<<<<<<< HEAD - GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y)); -======= GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y)); ->>>>>>> avn/ubitvar if (r != null) { if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) @@ -167,11 +157,8 @@ namespace OpenSim.Server.Handlers.MapImage byte[] data = Convert.FromBase64String(request["DATA"].ToString()); string reason = string.Empty; -<<<<<<< HEAD - bool result = m_MapService.AddMapTile((int)x, (int)y, data, out reason); -======= - bool result = m_MapService.AddMapTile(x, y, data, scopeID, out reason); ->>>>>>> avn/ubitvar + + bool result = m_MapService.AddMapTile((int)x, (int)y, data, scopeID, out reason); if (result) return SuccessResult(); diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index bc88184..cac38f5 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -380,7 +380,6 @@ namespace OpenSim.Server.Handlers } #endregion Interests -<<<<<<< HEAD #region User Preferences public bool UserPreferencesRequest(OSDMap json, ref JsonRpcResponse response) { @@ -434,8 +433,7 @@ namespace OpenSim.Server.Handlers } #endregion User Preferences -======= ->>>>>>> avn/ubitvar + #region Utility public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) { diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 8780a49..30418be 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -149,7 +149,6 @@ namespace OpenSim.Server.Handlers.Simulation if (args.ContainsKey("my_version")) theirVersion = args["my_version"].AsString(); -<<<<<<< HEAD List features = new List(); if (args.ContainsKey("features")) @@ -160,18 +159,12 @@ namespace OpenSim.Server.Handlers.Simulation features.Add(new UUID(o.AsString())); } -======= ->>>>>>> avn/ubitvar GridRegion destination = new GridRegion(); destination.RegionID = regionID; string reason; string version; -<<<<<<< HEAD bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, features, out version, out reason); -======= - bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, out version, out reason); ->>>>>>> avn/ubitvar responsedata["int_response_code"] = HttpStatusCode.OK; @@ -269,16 +262,7 @@ namespace OpenSim.Server.Handlers.Simulation httpResponse.KeepAlive = false; Encoding encoding = Encoding.UTF8; -<<<<<<< HEAD if (httpRequest.ContentType != "application/json") -======= - Stream inputStream = null; - if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) - inputStream = new GZipStream(request, CompressionMode.Decompress); - else if (httpRequest.ContentType == "application/json") - inputStream = request; - else // no go ->>>>>>> avn/ubitvar { httpResponse.StatusCode = 406; return encoding.GetBytes("false"); @@ -464,16 +448,13 @@ namespace OpenSim.Server.Handlers.Simulation protected virtual bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { -<<<<<<< HEAD - return m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); -======= reason = String.Empty; if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0) { Util.FireAndForget(x => { string r; - m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r); + m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out r); m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0}", r); }); @@ -482,12 +463,10 @@ namespace OpenSim.Server.Handlers.Simulation else { - bool ret = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + bool ret = m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason); return ret; } - ->>>>>>> avn/ubitvar } } -- cgit v1.1 From 82105ba81d0cd6b866454402a8b064ecc7ebd514 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 14 Sep 2015 01:26:30 +0200 Subject: Change the actual versions allowed to connect, which is different from the interface major version --- OpenSim/Server/Base/ProtocolVersions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ProtocolVersions.cs b/OpenSim/Server/Base/ProtocolVersions.cs index 8db5bb6..5c2278c 100644 --- a/OpenSim/Server/Base/ProtocolVersions.cs +++ b/OpenSim/Server/Base/ProtocolVersions.cs @@ -46,11 +46,11 @@ namespace OpenSim.Server.Base /// // The range of acceptable servers for client-side connectors - public readonly static int ClientProtocolVersionMin = 0; - public readonly static int ClientProtocolVersionMax = 0; + public readonly static int ClientProtocolVersionMin = 1; + public readonly static int ClientProtocolVersionMax = 1; // The range of acceptable clients in server-side handlers - public readonly static int ServerProtocolVersionMin = 0; - public readonly static int ServerProtocolVersionMax = 0; + public readonly static int ServerProtocolVersionMin = 1; + public readonly static int ServerProtocolVersionMax = 1; } } -- cgit v1.1 From 0a23d1634de7196e9b92de3f9295a50f61c5de4b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 14 Sep 2015 01:26:30 +0200 Subject: Change the actual versions allowed to connect, which is different from the interface major version --- OpenSim/Server/Base/ProtocolVersions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ProtocolVersions.cs b/OpenSim/Server/Base/ProtocolVersions.cs index 8db5bb6..5c2278c 100644 --- a/OpenSim/Server/Base/ProtocolVersions.cs +++ b/OpenSim/Server/Base/ProtocolVersions.cs @@ -46,11 +46,11 @@ namespace OpenSim.Server.Base /// // The range of acceptable servers for client-side connectors - public readonly static int ClientProtocolVersionMin = 0; - public readonly static int ClientProtocolVersionMax = 0; + public readonly static int ClientProtocolVersionMin = 1; + public readonly static int ClientProtocolVersionMax = 1; // The range of acceptable clients in server-side handlers - public readonly static int ServerProtocolVersionMin = 0; - public readonly static int ServerProtocolVersionMax = 0; + public readonly static int ServerProtocolVersionMin = 1; + public readonly static int ServerProtocolVersionMax = 1; } } -- cgit v1.1 From 6ded1da9f20a83399d075956e11e953c01321b00 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 28 Sep 2015 15:49:22 +0100 Subject: ... merge issue --- OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs index 9afe953..2dfb862 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs @@ -99,6 +99,8 @@ namespace OpenSim.Server.Handlers.Profiles Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); + Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferenecesUpdate); + Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest); Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); -- cgit v1.1 From f7d8952946210d05208a64523e238f567cd3b02c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 17 Oct 2015 19:29:20 -0700 Subject: The protocol version checking on the grid server connector seemed to have a bug. I think I fixed it. --- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 849fa94..86fda36 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -159,7 +159,24 @@ namespace OpenSim.Server.Handlers.Grid m_log.WarnFormat("[GRID HANDLER]: no maximum protocol version in request to register region"); // Check the protocol version - if ((versionNumberMin > ProtocolVersions.ServerProtocolVersionMax && versionNumberMax < ProtocolVersions.ServerProtocolVersionMax)) + // This is how it works: + // Example 1: + // Client: [0 0] + // Server: [1 1] + // ==> fail + // Example 2: + // Client: [1 1] + // Server: [0 0] + // ==> fail + // Example 3: + // Client: [0 1] + // Server: [1 1] + // ==> success + // Example 4: + // Client: [1 1] + // Server: [0 1] + // ==> success + if ((versionNumberMin > ProtocolVersions.ServerProtocolVersionMax || versionNumberMax < ProtocolVersions.ServerProtocolVersionMin)) { // Can't do, there is no overlap in the acceptable ranges return FailureResult(); -- cgit v1.1 From 339e252ccef175968f4b4b10eb70ca3da4552d55 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 17 Oct 2015 19:29:20 -0700 Subject: The protocol version checking on the grid server connector seemed to have a bug. I think I fixed it. --- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 849fa94..86fda36 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -159,7 +159,24 @@ namespace OpenSim.Server.Handlers.Grid m_log.WarnFormat("[GRID HANDLER]: no maximum protocol version in request to register region"); // Check the protocol version - if ((versionNumberMin > ProtocolVersions.ServerProtocolVersionMax && versionNumberMax < ProtocolVersions.ServerProtocolVersionMax)) + // This is how it works: + // Example 1: + // Client: [0 0] + // Server: [1 1] + // ==> fail + // Example 2: + // Client: [1 1] + // Server: [0 0] + // ==> fail + // Example 3: + // Client: [0 1] + // Server: [1 1] + // ==> success + // Example 4: + // Client: [1 1] + // Server: [0 1] + // ==> success + if ((versionNumberMin > ProtocolVersions.ServerProtocolVersionMax || versionNumberMax < ProtocolVersions.ServerProtocolVersionMin)) { // Can't do, there is no overlap in the acceptable ranges return FailureResult(); -- cgit v1.1 From 06d2508b96522c906d2dba3c07048b2578779dbd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 18 Oct 2015 21:47:10 -0700 Subject: On to 0.8.3! --- OpenSim/Server/Base/Properties/AssemblyInfo.cs | 2 +- OpenSim/Server/Handlers/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs index e819a2b..3c634a7 100644 --- a/OpenSim/Server/Base/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.8.2.*")] +[assembly: AssemblyVersion("0.8.3.*")] diff --git a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs index 780e454..f0b36c1 100644 --- a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.8.2.*")] +[assembly: AssemblyVersion("0.8.3.*")] -- cgit v1.1 From 59b63b64066d9da706c47e47bddd86a897ccd175 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 18 Oct 2015 21:47:10 -0700 Subject: On to 0.8.3! Conflicts: OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs --- OpenSim/Server/Base/Properties/AssemblyInfo.cs | 2 +- OpenSim/Server/Handlers/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs index e819a2b..3c634a7 100644 --- a/OpenSim/Server/Base/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.8.2.*")] +[assembly: AssemblyVersion("0.8.3.*")] diff --git a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs index 780e454..f0b36c1 100644 --- a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.8.2.*")] +[assembly: AssemblyVersion("0.8.3.*")] -- cgit v1.1 From 2b437f8d86201e26368636476f0523c0a39a990a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 20 Oct 2015 00:58:16 +0200 Subject: Let the initiator of a teleport or crossing know that we handle extra wearables --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index e7544b5..8b4518c 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -173,6 +173,7 @@ namespace OpenSim.Server.Handlers.Simulation resp["success"] = OSD.FromBoolean(result); resp["reason"] = OSD.FromString(reason); resp["version"] = OSD.FromString(version); + resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); OSDArray featuresWanted = new OSDArray(); foreach (UUID feature in features) -- cgit v1.1 From dc6d9eadf33b9a0321664d676030b07b2bd04bed Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 31 Oct 2015 00:01:35 +0100 Subject: Testing stage of the new versioning system. Use at own risk. May not work. Will eat your babies. Yada. Yada. --- .../Server/Handlers/Simulation/AgentHandlers.cs | 103 +++++++++++++++++++-- 1 file changed, 94 insertions(+), 9 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 8b4518c..e0fa799 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -145,9 +145,96 @@ namespace OpenSim.Server.Handlers.Simulation if (args.ContainsKey("agent_home_uri")) agentHomeURI = args["agent_home_uri"].AsString(); - string theirVersion = string.Empty; + // Decode the legacy (string) version and extract the number + float theirVersion = 0f; if (args.ContainsKey("my_version")) - theirVersion = args["my_version"].AsString(); + { + string theirVersionStr = args["my_version"].AsString(); + string[] parts = theirVersionStr.Split(new char[] {'/'}); + if (parts.Length > 1) + theirVersion = float.Parse(parts[1]); + } + + // Decode the new versioning data + float minVersionRequired = 0f; + float maxVersionRequired = 0f; + float minVersionProvided = 0f; + float maxVersionProvided = 0f; + + if (args.ContainsKey("simulation_service_supported_min")) + minVersionProvided = (float)args["simulation_service_supported_min"].AsReal(); + if (args.ContainsKey("simulation_service_supported_max")) + maxVersionProvided = (float)args["simulation_service_supported_max"].AsReal(); + + if (args.ContainsKey("simulation_service_accepted_min")) + minVersionRequired = (float)args["simulation_service_accepted_min"].AsReal(); + if (args.ContainsKey("simulation_service_accepted_max")) + maxVersionRequired = (float)args["simulation_service_accepted_max"].AsReal(); + + responsedata["int_response_code"] = HttpStatusCode.OK; + OSDMap resp = new OSDMap(3); + + + // If there is no version in the packet at all we're looking at 0.6 or + // even more ancient. Refuse it. + if (minVersionProvided == 0f && theirVersion == 0f) // 0.6 or earlier + { + resp["success"] = OSD.FromBoolean(false); + resp["reason"] = OSD.FromString("Version not supported"); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } + + float version; + + if (minVersionProvided == 0f) // Legacy version + { + if (theirVersion >= VersionInfo.SimulationServiceVersionAcceptedMin && + theirVersion <= VersionInfo.SimulationServiceVersionAcceptedMax) + { + version = Math.Max(theirVersion, VersionInfo.SimulationServiceVersionAcceptedMax); + } + else + { + resp["success"] = OSD.FromBoolean(false); + resp["reason"] = OSD.FromString(String.Format("Your version is {0} and we accept only {1} - {2}", theirVersion, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } + } + else + { + // Test for no overlap + if (minVersionProvided > VersionInfo.SimulationServiceVersionAcceptedMax || + maxVersionProvided < VersionInfo.SimulationServiceVersionAcceptedMin) + { + resp["success"] = OSD.FromBoolean(false); + resp["reason"] = OSD.FromString(String.Format("You provide versions {0} - {1} and we accept only {2} - {3}. No version overlap.", minVersionProvided, maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } + if (minVersionRequired > VersionInfo.SimulationServiceVersionSupportedMax || + maxVersionRequired < VersionInfo.SimulationServiceVersionSupportedMin) + { + resp["success"] = OSD.FromBoolean(false); + resp["reason"] = OSD.FromString(String.Format("You require versions {0} - {1} and we provide only {2} - {3}. No version overlap.", minVersionRequired, maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax)); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } + + // Determine version to use + version = Math.Max(Math.Max(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax), Math.Max(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax)); + if (version < VersionInfo.SimulationServiceVersionAcceptedMin || + version > VersionInfo.SimulationServiceVersionAcceptedMax || + version < VersionInfo.SimulationServiceVersionSupportedMin || + version > VersionInfo.SimulationServiceVersionSupportedMax) + { + resp["success"] = OSD.FromBoolean(false); + resp["reason"] = OSD.FromString(String.Format("The protocol version we determined, {0}, is incompatible with the version windows, {1} - {2} and {3} - {4}. No version overlap.", version, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax)); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } + } List features = new List(); @@ -163,16 +250,14 @@ namespace OpenSim.Server.Handlers.Simulation destination.RegionID = regionID; string reason; - string version; - bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, features, out version, out reason); - - responsedata["int_response_code"] = HttpStatusCode.OK; - - OSDMap resp = new OSDMap(3); + float dummyVersion; + bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out dummyVersion, out reason); resp["success"] = OSD.FromBoolean(result); resp["reason"] = OSD.FromString(reason); - resp["version"] = OSD.FromString(version); + string legacyVersion = String.Format("SIMULATION/{0}", version); + resp["version"] = OSD.FromString(legacyVersion); + resp["negotiated_version"] = OSD.FromReal(version); resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); OSDArray featuresWanted = new OSDArray(); -- cgit v1.1 From 1030d07f31516b303ddbb0c428f8f28419f3fa82 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 31 Oct 2015 12:57:14 +0000 Subject: simplify new regions protocol version control. (May not work, and babies safety warnings still valid --- .../Server/Handlers/Simulation/AgentHandlers.cs | 68 +++++++++++++--------- 1 file changed, 41 insertions(+), 27 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index e0fa799..e8456b4 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -156,8 +156,8 @@ namespace OpenSim.Server.Handlers.Simulation } // Decode the new versioning data - float minVersionRequired = 0f; - float maxVersionRequired = 0f; +// float minVersionRequired = 0f; +// float maxVersionRequired = 0f; float minVersionProvided = 0f; float maxVersionProvided = 0f; @@ -166,50 +166,49 @@ namespace OpenSim.Server.Handlers.Simulation if (args.ContainsKey("simulation_service_supported_max")) maxVersionProvided = (float)args["simulation_service_supported_max"].AsReal(); - if (args.ContainsKey("simulation_service_accepted_min")) - minVersionRequired = (float)args["simulation_service_accepted_min"].AsReal(); - if (args.ContainsKey("simulation_service_accepted_max")) - maxVersionRequired = (float)args["simulation_service_accepted_max"].AsReal(); +// if (args.ContainsKey("simulation_service_accepted_min")) +// minVersionRequired = (float)args["simulation_service_accepted_min"].AsReal(); +// if (args.ContainsKey("simulation_service_accepted_max")) +// maxVersionRequired = (float)args["simulation_service_accepted_max"].AsReal(); responsedata["int_response_code"] = HttpStatusCode.OK; OSDMap resp = new OSDMap(3); - - // If there is no version in the packet at all we're looking at 0.6 or - // even more ancient. Refuse it. - if (minVersionProvided == 0f && theirVersion == 0f) // 0.6 or earlier - { - resp["success"] = OSD.FromBoolean(false); - resp["reason"] = OSD.FromString("Version not supported"); - responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); - return; - } - float version; - if (minVersionProvided == 0f) // Legacy version + + if (minVersionProvided == 0f) // string version or older { - if (theirVersion >= VersionInfo.SimulationServiceVersionAcceptedMin && - theirVersion <= VersionInfo.SimulationServiceVersionAcceptedMax) + // If there is no version in the packet at all we're looking at 0.6 or + // even more ancient. Refuse it. + if(theirVersion == 0f) { - version = Math.Max(theirVersion, VersionInfo.SimulationServiceVersionAcceptedMax); + resp["success"] = OSD.FromBoolean(false); + resp["reason"] = OSD.FromString("Your region is running a old version of opensim no longer supported. Consider updating it"); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; } - else + + version = theirVersion; + + if (version < VersionInfo.SimulationServiceVersionAcceptedMin || + version > VersionInfo.SimulationServiceVersionAcceptedMax ) { resp["success"] = OSD.FromBoolean(false); - resp["reason"] = OSD.FromString(String.Format("Your version is {0} and we accept only {1} - {2}", theirVersion, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); + resp["reason"] = OSD.FromString(String.Format("Your region protocol version is {0} and destiny accepts only {1} - {2}", theirVersion, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); return; } } else { +/* // Test for no overlap if (minVersionProvided > VersionInfo.SimulationServiceVersionAcceptedMax || maxVersionProvided < VersionInfo.SimulationServiceVersionAcceptedMin) { resp["success"] = OSD.FromBoolean(false); - resp["reason"] = OSD.FromString(String.Format("You provide versions {0} - {1} and we accept only {2} - {3}. No version overlap.", minVersionProvided, maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); + resp["reason"] = OSD.FromString(String.Format("Your region provide protocol versions {0} - {1} and we accept only {2} - {3}. No version overlap.", minVersionProvided, maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); return; } @@ -217,23 +216,38 @@ namespace OpenSim.Server.Handlers.Simulation maxVersionRequired < VersionInfo.SimulationServiceVersionSupportedMin) { resp["success"] = OSD.FromBoolean(false); - resp["reason"] = OSD.FromString(String.Format("You require versions {0} - {1} and we provide only {2} - {3}. No version overlap.", minVersionRequired, maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax)); + resp["reason"] = OSD.FromString(String.Format("You require region protocol versions {0} - {1} and we provide only {2} - {3}. No version overlap.", minVersionRequired, maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax)); responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); return; } // Determine version to use - version = Math.Max(Math.Max(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax), Math.Max(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax)); + + version = Math.Max(Math.Min(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax), Math.Min(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax)); if (version < VersionInfo.SimulationServiceVersionAcceptedMin || version > VersionInfo.SimulationServiceVersionAcceptedMax || version < VersionInfo.SimulationServiceVersionSupportedMin || version > VersionInfo.SimulationServiceVersionSupportedMax) { resp["success"] = OSD.FromBoolean(false); - resp["reason"] = OSD.FromString(String.Format("The protocol version we determined, {0}, is incompatible with the version windows, {1} - {2} and {3} - {4}. No version overlap.", version, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax)); + resp["reason"] = OSD.FromString(String.Format("The region protocol version we determined, {0}, is incompatible with the version windows, {1} - {2} and {3} - {4}. No version overlap.", version, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax)); responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); return; } +*/ + // find max possible version to use + version = Math.Min(VersionInfo.SimulationServiceVersionAcceptedMax, maxVersionProvided); + // check if within lower bounds + if(version < VersionInfo.SimulationServiceVersionAcceptedMin || + version < minVersionProvided) + { + resp["success"] = OSD.FromBoolean(false); + resp["reason"] = OSD.FromString(String.Format("Region protocol versions are incompatible. Destiny accepts {0} - {1} and source provides {2} - {3}.", VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax, + minVersionProvided, + maxVersionProvided)); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } } List features = new List(); -- cgit v1.1 From dc6bdbf740d4c903b06fef386c4b80df783a7b2e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 31 Oct 2015 16:57:24 +0100 Subject: Put back the option of having asymmetrical protocol versions in transfers --- .../Server/Handlers/Simulation/AgentHandlers.cs | 43 +++++++++------------- 1 file changed, 18 insertions(+), 25 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index e8456b4..6faeefd 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -156,8 +156,8 @@ namespace OpenSim.Server.Handlers.Simulation } // Decode the new versioning data -// float minVersionRequired = 0f; -// float maxVersionRequired = 0f; + float minVersionRequired = 0f; + float maxVersionRequired = 0f; float minVersionProvided = 0f; float maxVersionProvided = 0f; @@ -166,10 +166,10 @@ namespace OpenSim.Server.Handlers.Simulation if (args.ContainsKey("simulation_service_supported_max")) maxVersionProvided = (float)args["simulation_service_supported_max"].AsReal(); -// if (args.ContainsKey("simulation_service_accepted_min")) -// minVersionRequired = (float)args["simulation_service_accepted_min"].AsReal(); -// if (args.ContainsKey("simulation_service_accepted_max")) -// maxVersionRequired = (float)args["simulation_service_accepted_max"].AsReal(); + if (args.ContainsKey("simulation_service_accepted_min")) + minVersionRequired = (float)args["simulation_service_accepted_min"].AsReal(); + if (args.ContainsKey("simulation_service_accepted_max")) + maxVersionRequired = (float)args["simulation_service_accepted_max"].AsReal(); responsedata["int_response_code"] = HttpStatusCode.OK; OSDMap resp = new OSDMap(3); @@ -195,14 +195,13 @@ namespace OpenSim.Server.Handlers.Simulation version > VersionInfo.SimulationServiceVersionAcceptedMax ) { resp["success"] = OSD.FromBoolean(false); - resp["reason"] = OSD.FromString(String.Format("Your region protocol version is {0} and destiny accepts only {1} - {2}", theirVersion, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); + resp["reason"] = OSD.FromString(String.Format("Your region protocol version is {0} and we accept only {1} - {2}. No version overlap.", theirVersion, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); return; } } else { -/* // Test for no overlap if (minVersionProvided > VersionInfo.SimulationServiceVersionAcceptedMax || maxVersionProvided < VersionInfo.SimulationServiceVersionAcceptedMin) @@ -221,9 +220,16 @@ namespace OpenSim.Server.Handlers.Simulation return; } - // Determine version to use + // Determine versions to use + float inboundVersion = Math.Min(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax); + float outboundVersion = Math.Min(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax); + + // In this stage, we use only a single version number. Future regions may use asymmetrical protocols. + // Here, the two versions we determined are combined into a single version for now. + version = Math.Max(inboundVersion, outboundVersion); - version = Math.Max(Math.Min(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax), Math.Min(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax)); + // Since only using a single version, we must do this check. Once the plumbing is in for asymmetrical + // protocols, this will go away, allowing more working combinations. if (version < VersionInfo.SimulationServiceVersionAcceptedMin || version > VersionInfo.SimulationServiceVersionAcceptedMax || version < VersionInfo.SimulationServiceVersionSupportedMin || @@ -234,20 +240,6 @@ namespace OpenSim.Server.Handlers.Simulation responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); return; } -*/ - // find max possible version to use - version = Math.Min(VersionInfo.SimulationServiceVersionAcceptedMax, maxVersionProvided); - // check if within lower bounds - if(version < VersionInfo.SimulationServiceVersionAcceptedMin || - version < minVersionProvided) - { - resp["success"] = OSD.FromBoolean(false); - resp["reason"] = OSD.FromString(String.Format("Region protocol versions are incompatible. Destiny accepts {0} - {1} and source provides {2} - {3}.", VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax, - minVersionProvided, - maxVersionProvided)); - responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); - return; - } } List features = new List(); @@ -271,7 +263,8 @@ namespace OpenSim.Server.Handlers.Simulation resp["reason"] = OSD.FromString(reason); string legacyVersion = String.Format("SIMULATION/{0}", version); resp["version"] = OSD.FromString(legacyVersion); - resp["negotiated_version"] = OSD.FromReal(version); + resp["negotiated_inbound_version"] = OSD.FromReal(version); //inboundVersion); + resp["negotiated_outbound_version"] = OSD.FromReal(version); //outboundVersion); resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); OSDArray featuresWanted = new OSDArray(); -- cgit v1.1 From ea56f4f27c6e707b54e0e29d2477ef3af2a8c732 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 31 Oct 2015 18:13:02 +0100 Subject: Introduce an EntityTransferContext carrying the version numbers to pass to all interested functions. Should fix the varregion conditional. Still a testing version, do NOT use in production! --- .../Server/Handlers/Simulation/AgentHandlers.cs | 31 ++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 6faeefd..5142514 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -176,6 +176,8 @@ namespace OpenSim.Server.Handlers.Simulation float version; + float outboundVersion = 0f; + float inboundVersion = 0f; if (minVersionProvided == 0f) // string version or older { @@ -221,24 +223,22 @@ namespace OpenSim.Server.Handlers.Simulation } // Determine versions to use - float inboundVersion = Math.Min(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax); - float outboundVersion = Math.Min(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax); + // This is intentionally inverted. Inbound and Outbound refer to the direction of the transfer. + // Therefore outbound means from the sender to the receier and inbound means from the receiver to the sender. + // So outbound is what we will accept and inbound is what we will send. Confused yet? + outboundVersion = Math.Min(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax); + inboundVersion = Math.Min(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax); - // In this stage, we use only a single version number. Future regions may use asymmetrical protocols. - // Here, the two versions we determined are combined into a single version for now. + // Here, the two versions we determined are combined into a single version for legacy response. version = Math.Max(inboundVersion, outboundVersion); - // Since only using a single version, we must do this check. Once the plumbing is in for asymmetrical - // protocols, this will go away, allowing more working combinations. if (version < VersionInfo.SimulationServiceVersionAcceptedMin || version > VersionInfo.SimulationServiceVersionAcceptedMax || version < VersionInfo.SimulationServiceVersionSupportedMin || version > VersionInfo.SimulationServiceVersionSupportedMax) { - resp["success"] = OSD.FromBoolean(false); - resp["reason"] = OSD.FromString(String.Format("The region protocol version we determined, {0}, is incompatible with the version windows, {1} - {2} and {3} - {4}. No version overlap.", version, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax)); - responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); - return; + // If the single version can't resolve, fall back to safest. This will only affect very old regions. + version = 0.1f; } } @@ -256,15 +256,18 @@ namespace OpenSim.Server.Handlers.Simulation destination.RegionID = regionID; string reason; - float dummyVersion; - bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out dummyVersion, out reason); + // We're sending the version numbers down to the local connector to do the varregion check. + EntityTransferContext ctx = new EntityTransferContext(); + ctx.InboundVersion = inboundVersion; + ctx.OutboundVersion = outboundVersion; + bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason); resp["success"] = OSD.FromBoolean(result); resp["reason"] = OSD.FromString(reason); string legacyVersion = String.Format("SIMULATION/{0}", version); resp["version"] = OSD.FromString(legacyVersion); - resp["negotiated_inbound_version"] = OSD.FromReal(version); //inboundVersion); - resp["negotiated_outbound_version"] = OSD.FromReal(version); //outboundVersion); + resp["negotiated_inbound_version"] = OSD.FromReal(inboundVersion); + resp["negotiated_outbound_version"] = OSD.FromReal(outboundVersion); resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); OSDArray featuresWanted = new OSDArray(); -- cgit v1.1 From 19e5667451dc763eb90a78533c4fe7f51c49f9a0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 31 Oct 2015 21:50:24 +0000 Subject: fix transfer protocol version in string format. Let that case have tests identical to new format (this still isnt for your babies keep them safe...) --- .../Server/Handlers/Simulation/AgentHandlers.cs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 5142514..a2920f9 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -190,14 +190,24 @@ namespace OpenSim.Server.Handlers.Simulation responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); return; } - + version = theirVersion; - - if (version < VersionInfo.SimulationServiceVersionAcceptedMin || - version > VersionInfo.SimulationServiceVersionAcceptedMax ) + outboundVersion = version; + inboundVersion = version; + + if (outboundVersion < VersionInfo.SimulationServiceVersionAcceptedMin || + outboundVersion > VersionInfo.SimulationServiceVersionAcceptedMax ) + { + resp["success"] = OSD.FromBoolean(false); + resp["reason"] = OSD.FromString(String.Format("Your region provide protocol version {0} and we accept only {1} - {2}. No version overlap.", outboundVersion, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } + if (inboundVersion > VersionInfo.SimulationServiceVersionSupportedMax || + inboundVersion < VersionInfo.SimulationServiceVersionSupportedMin) { resp["success"] = OSD.FromBoolean(false); - resp["reason"] = OSD.FromString(String.Format("Your region protocol version is {0} and we accept only {1} - {2}. No version overlap.", theirVersion, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); + resp["reason"] = OSD.FromString(String.Format("You require region protocol version {0} and we provide only {2} - {3}. No version overlap.", inboundVersion, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax)); responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); return; } @@ -239,6 +249,8 @@ namespace OpenSim.Server.Handlers.Simulation { // If the single version can't resolve, fall back to safest. This will only affect very old regions. version = 0.1f; + outboundVersion = version; + inboundVersion = version; } } -- cgit v1.1 From 6d0b45cd4e8e8a1bb0c2eb45981bc548ae5d53ac Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 1 Nov 2015 00:35:27 +0100 Subject: Revert "fix transfer protocol version in string format. These are not fixes you are looking for..... (Jedi mind trick) This reverts commit 19e5667451dc763eb90a78533c4fe7f51c49f9a0. --- .../Server/Handlers/Simulation/AgentHandlers.cs | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index a2920f9..5142514 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -190,24 +190,14 @@ namespace OpenSim.Server.Handlers.Simulation responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); return; } - - version = theirVersion; - outboundVersion = version; - inboundVersion = version; - if (outboundVersion < VersionInfo.SimulationServiceVersionAcceptedMin || - outboundVersion > VersionInfo.SimulationServiceVersionAcceptedMax ) - { - resp["success"] = OSD.FromBoolean(false); - resp["reason"] = OSD.FromString(String.Format("Your region provide protocol version {0} and we accept only {1} - {2}. No version overlap.", outboundVersion, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); - responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); - return; - } - if (inboundVersion > VersionInfo.SimulationServiceVersionSupportedMax || - inboundVersion < VersionInfo.SimulationServiceVersionSupportedMin) + version = theirVersion; + + if (version < VersionInfo.SimulationServiceVersionAcceptedMin || + version > VersionInfo.SimulationServiceVersionAcceptedMax ) { resp["success"] = OSD.FromBoolean(false); - resp["reason"] = OSD.FromString(String.Format("You require region protocol version {0} and we provide only {2} - {3}. No version overlap.", inboundVersion, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax)); + resp["reason"] = OSD.FromString(String.Format("Your region protocol version is {0} and we accept only {1} - {2}. No version overlap.", theirVersion, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); return; } @@ -249,8 +239,6 @@ namespace OpenSim.Server.Handlers.Simulation { // If the single version can't resolve, fall back to safest. This will only affect very old regions. version = 0.1f; - outboundVersion = version; - inboundVersion = version; } } -- cgit v1.1 From 2198330142c2176f31ba4d2198f831ef00c1dca4 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 1 Nov 2015 00:40:13 +0100 Subject: This is the replacement fix for large regions and string version. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 5142514..6e87448 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -260,6 +260,12 @@ namespace OpenSim.Server.Handlers.Simulation EntityTransferContext ctx = new EntityTransferContext(); ctx.InboundVersion = inboundVersion; ctx.OutboundVersion = outboundVersion; + if (minVersionProvided == 0f) + { + ctx.InboundVersion = version; + ctx.OutboundVersion = version; + } + bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason); resp["success"] = OSD.FromBoolean(result); -- cgit v1.1 From 5f3b443c034d3d59ae08dce6d560fa8708cb3bd5 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 1 Nov 2015 00:57:45 +0100 Subject: Remove an unneeded code path, it could never be reached. Ubit caught it :) --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 6e87448..5a71951 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -228,18 +228,6 @@ namespace OpenSim.Server.Handlers.Simulation // So outbound is what we will accept and inbound is what we will send. Confused yet? outboundVersion = Math.Min(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax); inboundVersion = Math.Min(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax); - - // Here, the two versions we determined are combined into a single version for legacy response. - version = Math.Max(inboundVersion, outboundVersion); - - if (version < VersionInfo.SimulationServiceVersionAcceptedMin || - version > VersionInfo.SimulationServiceVersionAcceptedMax || - version < VersionInfo.SimulationServiceVersionSupportedMin || - version > VersionInfo.SimulationServiceVersionSupportedMax) - { - // If the single version can't resolve, fall back to safest. This will only affect very old regions. - version = 0.1f; - } } List features = new List(); -- cgit v1.1 From efcf0e4f2e5f6e5e800917f0888475dfed725e42 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 1 Nov 2015 01:03:44 +0100 Subject: Minor: Add an initializer to show what the default value would be. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 5a71951..98c5312 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -174,7 +174,7 @@ namespace OpenSim.Server.Handlers.Simulation responsedata["int_response_code"] = HttpStatusCode.OK; OSDMap resp = new OSDMap(3); - float version; + float version = 0f; float outboundVersion = 0f; float inboundVersion = 0f; -- cgit v1.1 From 69585a4824a7814bbe543d624de6c3627e0b927b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 1 Nov 2015 19:11:14 +0100 Subject: More plumbing of the EntityTransferContext (not yet complete) --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 0e6710d..f6a7e19 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -461,6 +461,7 @@ namespace OpenSim.Server.Handlers.Simulation // This is the meaning of POST agent //m_regionClient.AdjustUserInformation(aCircuit); //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason); resp["reason"] = OSD.FromString(reason); @@ -539,12 +540,15 @@ namespace OpenSim.Server.Handlers.Simulation AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { reason = String.Empty; + // The data and protocols are already defined so this is just a dummy to satisfy the interface + // TODO: make this end-to-end + EntityTransferContext ctx = new EntityTransferContext(); if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0) { Util.FireAndForget(x => { string r; - m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out r); + m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out r); m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0}", r); }); @@ -553,7 +557,7 @@ namespace OpenSim.Server.Handlers.Simulation else { - bool ret = m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); + bool ret = m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason); m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason); return ret; } @@ -739,7 +743,10 @@ namespace OpenSim.Server.Handlers.Simulation // subclasses can override this protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) { - return m_SimulationService.UpdateAgent(destination, agent); + // The data and protocols are already defined so this is just a dummy to satisfy the interface + // TODO: make this end-to-end + EntityTransferContext ctx = new EntityTransferContext(); + return m_SimulationService.UpdateAgent(destination, agent, ctx); } } -- cgit v1.1 From 5f18f2ce6a4308fe30de8b7816058bd5d4b962ca Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 1 Nov 2015 19:37:14 +0100 Subject: More EntityTransferContext plumbing --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index f6a7e19..7ab7dea 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -262,7 +262,6 @@ namespace OpenSim.Server.Handlers.Simulation resp["version"] = OSD.FromString(legacyVersion); resp["negotiated_inbound_version"] = OSD.FromReal(inboundVersion); resp["negotiated_outbound_version"] = OSD.FromReal(outboundVersion); - resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); OSDArray featuresWanted = new OSDArray(); foreach (UUID feature in features) @@ -661,6 +660,9 @@ namespace OpenSim.Server.Handlers.Simulation protected void DoAgentPut(Hashtable request, Hashtable responsedata) { + // TODO: Encode the ENtityTransferContext + EntityTransferContext ctx = new EntityTransferContext(); + OSDMap args = Utils.GetOSDMap((string)request["body"]); if (args == null) { @@ -703,7 +705,7 @@ namespace OpenSim.Server.Handlers.Simulation AgentData agent = new AgentData(); try { - agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID)); + agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID), ctx); } catch (Exception ex) { @@ -722,7 +724,7 @@ namespace OpenSim.Server.Handlers.Simulation AgentPosition agent = new AgentPosition(); try { - agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID)); + agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID), ctx); } catch (Exception ex) { -- cgit v1.1 From f88e4a1ec914ddaa9680a62faf96241b87fd0e06 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 2 Nov 2015 00:23:38 +0100 Subject: Plumb the rest of the context stuff. Well, what I see so far anyway --- OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | 2 +- OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 2 +- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs index 95a0510..f3d678f 100644 --- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs @@ -62,7 +62,7 @@ namespace OpenSim.Server.Handlers.Hypergrid } protected override bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination, - AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) + AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, EntityTransferContext ctx, out string reason) { return m_GatekeeperService.LoginAgent(source, aCircuit, destination, out reason); } diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index e787f7c..367c481 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -118,7 +118,7 @@ namespace OpenSim.Server.Handlers.Hypergrid protected override bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination, - AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) + AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, EntityTransferContext ctx, out string reason) { return m_UserAgentService.LoginAgentToGrid(source, aCircuit, gatekeeper, destination, fromLogin, out reason); } diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 7ab7dea..c19421a 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -120,6 +120,8 @@ namespace OpenSim.Server.Handlers.Simulation protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID) { + EntityTransferContext ctx = new EntityTransferContext(); + if (m_SimulationService == null) { m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless."); @@ -155,6 +157,9 @@ namespace OpenSim.Server.Handlers.Simulation theirVersion = float.Parse(parts[1]); } + if (args.ContainsKey("context")) + ctx.Unpack((OSDMap)args["context"]); + // Decode the new versioning data float minVersionRequired = 0f; float maxVersionRequired = 0f; @@ -245,7 +250,6 @@ namespace OpenSim.Server.Handlers.Simulation string reason; // We're sending the version numbers down to the local connector to do the varregion check. - EntityTransferContext ctx = new EntityTransferContext(); ctx.InboundVersion = inboundVersion; ctx.OutboundVersion = outboundVersion; if (minVersionProvided == 0f) @@ -406,6 +410,8 @@ namespace OpenSim.Server.Handlers.Simulation protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) { + EntityTransferContext ctx = new EntityTransferContext(); + OSDMap args = Utils.GetOSDMap((string)request["body"]); if (args == null) { @@ -414,6 +420,9 @@ namespace OpenSim.Server.Handlers.Simulation return; } + if (args.ContainsKey("context")) + ctx.Unpack((OSDMap)args["context"]); + AgentDestinationData data = CreateAgentDestinationData(); UnpackData(args, data, request); @@ -461,7 +470,7 @@ namespace OpenSim.Server.Handlers.Simulation //m_regionClient.AdjustUserInformation(aCircuit); //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); - bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason); + bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, ctx, out reason); resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); @@ -536,12 +545,11 @@ namespace OpenSim.Server.Handlers.Simulation // subclasses can override this protected virtual bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination, - AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) + AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, EntityTransferContext ctx, out string reason) { reason = String.Empty; // The data and protocols are already defined so this is just a dummy to satisfy the interface // TODO: make this end-to-end - EntityTransferContext ctx = new EntityTransferContext(); if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0) { Util.FireAndForget(x => @@ -683,6 +691,8 @@ namespace OpenSim.Server.Handlers.Simulation UUID.TryParse(args["destination_uuid"].AsString(), out uuid); if (args.ContainsKey("destination_name") && args["destination_name"] != null) regionname = args["destination_name"].ToString(); + if (args.ContainsKey("context")) + ctx.Unpack((OSDMap)args["context"]); GridRegion destination = new GridRegion(); destination.RegionID = uuid; -- cgit v1.1 From 81eb9816a26dfe70d9eff5bc57188ee6dd8e5103 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 23 Nov 2015 23:03:16 +0000 Subject: remove libomv detection/log from llLoginService --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 5d672c3..b8788ac 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -132,18 +132,12 @@ namespace OpenSim.Server.Handlers.Login //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); - - bool LibOMVclient = false; - if (request.Params.Count > 4 && (string)request.Params[4] == "gridproxy") - LibOMVclient = true; - LoginResponse reply = null; - reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient, LibOMVclient); + reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient); XmlRpcResponse response = new XmlRpcResponse(); response.Value = reply.ToHashtable(); return response; - } } @@ -221,7 +215,7 @@ namespace OpenSim.Server.Handlers.Login LoginResponse reply = null; reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, - map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient,false); + map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient); return reply.ToOSDMap(); } @@ -263,8 +257,8 @@ namespace OpenSim.Server.Handlers.Login IPEndPoint endPoint = (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint(); LoginResponse reply = null; - reply = m_LocalService.Login(first, last, passwd, start, scope, version, - channel, mac, id0, endPoint,false); + reply = m_LocalService.Login(first, last, passwd, start, scope, + version, channel, mac, id0, endPoint); sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap())); } -- cgit v1.1 From 9d8fe7f3db2e90fa91c39ee9b0bd76859beb1412 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 23 Nov 2015 23:10:02 +0000 Subject: revert previus commit --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index b8788ac..5d672c3 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -132,12 +132,18 @@ namespace OpenSim.Server.Handlers.Login //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); + + bool LibOMVclient = false; + if (request.Params.Count > 4 && (string)request.Params[4] == "gridproxy") + LibOMVclient = true; + LoginResponse reply = null; - reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient); + reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient, LibOMVclient); XmlRpcResponse response = new XmlRpcResponse(); response.Value = reply.ToHashtable(); return response; + } } @@ -215,7 +221,7 @@ namespace OpenSim.Server.Handlers.Login LoginResponse reply = null; reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, - map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient); + map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient,false); return reply.ToOSDMap(); } @@ -257,8 +263,8 @@ namespace OpenSim.Server.Handlers.Login IPEndPoint endPoint = (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint(); LoginResponse reply = null; - reply = m_LocalService.Login(first, last, passwd, start, scope, - version, channel, mac, id0, endPoint); + reply = m_LocalService.Login(first, last, passwd, start, scope, version, + channel, mac, id0, endPoint,false); sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap())); } -- cgit v1.1 From ae3e288b14495a07d49520b2dccb6f952abac58b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 2 Dec 2015 04:24:58 +0000 Subject: createAgent needs to be sync --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index c19421a..c160e5c 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -550,6 +550,8 @@ namespace OpenSim.Server.Handlers.Simulation reason = String.Empty; // The data and protocols are already defined so this is just a dummy to satisfy the interface // TODO: make this end-to-end + +/* this needs to be sync if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0) { Util.FireAndForget(x => @@ -563,9 +565,10 @@ namespace OpenSim.Server.Handlers.Simulation } else { +*/ bool ret = m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason); - m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason); +// m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason); return ret; } } -- cgit v1.1 From e2796e604465b439ff1a74454a846a29948ab84e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 2 Dec 2015 04:26:30 +0000 Subject: fix typo --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index c160e5c..c21ef81 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -570,7 +570,7 @@ namespace OpenSim.Server.Handlers.Simulation bool ret = m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason); // m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason); return ret; - } +// } } } -- cgit v1.1 From ab12a142798a1358b82d927f3d6046e30fcc57c2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 21 Feb 2016 11:14:02 -0800 Subject: Pushed AssemblyVersion up to VersionInfo, so that we don't need to do global replace anymore. --- OpenSim/Server/Base/Properties/AssemblyInfo.cs | 2 +- OpenSim/Server/Handlers/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs index 3c634a7..02931e7 100644 --- a/OpenSim/Server/Base/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.8.3.*")] +[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)] diff --git a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs index f0b36c1..7d3665b 100644 --- a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.8.3.*")] +[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)] -- cgit v1.1 From 59ed89769aa292196f99affe0a99a758e63a538a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 29 Apr 2016 22:36:56 +0200 Subject: Apply user specified default perms across the board, to items uploaded as well as items created and to rezzed prims in world. This effectively removes the concept of "default permissions" from OpenSim because all known modern viewers set the permissions flags on login. Ancient abandoned viewers will now default to the SL defaults. --- .../Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs b/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs index 713b755..b1b3c6f 100644 --- a/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs +++ b/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs @@ -106,7 +106,8 @@ namespace OpenSim.Server.Handlers.AgentPreferences return FailureResult(); AgentPrefs prefs = m_AgentPreferencesService.GetAgentPreferences(userID); Dictionary result = new Dictionary(); - result = prefs.ToKeyValuePairs(); + if (prefs != null) + result = prefs.ToKeyValuePairs(); string xmlString = ServerUtils.BuildXmlResponse(result); -- cgit v1.1 From 2d2414adcfcf50ba1398f889c0ca301b3409e317 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 13 Jun 2016 18:04:28 -0700 Subject: Add a few more debug messages to diagnose problems in OSGrid's proxy use --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 5d672c3..48571e3 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -63,13 +63,18 @@ namespace OpenSim.Server.Handlers.Login public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient) { + m_log.DebugFormat("[TEST]: HandleXMLRPCLogin from {0}", remoteClient.ToString()); Hashtable requestData = (Hashtable)request.Params[0]; if (m_Proxy && request.Params[3] != null) { + m_log.DebugFormat("[TEST]: Proxy ! {0}", request.Params[3]); IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]); if (ep != null) + { // Bang! remoteClient = ep; + m_log.DebugFormat("[TEST]: IP is {0}", remoteClient.ToString()); + } } if (requestData != null) -- cgit v1.1 From b5f29e93f6345987c0b9b8d6496b489e7336039b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 13 Jun 2016 20:35:40 -0700 Subject: More debug to diagnose osgrid --- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 86fda36..3c9570c 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -70,6 +70,7 @@ namespace OpenSim.Server.Handlers.Grid sr.Close(); body = body.Trim(); + m_log.DebugFormat("[TEST]: ProcessRequest client IP is {0}", httpRequest.RemoteIPEndPoint.ToString()); //m_log.DebugFormat("[XXX]: query String: {0}", body); try -- cgit v1.1 From 1e9a94463345a7f7d0efb6957a9e176b758dc692 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 13 Jun 2016 20:39:52 -0700 Subject: Revert "More debug to diagnose osgrid" This reverts commit b5f29e93f6345987c0b9b8d6496b489e7336039b. --- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 3c9570c..86fda36 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -70,7 +70,6 @@ namespace OpenSim.Server.Handlers.Grid sr.Close(); body = body.Trim(); - m_log.DebugFormat("[TEST]: ProcessRequest client IP is {0}", httpRequest.RemoteIPEndPoint.ToString()); //m_log.DebugFormat("[XXX]: query String: {0}", body); try -- cgit v1.1 From 4be4e98525c47f55fb113901b01b5c1d9695a9fd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 13 Jun 2016 20:40:47 -0700 Subject: Revert "Add a few more debug messages to diagnose problems in OSGrid's proxy use" This reverts commit 2d2414adcfcf50ba1398f889c0ca301b3409e317. --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 48571e3..5d672c3 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -63,18 +63,13 @@ namespace OpenSim.Server.Handlers.Login public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient) { - m_log.DebugFormat("[TEST]: HandleXMLRPCLogin from {0}", remoteClient.ToString()); Hashtable requestData = (Hashtable)request.Params[0]; if (m_Proxy && request.Params[3] != null) { - m_log.DebugFormat("[TEST]: Proxy ! {0}", request.Params[3]); IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]); if (ep != null) - { // Bang! remoteClient = ep; - m_log.DebugFormat("[TEST]: IP is {0}", remoteClient.ToString()); - } } if (requestData != null) -- cgit v1.1 From 1e213f5150b747fa87ddbe6b64e385147b56d4ef Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 22 Jun 2016 15:55:39 -0700 Subject: Mantis #7802: added debug message to diagnose the problem. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index c21ef81..26f000a 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -259,6 +259,8 @@ namespace OpenSim.Server.Handlers.Simulation } bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason); + m_log.DebugFormat("[AGENT HANDLER]: QueryAccess returned {0} ({1}). Version={2}, {3}/{4}", + result, reason, version, inboundVersion, outboundVersion); resp["success"] = OSD.FromBoolean(result); resp["reason"] = OSD.FromString(reason); -- cgit v1.1 From c94c929ec16a9731e636b30e6536f39ee7ad1ecf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 22 Jun 2016 18:35:14 -0700 Subject: Amend to previous commit -- set the culture also on the receiving end. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 26f000a..364f1fd 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -120,6 +120,8 @@ namespace OpenSim.Server.Handlers.Simulation protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID) { + Culture.SetCurrentCulture(); + EntityTransferContext ctx = new EntityTransferContext(); if (m_SimulationService == null) -- cgit v1.1 From cc9ff129880d5f27693a8cc3f4b2ca47b69d3bcb Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 22 Jun 2016 20:18:16 -0700 Subject: Set culture also in object crossings. --- OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs index dbb1a15..1b545ac 100644 --- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs @@ -69,6 +69,8 @@ namespace OpenSim.Server.Handlers.Simulation //m_log.Debug(" >> http-method=" + request["http-method"]); //m_log.Debug("---------------------------\n"); + Culture.SetCurrentCulture(); + Hashtable responsedata = new Hashtable(); responsedata["content_type"] = "text/html"; -- cgit v1.1 From ea8f3c83bf96453e8223d918933d5708fa49a3cc Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 4 Jul 2016 03:35:48 +0100 Subject: Finally remove the requirement for an InventoryItem/FolderBase object to be passed into inventory queries. This makes the API more homogenous and also will more clearly show coding errors related to HG inventory where the .Owner field has a meaning for a query but wasn't always set. --- .../Handlers/Inventory/InventoryServerInConnector.cs | 18 ++++++++++++++---- .../Server/Handlers/Inventory/XInventoryInConnector.cs | 12 ++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index b295446..0bab5aa 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs @@ -114,12 +114,12 @@ namespace OpenSim.Server.Handlers.Inventory "POST", "/DeleteItem/", DeleteItems, CheckAuthSession)); m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/QueryItem/", m_InventoryService.GetItem, CheckAuthSession)); + new RestDeserialiseSecureHandler( + "POST", "/QueryItem/", GetItem, CheckAuthSession)); m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/QueryFolder/", m_InventoryService.GetFolder, CheckAuthSession)); + new RestDeserialiseSecureHandler( + "POST", "/QueryFolder/", GetFolder, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseTrustedHandler( @@ -205,6 +205,16 @@ namespace OpenSim.Server.Handlers.Inventory return new Dictionary(); } + public InventoryItemBase GetItem(Guid guid) + { + return m_InventoryService.GetItem(UUID.Zero, new UUID(guid)); + } + + public InventoryFolderBase GetFolder(Guid guid) + { + return m_InventoryService.GetFolder(UUID.Zero, new UUID(guid)); + } + public InventoryCollection GetFolderContent(Guid guid) { return m_InventoryService.GetFolderContent(UUID.Zero, new UUID(guid)); diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 5c4e7a9..96d6451 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -566,9 +566,11 @@ namespace OpenSim.Server.Handlers.Inventory Dictionary result = new Dictionary(); UUID id = UUID.Zero; UUID.TryParse(request["ID"].ToString(), out id); + UUID user = UUID.Zero; + if (request.ContainsKey("PRINCIPAL")) + UUID.TryParse(request["PRINCIPAL"].ToString(), out user); - InventoryItemBase item = new InventoryItemBase(id); - item = m_InventoryService.GetItem(item); + InventoryItemBase item = m_InventoryService.GetItem(user, id); if (item != null) result["item"] = EncodeItem(item); @@ -617,9 +619,11 @@ namespace OpenSim.Server.Handlers.Inventory Dictionary result = new Dictionary(); UUID id = UUID.Zero; UUID.TryParse(request["ID"].ToString(), out id); + UUID user = UUID.Zero; + if (request.ContainsKey("PRINCIPAL")) + UUID.TryParse(request["PRINCIPAL"].ToString(), out user); - InventoryFolderBase folder = new InventoryFolderBase(id); - folder = m_InventoryService.GetFolder(folder); + InventoryFolderBase folder = m_InventoryService.GetFolder(user, id); if (folder != null) result["folder"] = EncodeFolder(folder); -- cgit v1.1 From 9f88273741cbe2bb46535fd0061258bbc695a121 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 17 Aug 2016 06:24:58 +0100 Subject: add GetMultiAccounts USER SERVICE HANDLER. UNTESTED !!! --- .../UserAccounts/UserAccountServerPostHandler.cs | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index 21eb790..9efe741 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -103,6 +103,8 @@ namespace OpenSim.Server.Handlers.UserAccounts return GetAccount(request); case "getaccounts": return GetAccounts(request); + case "getmultiaccounts": + return GetMultiAccounts(request); case "setaccount": if (m_AllowSetAccount) return StoreAccount(request); @@ -201,6 +203,50 @@ namespace OpenSim.Server.Handlers.UserAccounts return Util.UTF8NoBomEncoding.GetBytes(xmlString); } + byte[] GetMultiAccounts(Dictionary request) + { + UUID scopeID = UUID.Zero; + if (request.ContainsKey("ScopeID") && !UUID.TryParse(request["ScopeID"].ToString(), out scopeID)) + return FailureResult(); + + if (!request.ContainsKey("IDS")) + { + m_log.DebugFormat("[USER SERVICE HANDLER]: GetMultiAccounts called without required uuids argument"); + return FailureResult(); + } + + if (!(request["IDS"] is List)) + { + m_log.DebugFormat("[USER SERVICE HANDLER]: GetMultiAccounts input argument was of unexpected type {0}", request["IDS"].GetType().ToString()); + return FailureResult(); + } + + List userIDs = (List)request["IDS"]; + + List accounts = m_UserAccountService.GetUserAccounts(scopeID, userIDs); + + Dictionary result = new Dictionary(); + if ((accounts == null) || ((accounts != null) && (accounts.Count == 0))) + { + result["result"] = "null"; + } + else + { + int i = 0; + foreach (UserAccount acc in accounts) + { + Dictionary rinfoDict = acc.ToKeyValuePairs(); + result["account" + i] = rinfoDict; + i++; + } + } + + string xmlString = ServerUtils.BuildXmlResponse(result); + + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + } + byte[] StoreAccount(Dictionary request) { UUID principalID = UUID.Zero; -- cgit v1.1 From 9c75f8a57e205cc33b0cbf97745ab7ead46da399 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 18 Aug 2016 14:35:28 +0100 Subject: avoid NULL refs --- OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | 2 ++ OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs | 2 ++ 2 files changed, 4 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index b63b594..8806c2c 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs @@ -228,6 +228,8 @@ namespace OpenSim.Server.Handlers.GridUser int i = 0; foreach (GridUserInfo pinfo in pinfos) { + if(pinfo == null) + continue; Dictionary rinfoDict = pinfo.ToKeyValuePairs(); result["griduser" + i] = rinfoDict; i++; diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index 9efe741..237ffc7 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -235,6 +235,8 @@ namespace OpenSim.Server.Handlers.UserAccounts int i = 0; foreach (UserAccount acc in accounts) { + if(acc == null) + continue; Dictionary rinfoDict = acc.ToKeyValuePairs(); result["account" + i] = rinfoDict; i++; -- cgit v1.1 From 82244cca68328db002e2c00a693d64781737cf7c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 20 Aug 2016 22:41:53 +0100 Subject: Allow creation of user appearance from a model avatar. Thank you, Cinder, for this patch. Signed-off-by: Melanie Thielker --- .../Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index 237ffc7..b22c4cc 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -328,12 +328,16 @@ namespace OpenSim.Server.Handlers.UserAccounts if (request.ContainsKey("Email")) email = request["Email"].ToString(); + string model = ""; + if (request.ContainsKey("Model")) + model = request["Model"].ToString(); + UserAccount createdUserAccount = null; if (m_UserAccountService is UserAccountService) createdUserAccount = ((UserAccountService)m_UserAccountService).CreateUser( - scopeID, principalID, firstName, lastName, password, email); + scopeID, principalID, firstName, lastName, password, email, model); if (createdUserAccount == null) return FailureResult(); @@ -393,4 +397,4 @@ namespace OpenSim.Server.Handlers.UserAccounts return Util.UTF8NoBomEncoding.GetBytes(xmlString); } } -} \ No newline at end of file +} -- cgit v1.1 From ed6d9199ce48c7913cf7b8d084ee2afe922e3045 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 Aug 2016 11:52:52 +0100 Subject: coment some debug messages --- OpenSim/Server/Handlers/Land/LandHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Land/LandHandlers.cs b/OpenSim/Server/Handlers/Land/LandHandlers.cs index b45289a..150eaae 100644 --- a/OpenSim/Server/Handlers/Land/LandHandlers.cs +++ b/OpenSim/Server/Handlers/Land/LandHandlers.cs @@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Land ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]); uint x = Convert.ToUInt32(requestData["x"]); uint y = Convert.ToUInt32(requestData["y"]); - m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle); +// m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle); byte regionAccess; LandData landData = m_LocalService.GetLandData(UUID.Zero, regionHandle, x, y, out regionAccess); -- cgit v1.1 From 55680c9cd62d35e8687f53c923a3e0c775000581 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 Aug 2016 01:34:21 +0100 Subject: potencial null ref --- OpenSim/Server/Base/ServicesServerBase.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 1f2c54d..a7cffd7 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -139,10 +139,12 @@ namespace OpenSim.Server.Base startupConfig = Config.Configs["Startup"]; } - ConfigDirectory = startupConfig.GetString("ConfigDirectory", "."); - - prompt = startupConfig.GetString("Prompt", prompt); + if (startupConfig != null) + { + ConfigDirectory = startupConfig.GetString("ConfigDirectory", "."); + prompt = startupConfig.GetString("Prompt", prompt); + } // Allow derived classes to load config before the console is opened. ReadConfig(); -- cgit v1.1 From 5645abf69c3a6951f87ff75854e0daefbe625e01 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 Nov 2016 00:13:21 +0000 Subject: fix a debug message --- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 86fda36..38629b2 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -579,13 +579,13 @@ namespace OpenSim.Server.Handlers.Grid if (request.ContainsKey("SCOPEID")) UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); else - m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); + m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get RegionFlags"); UUID regionID = UUID.Zero; if (request.ContainsKey("REGIONID")) UUID.TryParse(request["REGIONID"].ToString(), out regionID); else - m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); + m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get RegionFlags"); int flags = m_GridService.GetRegionFlags(scopeID, regionID); // m_log.DebugFormat("[GRID HANDLER]: flags for region {0}: {1}", regionID, flags); -- cgit v1.1 From 93d502e0cf5d6822d950a4e29c5d5fea9513f9ce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 03:19:19 +0000 Subject: HG UserAgent, return serverURI --- OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index e112e0e..37feabe 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -139,6 +139,7 @@ namespace OpenSim.Server.Handlers.Hypergrid hash["region_name"] = regInfo.RegionName; hash["hostname"] = regInfo.ExternalHostName; hash["http_port"] = regInfo.HttpPort.ToString(); + hash["server_uri"] = regInfo.ServerURI; hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); hash["position"] = position.ToString(); hash["lookAt"] = lookAt.ToString(); -- cgit v1.1 From e2b580e56906f76e74abfdac5a11a1c1bbc31252 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 03:51:38 +0000 Subject: HG LinkRegion sends region size also --- OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index c7ac9be..cb15138 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs @@ -70,13 +70,17 @@ namespace OpenSim.Server.Handlers.Hypergrid string imageURL = string.Empty; ulong regionHandle = 0; string reason = string.Empty; + int sizeX = 256; + int sizeY = 256; - bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out externalName, out imageURL, out reason); + bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out externalName, out imageURL, out reason, out sizeX, out sizeY); Hashtable hash = new Hashtable(); hash["result"] = success.ToString(); hash["uuid"] = regionID.ToString(); hash["handle"] = regionHandle.ToString(); + hash["size_x"] = sizeX; + hash["size_y"] = sizeY; hash["region_image"] = imageURL; hash["external_name"] = externalName; -- cgit v1.1 From 155f8dac1d894b6323197893fa5dc3d61823786d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 27 Nov 2016 02:12:12 +0000 Subject: BUG fix encoding or region size on HG LinkRegionRequest response --- OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index cb15138..2d0b2b6 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs @@ -79,8 +79,8 @@ namespace OpenSim.Server.Handlers.Hypergrid hash["result"] = success.ToString(); hash["uuid"] = regionID.ToString(); hash["handle"] = regionHandle.ToString(); - hash["size_x"] = sizeX; - hash["size_y"] = sizeY; + hash["size_x"] = sizeX.ToString(); + hash["size_y"] = sizeY.ToString(); hash["region_image"] = imageURL; hash["external_name"] = externalName; -- cgit v1.1 From 049dd374e9becc12b3e36e42d217f79ebf09ad45 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 7 Dec 2016 12:23:40 +0000 Subject: add SSL certs validation options for robust to allow simple certificates, possible only for encriptation without any peer autentification. disable validation by default for the small grids case --- OpenSim/Server/ServerMain.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index ed5a481..190f60f 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -30,6 +30,8 @@ using log4net; using System.Reflection; using System; using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; using System.Collections.Generic; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; @@ -51,6 +53,26 @@ namespace OpenSim.Server new List(); protected static PluginLoader loader; + private static bool m_NoVerifyCertChain = false; + private static bool m_NoVerifyCertHostname = false; + + public static bool ValidateServerCertificate( + object sender, + X509Certificate certificate, + X509Chain chain, + SslPolicyErrors sslPolicyErrors) + { + if (m_NoVerifyCertChain) + sslPolicyErrors &= ~SslPolicyErrors.RemoteCertificateChainErrors; + + if (m_NoVerifyCertHostname) + sslPolicyErrors &= ~SslPolicyErrors.RemoteCertificateNameMismatch; + + if (sslPolicyErrors == SslPolicyErrors.None) + return true; + + return false; + } public static int Main(string[] args) { @@ -69,6 +91,11 @@ namespace OpenSim.Server throw new Exception("Configuration error"); } + m_NoVerifyCertChain = serverConfig.GetBoolean("NoVerifyCertChain", m_NoVerifyCertChain); + m_NoVerifyCertHostname = serverConfig.GetBoolean("NoVerifyCertHostname", m_NoVerifyCertHostname); + + ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; + string connList = serverConfig.GetString("ServiceConnectors", String.Empty); registryLocation = serverConfig.GetString("RegistryLocation","."); -- cgit v1.1 From 3a81642d979a84c5c2e666cb500e080d56f887ed Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 7 Dec 2016 13:30:07 +0000 Subject: add SSL certs validation options for regions to allow simple encriptation without any peer autentification using simple homemade (or even shared) certs. --- OpenSim/Server/ServerMain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 190f60f..9d6a3d0 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -79,6 +79,7 @@ namespace OpenSim.Server // Make sure we don't get outbound connections queueing ServicePointManager.DefaultConnectionLimit = 50; ServicePointManager.UseNagleAlgorithm = false; + ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; m_Server = new HttpServerBase("R.O.B.U.S.T.", args); @@ -94,7 +95,6 @@ namespace OpenSim.Server m_NoVerifyCertChain = serverConfig.GetBoolean("NoVerifyCertChain", m_NoVerifyCertChain); m_NoVerifyCertHostname = serverConfig.GetBoolean("NoVerifyCertHostname", m_NoVerifyCertHostname); - ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; string connList = serverConfig.GetString("ServiceConnectors", String.Empty); -- cgit v1.1 From 82fb737b8d655187b25267efc8b2da368cfe1e9f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Dec 2016 08:20:35 +0000 Subject: HG: add missing information on GetRegion --- OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index 2d0b2b6..6bd24db 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs @@ -125,6 +125,7 @@ namespace OpenSim.Server.Handlers.Hypergrid hash["hostname"] = regInfo.ExternalHostName; hash["http_port"] = regInfo.HttpPort.ToString(); hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); + hash["server_uri"] = regInfo.ServerURI; } if (message != null) -- cgit v1.1 From 0ae2b5ac8134230fd5f1bcd668647afb5b345baf Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 22 Dec 2016 18:23:04 +0000 Subject: Allow the use of modular configs with Robust as we already can with OpenSim --- OpenSim/Server/Base/ServicesServerBase.cs | 148 +++++++++++++++++++++++++----- 1 file changed, 123 insertions(+), 25 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index a7cffd7..e18594f 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -55,11 +55,7 @@ namespace OpenSim.Server.Base // protected string[] m_Arguments; - public string ConfigDirectory - { - get; - private set; - } + protected string m_configDirectory = "."; // Run flag // @@ -101,31 +97,24 @@ namespace OpenSim.Server.Base logConfig =startupConfig.GetString("logconfig", logConfig); } - // Find out of the file name is a URI and remote load it if possible. - // Load it as a local file otherwise. - Uri configUri; + Config = ReadConfigSource(iniFile); - try + List sources = new List(); + sources.Add(iniFile); + + int sourceIndex = 1; + + while (AddIncludes(Config, sources)) { - if (Uri.TryCreate(iniFile, UriKind.Absolute, out configUri) && - configUri.Scheme == Uri.UriSchemeHttp) + for ( ; sourceIndex < sources.Count ; ++sourceIndex) { - XmlReader r = XmlReader.Create(iniFile); - Config = new XmlConfigSource(r); - } - else - { - Config = new IniConfigSource(iniFile); + IConfigSource s = ReadConfigSource(sources[sourceIndex]); + Config.Merge(s); } } - catch (Exception e) - { - System.Console.WriteLine("Error reading from config source. {0}", e.Message); - Environment.Exit(1); - } // Merge OpSys env vars - m_log.Info("[CONFIG]: Loading environment variables for Config"); + Console.WriteLine("[CONFIG]: Loading environment variables for Config"); Util.MergeEnvironmentToConfig(Config); // Merge the configuration from the command line into the loaded file @@ -141,7 +130,7 @@ namespace OpenSim.Server.Base if (startupConfig != null) { - ConfigDirectory = startupConfig.GetString("ConfigDirectory", "."); + m_configDirectory = startupConfig.GetString("ConfigDirectory", m_configDirectory); prompt = startupConfig.GetString("Prompt", prompt); } @@ -241,5 +230,114 @@ namespace OpenSim.Server.Base protected virtual void Initialise() { } + + /// + /// Adds the included files as ini configuration files + /// + /// List of URL strings or filename strings + private bool AddIncludes(IConfigSource configSource, List sources) + { + bool sourcesAdded = false; + + //loop over config sources + foreach (IConfig config in configSource.Configs) + { + // Look for Include-* in the key name + string[] keys = config.GetKeys(); + foreach (string k in keys) + { + if (k.StartsWith("Include-")) + { + // read the config file to be included. + string file = config.GetString(k); + if (IsUri(file)) + { + if (!sources.Contains(file)) + { + sourcesAdded = true; + sources.Add(file); + } + } + else + { + string basepath = Path.GetFullPath(m_configDirectory); + // Resolve relative paths with wildcards + string chunkWithoutWildcards = file; + string chunkWithWildcards = string.Empty; + int wildcardIndex = file.IndexOfAny(new char[] { '*', '?' }); + if (wildcardIndex != -1) + { + chunkWithoutWildcards = file.Substring(0, wildcardIndex); + chunkWithWildcards = file.Substring(wildcardIndex); + } + string path = Path.Combine(basepath, chunkWithoutWildcards); + path = Path.GetFullPath(path) + chunkWithWildcards; + string[] paths = Util.Glob(path); + + // If the include path contains no wildcards, then warn the user that it wasn't found. + if (wildcardIndex == -1 && paths.Length == 0) + { + Console.WriteLine("[CONFIG]: Could not find include file {0}", path); + } + else + { + foreach (string p in paths) + { + if (!sources.Contains(p)) + { + sourcesAdded = true; + sources.Add(p); + } + } + } + } + } + } + } + + return sourcesAdded; + } + + /// + /// Check if we can convert the string to a URI + /// + /// String uri to the remote resource + /// true if we can convert the string to a Uri object + bool IsUri(string file) + { + Uri configUri; + + return Uri.TryCreate(file, UriKind.Absolute, + out configUri) && configUri.Scheme == Uri.UriSchemeHttp; + } + + IConfigSource ReadConfigSource(string iniFile) + { + // Find out of the file name is a URI and remote load it if possible. + // Load it as a local file otherwise. + Uri configUri; + IConfigSource s = null; + + try + { + if (Uri.TryCreate(iniFile, UriKind.Absolute, out configUri) && + configUri.Scheme == Uri.UriSchemeHttp) + { + XmlReader r = XmlReader.Create(iniFile); + s = new XmlConfigSource(r); + } + else + { + s = new IniConfigSource(iniFile); + } + } + catch (Exception e) + { + System.Console.WriteLine("Error reading from config source. {0}", e.Message); + Environment.Exit(1); + } + + return s; + } } -} \ No newline at end of file +} -- cgit v1.1 From f03a6bbc616c3c9ce8dadce6059cf7899ef91b9b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 2 Jan 2017 17:47:20 +0000 Subject: Create a generic way for passing constructor args to plugins The old syntax didn't allow for any parameters except for services listed in the ServiceList. Now, services loaded by other services can also be made to use different ini sections or have additional paramters. Syntax is: [@]...[:] --- OpenSim/Server/Base/ServerUtils.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 18a4266..57d0a8d 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -242,6 +242,18 @@ namespace OpenSim.Server.Base className = parts[2]; } + // Handle extra string arguments in a more generic way + if (dllName.Contains("@")) + { + string[] dllNameParts = dllName.Split(new char[] {'@'}); + dllName = dllNameParts[dllNameParts.Length - 1]; + List argList = new List(args); + for (int i = 0 ; i < dllNameParts.Length - 1 ; ++i) + argList.Add(dllNameParts[i]); + + args = argList.ToArray(); + } + return LoadPlugin(dllName, className, args); } -- cgit v1.1 From 504a69906b1ced5691128174fcebabc6d433294a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 3 Jan 2017 14:05:37 +0000 Subject: Suppress error messages in the log if functions are not enabled. Just return failure instead. --- OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index b22c4cc..a02255f 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -98,7 +98,7 @@ namespace OpenSim.Server.Handlers.UserAccounts if (m_AllowCreateUser) return CreateUser(request); else - break; + return FailureResult(); case "getaccount": return GetAccount(request); case "getaccounts": @@ -109,7 +109,7 @@ namespace OpenSim.Server.Handlers.UserAccounts if (m_AllowSetAccount) return StoreAccount(request); else - break; + return FailureResult(); } m_log.DebugFormat("[USER SERVICE HANDLER]: unknown method request: {0}", method); -- cgit v1.1 From b16abc8166c29585cb76cc55c3bdd76e5833cb4f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 5 Jan 2017 19:07:37 +0000 Subject: Massive tab and trailing space cleanup --- OpenSim/Server/Base/CommandManager.cs | 90 ++++++++--------- OpenSim/Server/Base/HttpServerBase.cs | 2 +- OpenSim/Server/Base/Properties/AssemblyInfo.cs | 8 +- OpenSim/Server/Base/ProtocolVersions.cs | 14 +-- OpenSim/Server/Base/ServerUtils.cs | 42 ++++---- OpenSim/Server/Base/ServicesServerBase.cs | 4 +- .../Server/Handlers/Asset/AssetServerConnector.cs | 14 +-- .../Server/Handlers/Asset/AssetServerGetHandler.cs | 4 +- .../Asset/Tests/AssetServerPostHandlerTests.cs | 12 +-- .../AuthenticationServerPostHandler.cs | 20 ++-- .../Authentication/OpenIdServerConnector.cs | 2 +- .../Handlers/Authentication/OpenIdServerHandler.cs | 6 +- .../AuthorizationServerPostHandler.cs | 2 +- .../Handlers/Avatar/AvatarServerPostHandler.cs | 6 +- .../Server/Handlers/BakedTextures/XBakesHandler.cs | 2 +- OpenSim/Server/Handlers/Base/ServerConnector.cs | 6 +- OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | 10 +- .../Server/Handlers/Grid/GridServerPostHandler.cs | 10 +- OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | 2 +- .../Handlers/Hypergrid/HGFriendServerConnector.cs | 2 +- .../Hypergrid/HGFriendsServerPostHandler.cs | 12 +-- .../Hypergrid/InstantMessageServerConnector.cs | 2 +- .../Handlers/Hypergrid/UserAgentServerConnector.cs | 4 +- .../Inventory/InventoryServerInConnector.cs | 6 +- .../Handlers/Inventory/XInventoryInConnector.cs | 4 +- .../Server/Handlers/Land/LandServiceInConnector.cs | 2 +- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 8 +- .../Handlers/Login/LLLoginServiceInConnector.cs | 4 +- .../Server/Handlers/Map/MapAddServerConnector.cs | 2 +- .../Handlers/Map/MapRemoveServerConnector.cs | 2 +- .../Server/Handlers/Neighbour/NeighbourHandlers.cs | 2 +- .../Neighbour/NeighbourServiceInConnector.cs | 2 +- .../Handlers/Presence/PresenceServerPostHandler.cs | 4 +- .../Handlers/Profiles/UserProfilesConnector.cs | 6 +- .../Handlers/Profiles/UserProfilesHandlers.cs | 108 ++++++++++----------- OpenSim/Server/Handlers/Properties/AssemblyInfo.cs | 8 +- .../Server/Handlers/Simulation/AgentHandlers.cs | 10 +- OpenSim/Server/Properties/AssemblyInfo.cs | 8 +- OpenSim/Server/ServerMain.cs | 4 +- 39 files changed, 228 insertions(+), 228 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/CommandManager.cs b/OpenSim/Server/Base/CommandManager.cs index bd18485..b6e2903 100644 --- a/OpenSim/Server/Base/CommandManager.cs +++ b/OpenSim/Server/Base/CommandManager.cs @@ -41,117 +41,117 @@ namespace OpenSim.Server.Base { /// /// Command manager - - /// Wrapper for OpenSim.Framework.PluginManager to allow + /// Wrapper for OpenSim.Framework.PluginManager to allow /// us to add commands to the console to perform operations /// on our repos and plugins /// - public class CommandManager - { - public AddinRegistry PluginRegistry; - protected PluginManager PluginManager; + public class CommandManager + { + public AddinRegistry PluginRegistry; + protected PluginManager PluginManager; - public CommandManager(AddinRegistry registry) + public CommandManager(AddinRegistry registry) { - PluginRegistry = registry; - PluginManager = new PluginManager(PluginRegistry); - AddManagementCommands(); - } - - private void AddManagementCommands() - { - // add plugin - MainConsole.Instance.Commands.AddCommand("Plugin", true, + PluginRegistry = registry; + PluginManager = new PluginManager(PluginRegistry); + AddManagementCommands(); + } + + private void AddManagementCommands() + { + // add plugin + MainConsole.Instance.Commands.AddCommand("Plugin", true, "plugin add", "plugin add \"plugin index\"", - "Install plugin from repository.", + "Install plugin from repository.", HandleConsoleInstallPlugin); - // remove plugin + // remove plugin MainConsole.Instance.Commands.AddCommand("Plugin", true, "plugin remove", "plugin remove \"plugin index\"", - "Remove plugin from repository", + "Remove plugin from repository", HandleConsoleUnInstallPlugin); - // list installed plugins + // list installed plugins MainConsole.Instance.Commands.AddCommand("Plugin", true, - "plugin list installed", - "plugin list installed","List install plugins", + "plugin list installed", + "plugin list installed","List install plugins", HandleConsoleListInstalledPlugin); - // list plugins available from registered repositories + // list plugins available from registered repositories MainConsole.Instance.Commands.AddCommand("Plugin", true, "plugin list available", - "plugin list available","List available plugins", + "plugin list available","List available plugins", HandleConsoleListAvailablePlugin); - // List available updates + // List available updates MainConsole.Instance.Commands.AddCommand("Plugin", true, "plugin updates", "plugin updates","List availble updates", HandleConsoleListUpdates); - // Update plugin + // Update plugin MainConsole.Instance.Commands.AddCommand("Plugin", true, "plugin update", "plugin update \"plugin index\"","Update the plugin", HandleConsoleUpdatePlugin); - // Add repository + // Add repository MainConsole.Instance.Commands.AddCommand("Repository", true, "repo add", "repo add \"url\"","Add repository", HandleConsoleAddRepo); - // Refresh repo + // Refresh repo MainConsole.Instance.Commands.AddCommand("Repository", true, "repo refresh", "repo refresh \"url\"", "Sync with a registered repository", HandleConsoleGetRepo); - // Remove repository from registry + // Remove repository from registry MainConsole.Instance.Commands.AddCommand("Repository", true, "repo remove", - "repo remove \"[url | index]\"", - "Remove repository from registry", + "repo remove \"[url | index]\"", + "Remove repository from registry", HandleConsoleRemoveRepo); - // Enable repo + // Enable repo MainConsole.Instance.Commands.AddCommand("Repository", true, "repo enable", "repo enable \"[url | index]\"", - "Enable registered repository", + "Enable registered repository", HandleConsoleEnableRepo); - // Disable repo + // Disable repo MainConsole.Instance.Commands.AddCommand("Repository", true, "repo disable", "repo disable\"[url | index]\"", - "Disable registered repository", + "Disable registered repository", HandleConsoleDisableRepo); - // List registered repositories + // List registered repositories MainConsole.Instance.Commands.AddCommand("Repository", true, "repo list", "repo list", - "List registered repositories", + "List registered repositories", HandleConsoleListRepos); - // * + // * MainConsole.Instance.Commands.AddCommand("Plugin", true, "plugin info", "plugin info \"plugin index\"","Show detailed information for plugin", HandleConsoleShowAddinInfo); - // Plugin disable + // Plugin disable MainConsole.Instance.Commands.AddCommand("Plugin", true, "plugin disable", "plugin disable \"plugin index\"", - "Disable a plugin", + "Disable a plugin", HandleConsoleDisablePlugin); - // Enable plugin + // Enable plugin MainConsole.Instance.Commands.AddCommand("Plugin", true, "plugin enable", "plugin enable \"plugin index\"", - "Enable the selected plugin plugin", + "Enable the selected plugin plugin", HandleConsoleEnablePlugin); } - + #region console handlers // Handle our console commands // // Install plugin from registered repository /// /// Handles the console install plugin command. Attempts to install the selected plugin - /// and + /// and /// /// /// Module. @@ -323,7 +323,7 @@ namespace OpenSim.Server.Base { if (cmd.Length >= 3) { - + Dictionary result = new Dictionary(); int ndx = Convert.ToInt16(cmd[2]); @@ -355,5 +355,5 @@ namespace OpenSim.Server.Base return; } #endregion - } + } } \ No newline at end of file diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 42a8c57..3357250 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -112,7 +112,7 @@ namespace OpenSim.Server.Base MainServer.Instance = httpServer; // If https_listener = true, then add an ssl listener on the https_port... - if (ssl_listener == true) + if (ssl_listener == true) { uint https_port = (uint)networkConfig.GetInt("https_port", 0); diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs index 02931e7..4be0f25 100644 --- a/OpenSim/Server/Base/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenSim.Server.Base")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,7 +25,7 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // diff --git a/OpenSim/Server/Base/ProtocolVersions.cs b/OpenSim/Server/Base/ProtocolVersions.cs index 5c2278c..27eed4c 100644 --- a/OpenSim/Server/Base/ProtocolVersions.cs +++ b/OpenSim/Server/Base/ProtocolVersions.cs @@ -31,20 +31,20 @@ namespace OpenSim.Server.Base { /// /// This is the external protocol versions. It is separate from the OpenSimulator project version. - /// + /// /// These version numbers should be increased by 1 every time a code - /// change in the Service.Connectors and Server.Handlers, espectively, + /// change in the Service.Connectors and Server.Handlers, espectively, /// makes the previous OpenSimulator revision incompatible - /// with the new revision. - /// + /// with the new revision. + /// /// Changes which are compatible with an older revision (e.g. older revisions experience degraded functionality /// but not outright failure) do not need a version number increment. - /// + /// /// Having this version number allows the grid service to reject connections from regions running a version - /// of the code that is too old. + /// of the code that is too old. /// /// - + // The range of acceptable servers for client-side connectors public readonly static int ClientProtocolVersionMin = 1; public readonly static int ClientProtocolVersionMax = 1; diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 57d0a8d..b17d7ba 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -104,7 +104,7 @@ namespace OpenSim.Server.Base // libomv, which has a hard-coded path to "." for pinvoke // to load the openjpeg dll // - // Will look for a way to fix, but for now this keeps the + // Will look for a way to fix, but for now this keeps the // confusion to a minimum. this was copied from our region // plugin loader, we have been doing this in there for a long time. // @@ -183,7 +183,7 @@ namespace OpenSim.Server.Base if(port != 0) server = MainServer.GetHttpServer(port); - else + else server = MainServer.Instance; return server; @@ -222,19 +222,19 @@ namespace OpenSim.Server.Base // This is good to debug configuration problems //if (dllName == string.Empty) // Util.PrintCallStack(); - + string className = String.Empty; // The path for a dynamic plugin will contain ":" on Windows string[] parts = dllName.Split (new char[] {':'}); - if (parts [0].Length > 1) + if (parts [0].Length > 1) { dllName = parts [0]; if (parts.Length > 1) className = parts[1]; - } - else + } + else { // This is Windows - we must replace the ":" in the path dllName = String.Format ("{0}:{1}", parts [0], parts [1]); @@ -242,17 +242,17 @@ namespace OpenSim.Server.Base className = parts[2]; } - // Handle extra string arguments in a more generic way - if (dllName.Contains("@")) - { - string[] dllNameParts = dllName.Split(new char[] {'@'}); - dllName = dllNameParts[dllNameParts.Length - 1]; - List argList = new List(args); - for (int i = 0 ; i < dllNameParts.Length - 1 ; ++i) - argList.Add(dllNameParts[i]); + // Handle extra string arguments in a more generic way + if (dllName.Contains("@")) + { + string[] dllNameParts = dllName.Split(new char[] {'@'}); + dllName = dllNameParts[dllNameParts.Length - 1]; + List argList = new List(args); + for (int i = 0 ; i < dllNameParts.Length - 1 ; ++i) + argList.Add(dllNameParts[i]); - args = argList.ToArray(); - } + args = argList.ToArray(); + } return LoadPlugin(dllName, className, args); } @@ -276,10 +276,10 @@ namespace OpenSim.Server.Base { if (pluginType.IsPublic) { - if (className != String.Empty + if (className != String.Empty && pluginType.ToString() != pluginType.Namespace + "." + className) continue; - + Type typeInterface = pluginType.GetInterface(interfaceName); if (typeInterface != null) @@ -295,8 +295,8 @@ namespace OpenSim.Server.Base if (!(e is System.MissingMethodException)) { m_log.Error(string.Format("[SERVER UTILS]: Error loading plugin {0} from {1}. Exception: {2}", - interfaceName, - dllName, + interfaceName, + dllName, e.InnerException == null ? e.Message : e.InnerException.Message), e); } @@ -479,7 +479,7 @@ namespace OpenSim.Server.Base XmlDocument doc = new XmlDocument(); doc.LoadXml(data); - + XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse"); if (rootL.Count != 1) diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index e18594f..f60b5fb 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -92,7 +92,7 @@ namespace OpenSim.Server.Base // Check if a prompt was given on the command line prompt = startupConfig.GetString("prompt", prompt); - + // Check for a Log4Net config file on the command line logConfig =startupConfig.GetString("logconfig", logConfig); } @@ -116,7 +116,7 @@ namespace OpenSim.Server.Base // Merge OpSys env vars Console.WriteLine("[CONFIG]: Loading environment variables for Config"); Util.MergeEnvironmentToConfig(Config); - + // Merge the configuration from the command line into the loaded file Config.Merge(argvConfig); diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index ab81dd6..bad3ea2 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs @@ -151,27 +151,27 @@ namespace OpenSim.Server.Handlers.Asset MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid ID format", rawAssetId); return; } - + AssetBase asset = m_AssetService.Get(assetId.ToString()); if (asset == null) - { + { MainConsole.Instance.OutputFormat("ERROR: No asset found with ID {0}", assetId); - return; + return; } - + string fileName = rawAssetId; if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, fileName)) return; - + using (FileStream fs = new FileStream(fileName, FileMode.CreateNew)) { using (BinaryWriter bw = new BinaryWriter(fs)) { bw.Write(asset.Data); } - } - + } + MainConsole.Instance.OutputFormat("Asset dumped to file {0}", fileName); } diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index 91c5c54..8bfc690 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs @@ -53,7 +53,7 @@ namespace OpenSim.Server.Handlers.Asset public AssetServerGetHandler(IAssetService service) : base("GET", "/assets") { - m_AssetService = service; + m_AssetService = service; } public AssetServerGetHandler(IAssetService service, IServiceAuth auth, string redirectURL) : @@ -155,7 +155,7 @@ namespace OpenSim.Server.Handlers.Asset httpResponse.ContentType = "text/plain"; result = new byte[0]; } - + if (httpResponse.StatusCode == (int)HttpStatusCode.NotFound && !string.IsNullOrEmpty(m_RedirectURL) && !string.IsNullOrEmpty(id)) { httpResponse.StatusCode = (int)HttpStatusCode.Redirect; diff --git a/OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs b/OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs index faa6fb7..4d2228a 100644 --- a/OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs +++ b/OpenSim/Server/Handlers/Asset/Tests/AssetServerPostHandlerTests.cs @@ -52,8 +52,8 @@ namespace OpenSim.Server.Handlers.Asset.Test UUID assetId = TestHelpers.ParseTail(0x1); - IConfigSource config = new IniConfigSource(); - config.AddConfig("AssetService"); + IConfigSource config = new IniConfigSource(); + config.AddConfig("AssetService"); config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); AssetService assetService = new AssetService(config); @@ -72,7 +72,7 @@ namespace OpenSim.Server.Handlers.Asset.Test XmlSerializer serializer = new XmlSerializer(typeof(AssetBase)); serializer.Serialize(writer, asset); writer.Flush(); - } + } buffer.Position = 0; asph.Handle(null, buffer, null, null); @@ -87,13 +87,13 @@ namespace OpenSim.Server.Handlers.Asset.Test { TestHelpers.InMethod(); - IConfigSource config = new IniConfigSource(); - config.AddConfig("AssetService"); + IConfigSource config = new IniConfigSource(); + config.AddConfig("AssetService"); config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); AssetService assetService = new AssetService(config); - AssetServerPostHandler asph = new AssetServerPostHandler(assetService); + AssetServerPostHandler asph = new AssetServerPostHandler(assetService); MemoryStream buffer = new MemoryStream(); byte[] badData = new byte[] { 0x48, 0x65, 0x6c, 0x6c, 0x6f }; diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index 6ee98b3..d3ea7e2 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs @@ -132,41 +132,41 @@ namespace OpenSim.Server.Handlers.Authentication case "authenticate": if (!request.ContainsKey("PASSWORD")) return FailureResult(); - + token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"].ToString(), lifetime); - + if (token != String.Empty) return SuccessResult(token); return FailureResult(); - + case "setpassword": if (!m_AllowSetPassword) return FailureResult(); if (!request.ContainsKey("PASSWORD")) return FailureResult(); - + if (m_AuthenticationService.SetPassword(principalID, request["PASSWORD"].ToString())) return SuccessResult(); else return FailureResult(); - + case "verify": if (!request.ContainsKey("TOKEN")) return FailureResult(); - + if (m_AuthenticationService.Verify(principalID, request["TOKEN"].ToString(), lifetime)) return SuccessResult(); - + return FailureResult(); - + case "release": if (!request.ContainsKey("TOKEN")) return FailureResult(); - + if (m_AuthenticationService.Release(principalID, request["TOKEN"].ToString())) return SuccessResult(); - + return FailureResult(); case "getauthinfo": diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs index 6464399..ac8ff52 100644 --- a/OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs +++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs @@ -41,7 +41,7 @@ namespace OpenSim.Server.Handlers.Authentication private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - + private IAuthenticationService m_AuthenticationService; private IUserAccountService m_UserAccountService; private string m_ConfigName = "OpenIdService"; diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs index b201dc7..a6605a1 100644 --- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs @@ -178,14 +178,14 @@ namespace OpenSim.Server.Handlers.Authentication "; /// Page shown for an invalid OpenID identity - const string INVALID_OPENID_PAGE = + const string INVALID_OPENID_PAGE = @"Identity not found Invalid OpenID identity"; /// Page shown if the OpenID endpoint is requested directly const string ENDPOINT_PAGE = @"OpenID Endpoint -This is an OpenID server endpoint, not a human-readable resource. +This is an OpenID server endpoint, not a human-readable resource. For more information, see http://openid.net/. "; @@ -241,7 +241,7 @@ For more information, see http://openid.net/. // Check for form POST data if (passwordValues != null && passwordValues.Length == 1) { - if (account != null && + if (account != null && (m_authenticationService.Authenticate(account.PrincipalID,Util.Md5Hash(passwordValues[0]), 30) != string.Empty)) authRequest.IsAuthenticated = true; else diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs index c9b4e9b..310a542 100644 --- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs @@ -67,7 +67,7 @@ namespace OpenSim.Server.Handlers.Authorization xs = new XmlSerializer(typeof(AuthorizationResponse)); return ServerUtils.SerializeResult(xs, result); - + } } } diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs index ff8699f..69c1a89 100644 --- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs @@ -175,7 +175,7 @@ namespace OpenSim.Server.Handlers.Avatar request.Remove("METHOD"); request.Remove("UserID"); } - + byte[] SetItems(Dictionary request) { UUID user = UUID.Zero; @@ -196,7 +196,7 @@ namespace OpenSim.Server.Handlers.Avatar names = _names.ToArray(); List _values = (List)request["Values"]; values = _values.ToArray(); - + if (m_AvatarService.SetItems(user, names, values)) return SuccessResult(); @@ -227,7 +227,7 @@ namespace OpenSim.Server.Handlers.Avatar } - + private byte[] SuccessResult() { XmlDocument doc = new XmlDocument(); diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs index 4c12967..4386a2d 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs @@ -61,7 +61,7 @@ namespace OpenSim.Server.Handlers.BakedTextures ServerUtils.LoadPlugin(assetService, args); IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); - + server.AddStreamHandler(new BakesServerGetHandler(m_BakesService, auth)); server.AddStreamHandler(new BakesServerPostHandler(m_BakesService, auth)); } diff --git a/OpenSim/Server/Handlers/Base/ServerConnector.cs b/OpenSim/Server/Handlers/Base/ServerConnector.cs index 72014db..0a4df54 100644 --- a/OpenSim/Server/Handlers/Base/ServerConnector.cs +++ b/OpenSim/Server/Handlers/Base/ServerConnector.cs @@ -72,7 +72,7 @@ namespace OpenSim.Server.Handlers.Base // We call this from our plugin module to get our configuration public IConfig GetConfig() - { + { IConfig config = null; config = ServerUtils.GetConfig(ConfigFile, ConfigName); @@ -96,12 +96,12 @@ namespace OpenSim.Server.Handlers.Base // We get our remote initial configuration for bootstrapping in case // we have no configuration in our main file or in an existing - // modular config file. This is the last resort to bootstrap the + // modular config file. This is the last resort to bootstrap the // configuration, likely a new plugin loading for the first time. private IConfigSource GetConfigSource() { IConfigSource source = null; - + source = ServerUtils.LoadInitialConfig(ConfigURL); if (source == null) diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index 346af32..2aec045 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs @@ -83,10 +83,10 @@ namespace OpenSim.Server.Handlers.Grid { _info["login"] = String.Format( - "http://127.0.0.1:{0}/", + "http://127.0.0.1:{0}/", netCfg.GetString( "http_listener_port", ConfigSettings.DefaultRegionHttpPort.ToString())); - + IssueWarning(); } else @@ -99,7 +99,7 @@ namespace OpenSim.Server.Handlers.Grid { _log.Warn("[GRID INFO SERVICE]: Cannot get grid info from config source, using minimal defaults"); } - + _log.DebugFormat("[GRID INFO SERVICE]: Grid info service initialized with {0} keys", _info.Count); } @@ -107,7 +107,7 @@ namespace OpenSim.Server.Handlers.Grid { _log.Warn("[GRID INFO SERVICE]: found no [GridInfo] section in your configuration files"); _log.Warn("[GRID INFO SERVICE]: trying to guess sensible defaults, you might want to provide better ones:"); - + foreach (string k in _info.Keys) { _log.WarnFormat("[GRID INFO SERVICE]: {0}: {1}", k, _info[k]); @@ -181,7 +181,7 @@ namespace OpenSim.Server.Handlers.Grid new string[] { "Startup", "Hypergrid" }, String.Empty); if (!String.IsNullOrEmpty(HomeURI)) - map["home"] = OSD.FromString(HomeURI); + map["home"] = OSD.FromString(HomeURI); else // Legacy. Remove soon! { IConfig cfg = m_Config.Configs["LoginService"]; diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 38629b2..f51c4ee 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -126,7 +126,7 @@ namespace OpenSim.Server.Handlers.Grid case "get_grid_extra_features": return GetGridExtraFeatures(request); } - + m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method); } catch (Exception e) @@ -590,22 +590,22 @@ namespace OpenSim.Server.Handlers.Grid int flags = m_GridService.GetRegionFlags(scopeID, regionID); // m_log.DebugFormat("[GRID HANDLER]: flags for region {0}: {1}", regionID, flags); - Dictionary result = new Dictionary(); + Dictionary result = new Dictionary(); result["result"] = flags.ToString(); string xmlString = ServerUtils.BuildXmlResponse(result); - + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); return Util.UTF8NoBomEncoding.GetBytes(xmlString); } - + byte[] GetGridExtraFeatures(Dictionary request) { Dictionary result = new Dictionary (); Dictionary extraFeatures = m_GridService.GetExtraFeatures (); - foreach (string key in extraFeatures.Keys) + foreach (string key in extraFeatures.Keys) { result [key] = extraFeatures [key]; } diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs index f3d678f..684d1a8 100644 --- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs @@ -52,7 +52,7 @@ namespace OpenSim.Server.Handlers.Hypergrid public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentPostHandler { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + private IGatekeeperService m_GatekeeperService; public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy) : base("/foreignagent") diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs index 6c79c60..870a5ef 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendServerConnector.cs @@ -48,7 +48,7 @@ namespace OpenSim.Server.Handlers.Hypergrid } // Called from standalone configurations - public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName, IFriendsSimConnector localConn) + public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName, IFriendsSimConnector localConn) : base(config, server, configName) { if (configName != string.Empty) diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index 37b47ed..8116050 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs @@ -61,7 +61,7 @@ namespace OpenSim.Server.Handlers.Hypergrid m_UserAgentService = uas; m_FriendsLocalSimConnector = friendsConn; - m_log.DebugFormat("[HGFRIENDS HANDLER]: HGFriendsServerPostHandler is On ({0})", + m_log.DebugFormat("[HGFRIENDS HANDLER]: HGFriendsServerPostHandler is On ({0})", (m_FriendsLocalSimConnector == null ? "robust" : "standalone")); if (m_TheService == null) @@ -105,24 +105,24 @@ namespace OpenSim.Server.Handlers.Hypergrid case "validate_friendship_offered": return ValidateFriendshipOffered(request); - + case "statusnotification": return StatusNotification(request); /* case "friendship_approved": return FriendshipApproved(request); - + case "friendship_denied": return FriendshipDenied(request); - + case "friendship_terminated": return FriendshipTerminated(request); - + case "grant_rights": return GrantRights(request); */ } - + m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0}", method); } catch (Exception e) diff --git a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs index 8145a21..63f376d 100644 --- a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs @@ -55,7 +55,7 @@ namespace OpenSim.Server.Handlers.Hypergrid public InstantMessageServerConnector(IConfigSource config, IHttpServer server) : this(config, server, (IInstantMessageSimConnector)null) - { + { } public InstantMessageServerConnector(IConfigSource config, IHttpServer server, string configName) : diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index 37feabe..394b133 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -63,14 +63,14 @@ namespace OpenSim.Server.Handlers.Hypergrid public UserAgentServerConnector(IConfigSource config, IHttpServer server) : this(config, server, (IFriendsSimConnector)null) - { + { } public UserAgentServerConnector(IConfigSource config, IHttpServer server, string configName) : this(config, server) { } - + public UserAgentServerConnector(IConfigSource config, IHttpServer server, IFriendsSimConnector friendsConnector) : base(config, server, String.Empty) { diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index 0bab5aa..e90b869 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs @@ -61,7 +61,7 @@ namespace OpenSim.Server.Handlers.Inventory { if (configName != string.Empty) m_ConfigName = configName; - + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); @@ -92,7 +92,7 @@ namespace OpenSim.Server.Handlers.Inventory m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler( "POST", "/GetFolderContent/", GetFolderContent, CheckAuthSession)); - + m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler( "POST", "/UpdateFolder/", m_InventoryService.UpdateFolder, CheckAuthSession)); @@ -151,7 +151,7 @@ namespace OpenSim.Server.Handlers.Inventory m_httpServer.AddStreamHandler(new InventoryServerMoveItemsHandler(m_InventoryService)); - + // for persistent active gestures m_httpServer.AddStreamHandler( new RestDeserialiseTrustedHandler> diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 96d6451..4400395 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -293,7 +293,7 @@ namespace OpenSim.Server.Handlers.Inventory result["FID"] = icoll.FolderID.ToString(); result["VERSION"] = icoll.Version.ToString(); Dictionary folders = new Dictionary(); - int i = 0; + int i = 0; if (icoll.Folders != null) { foreach (InventoryFolderBase f in icoll.Folders) @@ -407,7 +407,7 @@ namespace OpenSim.Server.Handlers.Inventory } } result["ITEMS"] = sitems; - + string xmlString = ServerUtils.BuildXmlResponse(result); //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); diff --git a/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs b/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs index d368bd3..c4b339f 100644 --- a/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs @@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Land m_log.Error("[LAND IN CONNECTOR]: Land service was not provided"); return; } - + //bool authentication = neighbourConfig.GetBoolean("RequireAuthentication", false); //if (authentication) // m_AuthenticationService = scene.RequestModuleInterface(); diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 5d672c3..072429a 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -53,7 +53,7 @@ namespace OpenSim.Server.Handlers.Login private ILoginService m_LocalService; private bool m_Proxy; - + public LLLoginHandlers(ILoginService service, bool hasProxy) { @@ -136,7 +136,7 @@ namespace OpenSim.Server.Handlers.Login bool LibOMVclient = false; if (request.Params.Count > 4 && (string)request.Params[4] == "gridproxy") LibOMVclient = true; - + LoginResponse reply = null; reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient, LibOMVclient); @@ -279,11 +279,11 @@ namespace OpenSim.Server.Handlers.Login sock.Close("success"); } }; - + sock.HandshakeAndUpgrade(); } - + private XmlRpcResponse FailedXMLRPCResponse() { diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs index f60e892..56ac3c2 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs @@ -98,7 +98,7 @@ namespace OpenSim.Server.Handlers.Login m_DosProtectionOptions.ForgetTimeSpan = TimeSpan.FromMilliseconds(serverConfig.GetInt("DOSForgiveClientAfterMS", 120000)); m_DosProtectionOptions.ReportingName = "LOGINDOSPROTECTION"; - + return loginService; } @@ -106,7 +106,7 @@ namespace OpenSim.Server.Handlers.Login private void InitializeHandlers(IHttpServer server) { LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy); - server.AddXmlRPCHandler("login_to_simulator", + server.AddXmlRPCHandler("login_to_simulator", new XmlRpcBasicDOSProtector(loginHandlers.HandleXMLRPCLogin,loginHandlers.HandleXMLRPCLoginBlocked, m_DosProtectionOptions).Process, false); server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 38dfffc..7611f53 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -148,7 +148,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}", + m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}", ipAddr, x, y); return FailureResult("Region not found at given coordinates"); } diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs index 4f8f7e1..f292b95 100644 --- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -141,7 +141,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}", + m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}", ipAddr, x, y); return FailureResult("Region not found at given coordinates"); } diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs index 3525a01..e3ee467 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs @@ -150,7 +150,7 @@ namespace OpenSim.Server.Handlers.Neighbour // Finally! GridRegion thisRegion = m_NeighbourService.HelloNeighbour(regionhandle, aRegion); - + OSDMap resp = new OSDMap(1); if (thisRegion != null) diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs index ac2e75f..65ac4e6 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs @@ -55,7 +55,7 @@ namespace OpenSim.Server.Handlers.Neighbour m_log.Error("[NEIGHBOUR IN CONNECTOR]: neighbour service was not provided"); return; } - + //bool authentication = neighbourConfig.GetBoolean("RequireAuthentication", false); //if (authentication) // m_AuthenticationService = scene.RequestModuleInterface(); diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 49dbcb5..be16e17 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -158,7 +158,7 @@ namespace OpenSim.Server.Handlers.Presence return FailureResult(); } - + byte[] Report(Dictionary request) { UUID session = UUID.Zero; @@ -241,7 +241,7 @@ namespace OpenSim.Server.Handlers.Presence } string xmlString = ServerUtils.BuildXmlResponse(result); - + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); return Util.UTF8NoBomEncoding.GetBytes(xmlString); } diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs index 2dfb862..eecb370 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs @@ -39,8 +39,8 @@ namespace OpenSim.Server.Handlers.Profiles { public class UserProfilesConnector: ServiceConnector { -// static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - +// static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + // Our Local Module public IUserProfilesService ServiceModule { @@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.Profiles Object[] args = new Object[] { config, ConfigName }; ServiceModule = ServerUtils.LoadPlugin(service, args); - + JsonRpcProfileHandlers handler = new JsonRpcProfileHandlers(ServiceModule); Server.AddJsonRPCHandler("avatarclassifiedsrequest", handler.AvatarClassifiedsRequest); diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index cac38f5..f23a981 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -48,17 +48,17 @@ namespace OpenSim.Server.Handlers static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - + public IUserProfilesService Service { get; private set; } - + public JsonRpcProfileHandlers(IUserProfilesService service) { Service = service; } - + #region Classifieds /// /// Request avatar's classified ads. @@ -80,17 +80,17 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Classified Request"); return false; } - + OSDMap request = (OSDMap)json["params"]; UUID creatorId = new UUID(request["creatorId"].AsString()); - - + + OSDArray data = (OSDArray) Service.AvatarClassifiedsRequest(creatorId); response.Result = data; - + return true; } - + public bool ClassifiedUpdate(OSDMap json, ref JsonRpcResponse response) { if(!json.ContainsKey("params")) @@ -100,7 +100,7 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Classified Update Request"); return false; } - + string result = string.Empty; UserClassifiedAdd ad = new UserClassifiedAdd(); object Ad = (object)ad; @@ -110,12 +110,12 @@ namespace OpenSim.Server.Handlers response.Result = OSD.SerializeMembers(ad); return true; } - + response.Error.Code = ErrorCode.InternalError; response.Error.Message = string.Format("{0}", result); return false; } - + public bool ClassifiedDelete(OSDMap json, ref JsonRpcResponse response) { if(!json.ContainsKey("params")) @@ -124,10 +124,10 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Classified Delete Request"); return false; } - + OSDMap request = (OSDMap)json["params"]; UUID classifiedId = new UUID(request["classifiedId"].AsString()); - + if (Service.ClassifiedDelete(classifiedId)) return true; @@ -135,7 +135,7 @@ namespace OpenSim.Server.Handlers response.Error.Message = "data error removing record"; return false; } - + public bool ClassifiedInfoRequest(OSDMap json, ref JsonRpcResponse response) { if(!json.ContainsKey("params")) @@ -145,7 +145,7 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Classified Info Request"); return false; } - + string result = string.Empty; UserClassifiedAdd ad = new UserClassifiedAdd(); object Ad = (object)ad; @@ -155,13 +155,13 @@ namespace OpenSim.Server.Handlers response.Result = OSD.SerializeMembers(ad); return true; } - + response.Error.Code = ErrorCode.InternalError; response.Error.Message = string.Format("{0}", result); return false; } #endregion Classifieds - + #region Picks public bool AvatarPicksRequest(OSDMap json, ref JsonRpcResponse response) { @@ -171,17 +171,17 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Avatar Picks Request"); return false; } - + OSDMap request = (OSDMap)json["params"]; UUID creatorId = new UUID(request["creatorId"].AsString()); - - + + OSDArray data = (OSDArray) Service.AvatarPicksRequest(creatorId); response.Result = data; - + return true; } - + public bool PickInfoRequest(OSDMap json, ref JsonRpcResponse response) { if(!json.ContainsKey("params")) @@ -191,7 +191,7 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Avatar Picks Info Request"); return false; } - + string result = string.Empty; UserProfilePick pick = new UserProfilePick(); object Pick = (object)pick; @@ -201,12 +201,12 @@ namespace OpenSim.Server.Handlers response.Result = OSD.SerializeMembers(pick); return true; } - + response.Error.Code = ErrorCode.InternalError; response.Error.Message = string.Format("{0}", result); return false; } - + public bool PicksUpdate(OSDMap json, ref JsonRpcResponse response) { if(!json.ContainsKey("params")) @@ -216,7 +216,7 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Avatar Picks Update Request"); return false; } - + string result = string.Empty; UserProfilePick pick = new UserProfilePick(); object Pick = (object)pick; @@ -226,13 +226,13 @@ namespace OpenSim.Server.Handlers response.Result = OSD.SerializeMembers(pick); return true; } - + response.Error.Code = ErrorCode.InternalError; response.Error.Message = "unable to update pick"; - + return false; } - + public bool PicksDelete(OSDMap json, ref JsonRpcResponse response) { if(!json.ContainsKey("params")) @@ -241,18 +241,18 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Avatar Picks Delete Request"); return false; } - + OSDMap request = (OSDMap)json["params"]; UUID pickId = new UUID(request["pickId"].AsString()); if(Service.PicksDelete(pickId)) return true; - + response.Error.Code = ErrorCode.InternalError; response.Error.Message = "data error removing record"; return false; } #endregion Picks - + #region Notes public bool AvatarNotesRequest(OSDMap json, ref JsonRpcResponse response) { @@ -277,7 +277,7 @@ namespace OpenSim.Server.Handlers response.Error.Message = "Error reading notes"; return false; } - + public bool NotesUpdate(OSDMap json, ref JsonRpcResponse response) { if(!json.ContainsKey("params")) @@ -287,7 +287,7 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Avatar Notes Update Request"); return false; } - + string result = string.Empty; UserProfileNotes note = new UserProfileNotes(); object Notes = (object) note; @@ -300,7 +300,7 @@ namespace OpenSim.Server.Handlers return true; } #endregion Notes - + #region Profile Properties public bool AvatarPropertiesRequest(OSDMap json, ref JsonRpcResponse response) { @@ -311,7 +311,7 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Avatar Properties Request"); return false; } - + string result = string.Empty; UserProfileProperties props = new UserProfileProperties(); object Props = (object)props; @@ -321,12 +321,12 @@ namespace OpenSim.Server.Handlers response.Result = OSD.SerializeMembers(props); return true; } - + response.Error.Code = ErrorCode.InternalError; response.Error.Message = string.Format("{0}", result); return false; } - + public bool AvatarPropertiesUpdate(OSDMap json, ref JsonRpcResponse response) { if(!json.ContainsKey("params")) @@ -336,7 +336,7 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Avatar Properties Update Request"); return false; } - + string result = string.Empty; UserProfileProperties props = new UserProfileProperties(); object Props = (object)props; @@ -346,13 +346,13 @@ namespace OpenSim.Server.Handlers response.Result = OSD.SerializeMembers(props); return true; } - + response.Error.Code = ErrorCode.InternalError; response.Error.Message = string.Format("{0}", result); return false; } #endregion Profile Properties - + #region Interests public bool AvatarInterestsUpdate(OSDMap json, ref JsonRpcResponse response) { @@ -363,7 +363,7 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Avatar Interests Update Request"); return false; } - + string result = string.Empty; UserProfileProperties props = new UserProfileProperties(); object Props = (object)props; @@ -373,7 +373,7 @@ namespace OpenSim.Server.Handlers response.Result = OSD.SerializeMembers(props); return true; } - + response.Error.Code = ErrorCode.InternalError; response.Error.Message = string.Format("{0}", result); return false; @@ -399,7 +399,7 @@ namespace OpenSim.Server.Handlers response.Result = OSD.SerializeMembers(prefs); return true; } - + response.Error.Code = ErrorCode.InternalError; response.Error.Message = string.Format("{0}", result); // m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message); @@ -415,7 +415,7 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("User Preferences Update Request"); return false; } - + string result = string.Empty; UserPreferences prefs = new UserPreferences(); object Prefs = (object)prefs; @@ -425,7 +425,7 @@ namespace OpenSim.Server.Handlers response.Result = OSD.SerializeMembers(prefs); return true; } - + response.Error.Code = ErrorCode.InternalError; response.Error.Message = string.Format("{0}", result); m_log.InfoFormat("[PROFILES]: User preferences update error - {0}", response.Error.Message); @@ -443,13 +443,13 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("Avatar Image Assets Request"); return false; } - + OSDMap request = (OSDMap)json["params"]; UUID avatarId = new UUID(request["avatarId"].AsString()); OSDArray data = (OSDArray) Service.AvatarImageAssetsRequest(avatarId); response.Result = data; - + return true; } #endregion Utiltiy @@ -464,7 +464,7 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("User Application Service URL Request: No Parameters!"); return false; } - + string result = string.Empty; UserAppData props = new UserAppData(); object Props = (object)props; @@ -475,15 +475,15 @@ namespace OpenSim.Server.Handlers res["result"] = OSD.FromString("success"); res["token"] = OSD.FromString (result); response.Result = res; - + return true; } - + response.Error.Code = ErrorCode.InternalError; response.Error.Message = string.Format("{0}", result); return false; } - + public bool UpdateUserAppData(OSDMap json, ref JsonRpcResponse response) { if(!json.ContainsKey("params")) @@ -493,7 +493,7 @@ namespace OpenSim.Server.Handlers m_log.DebugFormat ("User App Data Update Request"); return false; } - + string result = string.Empty; UserAppData props = new UserAppData(); object Props = (object)props; @@ -503,7 +503,7 @@ namespace OpenSim.Server.Handlers response.Result = OSD.SerializeMembers(props); return true; } - + response.Error.Code = ErrorCode.InternalError; response.Error.Message = string.Format("{0}", result); return false; diff --git a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs index 7d3665b..4d6402f 100644 --- a/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Handlers/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenSim.Server.Handlers")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,7 +25,7 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 364f1fd..4e1f72e 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -190,7 +190,7 @@ namespace OpenSim.Server.Handlers.Simulation { // If there is no version in the packet at all we're looking at 0.6 or // even more ancient. Refuse it. - if(theirVersion == 0f) + if(theirVersion == 0f) { resp["success"] = OSD.FromBoolean(false); resp["reason"] = OSD.FromString("Your region is running a old version of opensim no longer supported. Consider updating it"); @@ -199,8 +199,8 @@ namespace OpenSim.Server.Handlers.Simulation } version = theirVersion; - - if (version < VersionInfo.SimulationServiceVersionAcceptedMin || + + if (version < VersionInfo.SimulationServiceVersionAcceptedMin || version > VersionInfo.SimulationServiceVersionAcceptedMax ) { resp["success"] = OSD.FromBoolean(false); @@ -274,7 +274,7 @@ namespace OpenSim.Server.Handlers.Simulation OSDArray featuresWanted = new OSDArray(); foreach (UUID feature in features) featuresWanted.Add(OSD.FromString(feature.ToString())); - + resp["features"] = featuresWanted; // We must preserve defaults here, otherwise a false "success" will not be put into the JSON map! @@ -460,7 +460,7 @@ namespace OpenSim.Server.Handlers.Simulation source.RegionLocY = Int32.Parse(args["source_y"].AsString()); source.RegionName = args["source_name"].AsString(); source.RegionID = UUID.Parse(args["source_uuid"].AsString()); - + if (args.ContainsKey("source_server_uri")) source.RawServerURI = args["source_server_uri"].AsString(); else diff --git a/OpenSim/Server/Properties/AssemblyInfo.cs b/OpenSim/Server/Properties/AssemblyInfo.cs index ee45e10..6d15078 100644 --- a/OpenSim/Server/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Robust")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,7 +25,7 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index ed5a481..c343044 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -59,7 +59,7 @@ namespace OpenSim.Server ServicePointManager.UseNagleAlgorithm = false; m_Server = new HttpServerBase("R.O.B.U.S.T.", args); - + string registryLocation; IConfig serverConfig = m_Server.Config.Configs["Startup"]; @@ -70,7 +70,7 @@ namespace OpenSim.Server } string connList = serverConfig.GetString("ServiceConnectors", String.Empty); - + registryLocation = serverConfig.GetString("RegistryLocation","."); IConfig servicesConfig = m_Server.Config.Configs["ServiceList"]; -- cgit v1.1 From 14d6d6f7a5c9da0dada36a4624325fb030db799a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 11 Jan 2017 23:05:06 +0000 Subject: Also add the ability to quit on SIGTERM for ROBUST --- OpenSim/Server/Base/ServicesServerBase.cs | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index f60b5fb..d151de6 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -61,6 +61,9 @@ namespace OpenSim.Server.Base // private bool m_Running = true; + private static Mono.Unix.UnixSignal[] signals; + + // Handle all the automagical stuff // public ServicesServerBase(string prompt, string[] args) : base() @@ -183,6 +186,39 @@ namespace OpenSim.Server.Base RegisterCommonCommands(); RegisterCommonComponents(Config); + Thread signal_thread = new Thread (delegate () + { + while (true) + { + // Wait for a signal to be delivered + int index = Mono.Unix.UnixSignal.WaitAny (signals, -1); + + //Mono.Unix.Native.Signum signal = signals [index].Signum; + ShutdownSpecific(); + m_Running = false; + Environment.Exit(0); + } + }); + + if(!Util.IsWindows()) + { + try + { + // linux mac os specifics + signals = new Mono.Unix.UnixSignal[] + { + new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM) + }; + signal_thread.Start(); + } + catch (Exception e) + { + m_log.Info("Could not set up UNIX signal handlers. SIGTERM will not"); + m_log.InfoFormat("shut down gracefully: {0}", e.Message); + m_log.Debug("Exception was: ", e); + } + } + // Allow derived classes to perform initialization that // needs to be done after the console has opened Initialise(); -- cgit v1.1 From ae191cd3042fec6b753b41b19907d236690a70cf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 May 2017 15:57:47 +0100 Subject: dispose some MemoryStreams --- OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs index f292b95..ffd8ef6 100644 --- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -215,13 +215,16 @@ namespace OpenSim.Server.Handlers.MapImage private byte[] DocToBytes(XmlDocument doc) { - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, null); - xw.Formatting = Formatting.Indented; - doc.WriteTo(xw); - xw.Flush(); - + using(MemoryStream ms = new MemoryStream()) + { + using(XmlTextWriter xw = new XmlTextWriter(ms,null)) + { + xw.Formatting = Formatting.Indented; + doc.WriteTo(xw); + xw.Flush(); + } return ms.ToArray(); + } } private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) -- cgit v1.1 From d0912b61516914f810ba306641aaaa813134462e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 7 May 2017 00:47:45 +0100 Subject: let StreamReader be in using statements --- .../Handlers/Authentication/AuthenticationServerPostHandler.cs | 8 ++++---- OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs | 5 ++++- OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs | 6 +++--- OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs | 6 ++---- OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs | 7 ++++--- OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs | 6 +++--- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 6 +++--- OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | 6 +++--- OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs | 6 +++--- OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 6 +++--- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 6 +++--- OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs | 6 +++--- .../Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs | 6 +++--- 13 files changed, 41 insertions(+), 39 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index d3ea7e2..4f03cf4 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs @@ -82,11 +82,11 @@ namespace OpenSim.Server.Handlers.Authentication switch (p[0]) { case "plain": - StreamReader sr = new StreamReader(request); - string body = sr.ReadToEnd(); - sr.Close(); - + string body; + using(StreamReader sr = new StreamReader(request)) + body = sr.ReadToEnd(); return DoPlainMethods(body); + case "crypt": byte[] buffer = new byte[request.Length]; long length = request.Length; diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs index a6605a1..254b82f 100644 --- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs @@ -222,7 +222,10 @@ For more information, see http://openid.net/. try { - NameValueCollection postQuery = HttpUtility.ParseQueryString(new StreamReader(httpRequest.InputStream).ReadToEnd()); + string forPost; + using(StreamReader sr = new StreamReader(httpRequest.InputStream)) + forPost = sr.ReadToEnd(); + NameValueCollection postQuery = HttpUtility.ParseQueryString(forPost); NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query); NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery); diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs index 69c1a89..b8fdacf 100644 --- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs @@ -60,9 +60,9 @@ namespace OpenSim.Server.Handlers.Avatar protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - StreamReader sr = new StreamReader(requestData); - string body = sr.ReadToEnd(); - sr.Close(); + string body; + using(StreamReader sr = new StreamReader(requestData)) + body = sr.ReadToEnd(); body = body.Trim(); //m_log.DebugFormat("[XXX]: query String: {0}", body); diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs index 24f63d9..d16000d 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs @@ -65,10 +65,8 @@ namespace OpenSim.Server.Handlers.BakedTextures return new byte[0]; } - StreamReader sr = new StreamReader(request); - - m_BakesService.Store(p[0], sr.ReadToEnd()); - sr.Close(); + using(StreamReader sr = new StreamReader(request)) + m_BakesService.Store(p[0],sr.ReadToEnd()); return new byte[0]; } diff --git a/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs b/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs index e0c2810..b7558ec 100644 --- a/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs +++ b/OpenSim/Server/Handlers/Estate/EstateDataRobustConnector.cs @@ -282,9 +282,10 @@ namespace OpenSim.Server.Handlers // /estates/estate/?eid=int®ion=uuid if ("estate".Equals(resource)) { - StreamReader sr = new StreamReader(request); - string body = sr.ReadToEnd(); - sr.Close(); + string body; + using(StreamReader sr = new StreamReader(request)) + body = sr.ReadToEnd(); + body = body.Trim(); Dictionary requestData = ServerUtils.ParseQueryString(body); diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index 3aab30b..d6668ab 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs @@ -61,9 +61,9 @@ namespace OpenSim.Server.Handlers.Friends protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - StreamReader sr = new StreamReader(requestData); - string body = sr.ReadToEnd(); - sr.Close(); + string body; + using(StreamReader sr = new StreamReader(requestData)) + body = sr.ReadToEnd(); body = body.Trim(); //m_log.DebugFormat("[XXX]: query String: {0}", body); diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index f51c4ee..44d4654 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -65,9 +65,9 @@ namespace OpenSim.Server.Handlers.Grid protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - StreamReader sr = new StreamReader(requestData); - string body = sr.ReadToEnd(); - sr.Close(); + string body; + using(StreamReader sr = new StreamReader(requestData)) + body = sr.ReadToEnd(); body = body.Trim(); //m_log.DebugFormat("[XXX]: query String: {0}", body); diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 8806c2c..1f691d6 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs @@ -60,9 +60,9 @@ namespace OpenSim.Server.Handlers.GridUser protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - StreamReader sr = new StreamReader(requestData); - string body = sr.ReadToEnd(); - sr.Close(); + string body; + using(StreamReader sr = new StreamReader(requestData)) + body = sr.ReadToEnd(); body = body.Trim(); //m_log.DebugFormat("[XXX]: query String: {0}", body); diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index 8116050..fc1a77d 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs @@ -71,9 +71,9 @@ namespace OpenSim.Server.Handlers.Hypergrid protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - StreamReader sr = new StreamReader(requestData); - string body = sr.ReadToEnd(); - sr.Close(); + string body; + using(StreamReader sr = new StreamReader(requestData)) + body = sr.ReadToEnd(); body = body.Trim(); //m_log.DebugFormat("[XXX]: query String: {0}", body); diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 4400395..742d1a0 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -95,9 +95,9 @@ namespace OpenSim.Server.Handlers.Inventory protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - StreamReader sr = new StreamReader(requestData); - string body = sr.ReadToEnd(); - sr.Close(); + string body; + using(StreamReader sr = new StreamReader(requestData)) + body = sr.ReadToEnd(); body = body.Trim(); //m_log.DebugFormat("[XXX]: query String: {0}", body); diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 7611f53..bfd73a2 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -104,9 +104,9 @@ namespace OpenSim.Server.Handlers.MapImage protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { // m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path); - StreamReader sr = new StreamReader(requestData); - string body = sr.ReadToEnd(); - sr.Close(); + string body; + using(StreamReader sr = new StreamReader(requestData)) + body = sr.ReadToEnd(); body = body.Trim(); try diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs index ffd8ef6..8a3875d 100644 --- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -102,9 +102,9 @@ namespace OpenSim.Server.Handlers.MapImage public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { // m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path); - StreamReader sr = new StreamReader(requestData); - string body = sr.ReadToEnd(); - sr.Close(); + string body; + using(StreamReader sr = new StreamReader(requestData)) + body = sr.ReadToEnd(); body = body.Trim(); try diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index a02255f..bc12ef9 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -72,9 +72,9 @@ namespace OpenSim.Server.Handlers.UserAccounts protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - StreamReader sr = new StreamReader(requestData); - string body = sr.ReadToEnd(); - sr.Close(); + string body; + using(StreamReader sr = new StreamReader(requestData)) + body = sr.ReadToEnd(); body = body.Trim(); // We need to check the authorization header -- cgit v1.1 From 957ca41b13688be27c386e1b1d3db200c1ff0b87 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 May 2017 11:58:07 +0100 Subject: remove file bin/Mono.Posix.dll that causes problems with mono --- OpenSim/Server/Base/ServicesServerBase.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index d151de6..4951776 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -61,8 +61,9 @@ namespace OpenSim.Server.Base // private bool m_Running = true; +#if (_MONO) private static Mono.Unix.UnixSignal[] signals; - +#endif // Handle all the automagical stuff // @@ -186,6 +187,7 @@ namespace OpenSim.Server.Base RegisterCommonCommands(); RegisterCommonComponents(Config); +#if (_MONO) Thread signal_thread = new Thread (delegate () { while (true) @@ -218,6 +220,7 @@ namespace OpenSim.Server.Base m_log.Debug("Exception was: ", e); } } +#endif // Allow derived classes to perform initialization that // needs to be done after the console has opened -- cgit v1.1 From 0f2ab6bddd3faed35f6845e09461f818c74fa0eb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 May 2017 14:20:06 +0100 Subject: soem changes on connections limits --- OpenSim/Server/ServerMain.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index c343044..74bb163 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -54,8 +54,7 @@ namespace OpenSim.Server public static int Main(string[] args) { - // Make sure we don't get outbound connections queueing - ServicePointManager.DefaultConnectionLimit = 50; + ServicePointManager.DefaultConnectionLimit = 4096; ServicePointManager.UseNagleAlgorithm = false; m_Server = new HttpServerBase("R.O.B.U.S.T.", args); -- cgit v1.1 From 948138a3a4ed08b96b12a31049e658c570345a10 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 May 2017 16:45:58 +0100 Subject: lower connection limits again --- OpenSim/Server/ServerMain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 74bb163..6938db7 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -54,7 +54,7 @@ namespace OpenSim.Server public static int Main(string[] args) { - ServicePointManager.DefaultConnectionLimit = 4096; + ServicePointManager.DefaultConnectionLimit = 64; ServicePointManager.UseNagleAlgorithm = false; m_Server = new HttpServerBase("R.O.B.U.S.T.", args); -- cgit v1.1 From 086eb28a9183cd0896fefc51d1a689162bd96299 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 May 2017 22:03:53 +0100 Subject: a bit more on ServicePointManager --- OpenSim/Server/ServerMain.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 6938db7..96b0a82 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -55,6 +55,7 @@ namespace OpenSim.Server public static int Main(string[] args) { ServicePointManager.DefaultConnectionLimit = 64; + ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; m_Server = new HttpServerBase("R.O.B.U.S.T.", args); -- cgit v1.1 From 9ab8ce1404259557cb1412af5b3296ced7228d5b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 14 May 2017 04:17:48 +0100 Subject: fix remote requests for dwell, so dwell module still called --- OpenSim/Server/Handlers/Land/LandHandlers.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Land/LandHandlers.cs b/OpenSim/Server/Handlers/Land/LandHandlers.cs index 150eaae..d74077a 100644 --- a/OpenSim/Server/Handlers/Land/LandHandlers.cs +++ b/OpenSim/Server/Handlers/Land/LandHandlers.cs @@ -85,6 +85,7 @@ namespace OpenSim.Server.Handlers.Land hash["SnapshotID"] = landData.SnapshotID.ToString(); hash["UserLocation"] = landData.UserLocation.ToString(); hash["RegionAccess"] = regionAccess.ToString(); + hash["Dwell"] = landData.Dwell.ToString(); } XmlRpcResponse response = new XmlRpcResponse(); -- cgit v1.1 From 4da5d249d8c92705b16a06641f6ddd93d1bfbfa3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 May 2017 21:22:04 +0100 Subject: receivers can't tell if there where proxies on path unless they look --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 2 +- .../Server/Handlers/Simulation/AgentHandlers.cs | 40 ++++++++++------------ 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 072429a..4e7ab00 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Login public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient) { Hashtable requestData = (Hashtable)request.Params[0]; - if (m_Proxy && request.Params[3] != null) + if (request.Params[3] != null) { IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]); if (ep != null) diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 4e1f72e..bb524e6 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -517,32 +517,30 @@ namespace OpenSim.Server.Handlers.Simulation protected string GetCallerIP(Hashtable request) { - if (!m_Proxy) - return Util.GetCallerIP(request); - - // We're behind a proxy - Hashtable headers = (Hashtable)request["headers"]; - - //// DEBUG - //foreach (object o in headers.Keys) - // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString())); + if (request.ContainsKey("headers")) + { + Hashtable headers = (Hashtable)request["headers"]; - string xff = "X-Forwarded-For"; - if (headers.ContainsKey(xff.ToLower())) - xff = xff.ToLower(); + //// DEBUG + //foreach (object o in headers.Keys) + // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString())); - if (!headers.ContainsKey(xff) || headers[xff] == null) - { - m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); - return Util.GetCallerIP(request); - } + string xff = "X-Forwarded-For"; + if (!headers.ContainsKey(xff)) + xff = xff.ToLower(); - m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); + if (!headers.ContainsKey(xff) || headers[xff] == null) + { + m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); + return Util.GetCallerIP(request); + } - IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); - if (ep != null) - return ep.Address.ToString(); + m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); + IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); + if (ep != null) + return ep.Address.ToString(); + } // Oops return Util.GetCallerIP(request); } -- cgit v1.1 From 24885819fccbecafb83cec81000416843d86a593 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 May 2017 22:04:20 +0100 Subject: check XFF headers of caller, but be quiet about them --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 6 +++--- OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs | 6 +++--- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index bfd73a2..331dabf 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -225,8 +225,8 @@ namespace OpenSim.Server.Handlers.MapImage private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) { - if (!m_Proxy) - return request.RemoteIPEndPoint.Address; +// if (!m_Proxy) +// return request.RemoteIPEndPoint.Address; // We're behind a proxy string xff = "X-Forwarded-For"; @@ -236,7 +236,7 @@ namespace OpenSim.Server.Handlers.MapImage if (xffValue == null || (xffValue != null && xffValue == string.Empty)) { - m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); +// m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); return request.RemoteIPEndPoint.Address; } diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs index 8a3875d..9daeb73 100644 --- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -229,8 +229,8 @@ namespace OpenSim.Server.Handlers.MapImage private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) { - if (!m_Proxy) - return request.RemoteIPEndPoint.Address; +// if (!m_Proxy) +// return request.RemoteIPEndPoint.Address; // We're behind a proxy string xff = "X-Forwarded-For"; @@ -240,7 +240,7 @@ namespace OpenSim.Server.Handlers.MapImage if (xffValue == null || (xffValue != null && xffValue == string.Empty)) { - m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); +// m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); return request.RemoteIPEndPoint.Address; } diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index bb524e6..c52a1ab 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -531,11 +531,11 @@ namespace OpenSim.Server.Handlers.Simulation if (!headers.ContainsKey(xff) || headers[xff] == null) { - m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); +// m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); return Util.GetCallerIP(request); } - m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); +// m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); if (ep != null) -- cgit v1.1 From c080d9fa23775dc89262db4ea2abbfa11f2c0c77 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 00:10:11 +0100 Subject: remember mono about the default for DnsRefreshTimeout --- OpenSim/Server/ServerMain.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 96b0a82..2f2eb28 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -55,6 +55,7 @@ namespace OpenSim.Server public static int Main(string[] args) { ServicePointManager.DefaultConnectionLimit = 64; + ServicePointManager.DnsRefreshTimeout = 120000; // just is case mono decides to have it infinity ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; -- cgit v1.1 From 7b80bcc57a4d7be5d518e83408e063a71ce0eb4c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 00:52:40 +0100 Subject: no all mono versions know DnsRefreshTimeout --- OpenSim/Server/ServerMain.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 2f2eb28..341c227 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -55,10 +55,12 @@ namespace OpenSim.Server public static int Main(string[] args) { ServicePointManager.DefaultConnectionLimit = 64; - ServicePointManager.DnsRefreshTimeout = 120000; // just is case mono decides to have it infinity ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; + try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some mono decides to have it infinity + catch { } + m_Server = new HttpServerBase("R.O.B.U.S.T.", args); string registryLocation; -- cgit v1.1 From dca3a45803a18103113b9eb861da4f79572de924 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 May 2017 22:17:04 +0100 Subject: add a bit more pre exit cleanup --- OpenSim/Server/Base/ServicesServerBase.cs | 3 +++ OpenSim/Server/ServerMain.cs | 6 ++++++ 2 files changed, 9 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 4951776..8db97a8 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -249,6 +249,9 @@ namespace OpenSim.Server.Base } } + MemoryWatchdog.Enabled = false; + Watchdog.Enabled = false; + RemovePIDFile(); return 0; diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 341c227..accf938 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -31,6 +31,7 @@ using System.Reflection; using System; using System.Net; using System.Collections.Generic; +using OpenSim.Framework; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Base; @@ -161,6 +162,11 @@ namespace OpenSim.Server int res = m_Server.Run(); + if(m_Server != null) + m_Server.Shutdown(); + + Util.StopThreadPool(); + Environment.Exit(res); return 0; -- cgit v1.1 From 8195cd5153d736b5b5412e3fc3b5d6458d617ea9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 May 2017 02:24:15 +0100 Subject: another one --- OpenSim/Server/Base/ServicesServerBase.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 8db97a8..2185727 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -211,6 +211,7 @@ namespace OpenSim.Server.Base { new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM) }; + ignal_thread.IsBackground = true; signal_thread.Start(); } catch (Exception e) -- cgit v1.1 From 772c5b7db030eb95da8852d711323244cfa91ab4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 May 2017 06:05:02 +0100 Subject: move assetsconnector threads to whatchdog; Abort all alive threads known to watchdog before exit --- OpenSim/Server/Base/ServicesServerBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 2185727..176e876 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -252,7 +252,7 @@ namespace OpenSim.Server.Base MemoryWatchdog.Enabled = false; Watchdog.Enabled = false; - + WorkManager.Stop(); RemovePIDFile(); return 0; -- cgit v1.1 From e7c2674dec2c9ea36313b51e7bc604753e16f24f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 May 2017 21:26:51 +0100 Subject: cleanup (grid)region info endpoint; add log to try to find some xml decode issues --- OpenSim/Server/Base/ServerUtils.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index b17d7ba..aff6b4f 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -478,17 +478,22 @@ namespace OpenSim.Server.Base XmlDocument doc = new XmlDocument(); - doc.LoadXml(data); - - XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse"); - - if (rootL.Count != 1) - return ret; + try + { + doc.LoadXml(data); + XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse"); - XmlNode rootNode = rootL[0]; + if (rootL.Count != 1) + return ret; - ret = ParseElement(rootNode); + XmlNode rootNode = rootL[0]; + ret = ParseElement(rootNode); + } + catch (Exception e) + { + m_log.DebugFormat("[serverUtils.ParseXmlResponse]: failed error: {0} \n --- string: {1} - ",e.Message, data); + } return ret; } -- cgit v1.1 From 91caf98308e4a5f371f9a25adfb4084ff5bfbc34 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 07:48:09 +0100 Subject: change servicePoint dns expire also to 5min, let the endpoints expire slide. This should reduce impact of absurd dns fails observed on my test ubuntu VM --- OpenSim/Server/ServerMain.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index accf938..69d0b74 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -59,8 +59,7 @@ namespace OpenSim.Server ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; - try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some mono decides to have it infinity - catch { } + try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { } m_Server = new HttpServerBase("R.O.B.U.S.T.", args); -- cgit v1.1 From 803289877307ce0016627f58af382b68a1905327 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 30 Dec 2017 15:28:26 +0000 Subject: mantis 8271: work around missing encoding of estate bans on the pseudo url encode used on POST, without changing the xml also used elsewhere. Possible this can be used in other case --- OpenSim/Server/Base/ServerUtils.cs | 126 ++++++++++++++++++++++++------------- 1 file changed, 81 insertions(+), 45 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index aff6b4f..9fd613f 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -39,7 +39,7 @@ using OpenMetaverse; using Mono.Addins; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers; - +using OpenMetaverse.StructuredData; // LitJson is hidden on this [assembly:AddinRoot("Robust", OpenSim.VersionInfo.VersionNumber)] namespace OpenSim.Server.Base @@ -326,50 +326,63 @@ namespace OpenSim.Server.Base } public static Dictionary ParseQueryString(string query) - { - Dictionary result = new Dictionary(); + { string[] terms = query.Split(new char[] {'&'}); - if (terms.Length == 0) - return result; + int nterms = terms.Length; + if (nterms == 0) + return new Dictionary(); + + Dictionary result = new Dictionary(nterms); + string name; - foreach (string t in terms) + for(int i = 0; i < nterms; ++i) { - string[] elems = t.Split(new char[] {'='}); + string[] elems = terms[i].Split(new char[] {'='}); + if (elems.Length == 0) continue; - string name = System.Web.HttpUtility.UrlDecode(elems[0]); - string value = String.Empty; + if(String.IsNullOrWhiteSpace(elems[0])) + continue; - if (elems.Length > 1) - value = System.Web.HttpUtility.UrlDecode(elems[1]); + name = System.Web.HttpUtility.UrlDecode(elems[0]); if (name.EndsWith("[]")) { - string cleanName = name.Substring(0, name.Length - 2); - if (result.ContainsKey(cleanName)) + name = name.Substring(0, name.Length - 2); + if(String.IsNullOrWhiteSpace(name)) + continue; + if (result.ContainsKey(name)) { - if (!(result[cleanName] is List)) + if (!(result[name] is List)) continue; - List l = (List)result[cleanName]; - - l.Add(value); + List l = (List)result[name]; + if (elems.Length > 1 && !String.IsNullOrWhiteSpace(elems[1])) + l.Add(System.Web.HttpUtility.UrlDecode(elems[1])); + else + l.Add(String.Empty); } else { List newList = new List(); - - newList.Add(value); - - result[cleanName] = newList; + if (elems.Length > 1 && !String.IsNullOrWhiteSpace(elems[1])) + newList.Add(System.Web.HttpUtility.UrlDecode(elems[1])); + else + newList.Add(String.Empty); + result[name] = newList; } } else { if (!result.ContainsKey(name)) - result[name] = value; + { + if (elems.Length > 1 && !String.IsNullOrWhiteSpace(elems[1])) + result[name] = System.Web.HttpUtility.UrlDecode(elems[1]); + else + result[name] = String.Empty; + } } } @@ -378,47 +391,70 @@ namespace OpenSim.Server.Base public static string BuildQueryString(Dictionary data) { - string qstring = String.Empty; + // this is not conform to html url encoding + // can only be used on Body of POST or PUT + StringBuilder sb = new StringBuilder(4096); - string part; + string pvalue; foreach (KeyValuePair kvp in data) { if (kvp.Value is List) { List l = (List)kvp.Value; - - foreach (string s in l) + int llen = l.Count; + string nkey = System.Web.HttpUtility.UrlEncode(kvp.Key); + for(int i = 0; i < llen; ++i) { - part = System.Web.HttpUtility.UrlEncode(kvp.Key) + - "[]=" + System.Web.HttpUtility.UrlEncode(s); - - if (qstring != String.Empty) - qstring += "&"; - - qstring += part; + if (sb.Length != 0) + sb.Append("&"); + sb.Append(nkey); + sb.Append("[]="); + sb.Append(System.Web.HttpUtility.UrlEncode(l[i])); } } - else + else if(kvp.Value is Dictionary) { - if (kvp.Value.ToString() != String.Empty) + // encode complex structures as JSON + // needed for estate bans with the encoding used on xml + // encode can be here because object does contain the structure information + // but decode needs to be on estateSettings (or other user) + string js; + try { - part = System.Web.HttpUtility.UrlEncode(kvp.Key) + - "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString()); + // bypass libovm, we dont need even more useless high level maps + // this should only be called once.. but no problem, i hope + // (other uses may need more..) + LitJson.JsonMapper.RegisterExporter((uuid, writer) => writer.Write(uuid.ToString()) ); + js = LitJson.JsonMapper.ToJson(kvp.Value); } - else + // catch(Exception e) + catch { - part = System.Web.HttpUtility.UrlEncode(kvp.Key); + continue; + } + if (sb.Length != 0) + sb.Append("&"); + sb.Append(System.Web.HttpUtility.UrlEncode(kvp.Key)); + sb.Append("="); + sb.Append(System.Web.HttpUtility.UrlEncode(js)); + } + else + { + if (sb.Length != 0) + sb.Append("&"); + sb.Append(System.Web.HttpUtility.UrlEncode(kvp.Key)); + + pvalue = kvp.Value.ToString(); + if (!String.IsNullOrEmpty(pvalue)) + { + sb.Append("="); + sb.Append(System.Web.HttpUtility.UrlEncode(pvalue)); } - - if (qstring != String.Empty) - qstring += "&"; - - qstring += part; } } - return qstring; + return sb.ToString(); } public static string BuildXmlResponse(Dictionary data) -- cgit v1.1 From a7803409f6aae704375e7582aab7cbe7f3e17283 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 30 Dec 2017 15:46:32 +0000 Subject: clean some extra space chars --- OpenSim/Server/Base/ServerUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 9fd613f..d0043ba 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -326,7 +326,7 @@ namespace OpenSim.Server.Base } public static Dictionary ParseQueryString(string query) - { + { string[] terms = query.Split(new char[] {'&'}); int nterms = terms.Length; -- cgit v1.1 From 48dbba34416e31fa9d525007807b070d0eb25cf9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Jan 2018 20:56:48 +0000 Subject: add more files for robust mutes suport. (module is still named MuteListModuleTst for testing, others in core will be removed later --- .../Handlers/GridUser/GridUserServerConnector.cs | 2 +- .../Handlers/MuteList/MuteListServerConnector.cs | 63 ++++++ .../Handlers/MuteList/MuteListServerPostHandler.cs | 240 +++++++++++++++++++++ 3 files changed, 304 insertions(+), 1 deletion(-) create mode 100644 OpenSim/Server/Handlers/MuteList/MuteListServerConnector.cs create mode 100644 OpenSim/Server/Handlers/MuteList/MuteListServerPostHandler.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs index 1e29378..755272b 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs @@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.GridUser Object[] args = new Object[] { config }; m_GridUserService = ServerUtils.LoadPlugin(service, args); - IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); ; + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService, auth)); } diff --git a/OpenSim/Server/Handlers/MuteList/MuteListServerConnector.cs b/OpenSim/Server/Handlers/MuteList/MuteListServerConnector.cs new file mode 100644 index 0000000..8d27f07 --- /dev/null +++ b/OpenSim/Server/Handlers/MuteList/MuteListServerConnector.cs @@ -0,0 +1,63 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using Nini.Config; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework.ServiceAuth; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Base; + +namespace OpenSim.Server.Handlers.GridUser +{ + public class MuteListServiceConnector : ServiceConnector + { + private IMuteListService m_MuteListService; + private string m_ConfigName = "MuteListService"; + + public MuteListServiceConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) + { + IConfig serverConfig = config.Configs[m_ConfigName]; + if (serverConfig == null) + throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); + + string service = serverConfig.GetString("LocalServiceModule", String.Empty); + + if (service == String.Empty) + throw new Exception("LocalServiceModule not present in MuteListService config file MuteListService section"); + + Object[] args = new Object[] { config }; + m_MuteListService = ServerUtils.LoadPlugin(service, args); + + IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + + server.AddStreamHandler(new MuteListServerPostHandler(m_MuteListService, auth)); + } + } +} diff --git a/OpenSim/Server/Handlers/MuteList/MuteListServerPostHandler.cs b/OpenSim/Server/Handlers/MuteList/MuteListServerPostHandler.cs new file mode 100644 index 0000000..26c4093 --- /dev/null +++ b/OpenSim/Server/Handlers/MuteList/MuteListServerPostHandler.cs @@ -0,0 +1,240 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using Nini.Config; +using log4net; +using System; +using System.Reflection; +using System.IO; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; +using System.Xml.Serialization; +using System.Collections.Generic; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; +using OpenSim.Framework.Servers.HttpServer; +using OpenMetaverse; + +namespace OpenSim.Server.Handlers.GridUser +{ + public class MuteListServerPostHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private IMuteListService m_service; + + public MuteListServerPostHandler(IMuteListService service, IServiceAuth auth) : + base("POST", "/mutelist", auth) + { + m_service = service; + } + + protected override byte[] ProcessRequest(string path, Stream requestData, + IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + string body; + using(StreamReader sr = new StreamReader(requestData)) + body = sr.ReadToEnd(); + body = body.Trim(); + + //m_log.DebugFormat("[XXX]: query String: {0}", body); + string method = string.Empty; + + try + { + Dictionary request = + ServerUtils.ParseQueryString(body); + + if (!request.ContainsKey("METHOD")) + return FailureResult(); + + method = request["METHOD"].ToString(); + + switch (method) + { + case "get": + return getmutes(request); + case "update": + return updatemute(request); + case "delete": + return deletemute(request); + } + m_log.DebugFormat("[MUTELIST HANDLER]: unknown method request: {0}", method); + } + catch (Exception e) + { + m_log.DebugFormat("[MUTELIST HANDLER]: Exception in method {0}: {1}", method, e); + } + + return FailureResult(); + } + + byte[] getmutes(Dictionary request) + { + if(!request.ContainsKey("agentid") || !request.ContainsKey("mutecrc")) + return FailureResult(); + + UUID agentID; + if(!UUID.TryParse(request["agentid"].ToString(), out agentID)) + return FailureResult(); + + uint mutecrc; + if(!UInt32.TryParse(request["mutecrc"].ToString(), out mutecrc)) + return FailureResult(); + + byte[] data = m_service.MuteListRequest(agentID, mutecrc); + + Dictionary result = new Dictionary(); + result["result"] = Convert.ToBase64String(data); + + string xmlString = ServerUtils.BuildXmlResponse(result); + + //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + } + + byte[] updatemute(Dictionary request) + { + if(!request.ContainsKey("agentid") || !request.ContainsKey("muteid")) + return FailureResult(); + + MuteData mute = new MuteData(); + + if( !UUID.TryParse(request["agentid"].ToString(), out mute.AgentID)) + return FailureResult(); + + if(!UUID.TryParse(request["muteid"].ToString(), out mute.MuteID)) + return FailureResult(); + + if(request.ContainsKey("mutename")) + { + mute.MuteName = request["mutename"].ToString(); + } + else + mute.MuteName = String.Empty; + + if(request.ContainsKey("mutetype")) + { + if(!Int32.TryParse(request["mutetype"].ToString(), out mute.MuteType)) + return FailureResult(); + } + else + mute.MuteType = 0; + + if(request.ContainsKey("muteflags")) + { + if(!Int32.TryParse(request["muteflags"].ToString(), out mute.MuteFlags)) + return FailureResult(); + } + else + mute.MuteFlags = 0; + + if(request.ContainsKey("mutestamp")) + { + if(!Int32.TryParse(request["mutestamp"].ToString(), out mute.Stamp)) + return FailureResult(); + } + else + mute.Stamp = Util.UnixTimeSinceEpoch(); + + return m_service.UpdateMute(mute) ? SuccessResult() : FailureResult(); + } + + byte[] deletemute(Dictionary request) + { + if(!request.ContainsKey("agentid") || !request.ContainsKey("muteid")) + return FailureResult(); + + UUID agentID; + if( !UUID.TryParse(request["agentid"].ToString(), out agentID)) + return FailureResult(); + + UUID muteID; + if(!UUID.TryParse(request["muteid"].ToString(), out muteID)) + return FailureResult(); + + string muteName; + if(request.ContainsKey("mutename")) + { + muteName = request["mutename"].ToString(); + + } + else + muteName = String.Empty; + + return m_service.RemoveMute(agentID, muteID, muteName) ? SuccessResult() : FailureResult(); + } + + private byte[] SuccessResult() + { + XmlDocument doc = new XmlDocument(); + + XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, + "", ""); + + doc.AppendChild(xmlnode); + + XmlElement rootElement = doc.CreateElement("", "ServerResponse", + ""); + + doc.AppendChild(rootElement); + + XmlElement result = doc.CreateElement("", "result", ""); + result.AppendChild(doc.CreateTextNode("Success")); + + rootElement.AppendChild(result); + + return Util.DocToBytes(doc); + } + + private byte[] FailureResult() + { + XmlDocument doc = new XmlDocument(); + + XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, + "", ""); + + doc.AppendChild(xmlnode); + + XmlElement rootElement = doc.CreateElement("", "ServerResponse", + ""); + + doc.AppendChild(rootElement); + + XmlElement result = doc.CreateElement("", "result", ""); + result.AppendChild(doc.CreateTextNode("Failure")); + + rootElement.AppendChild(result); + + return Util.DocToBytes(doc); + } + } +} -- cgit v1.1 From ec6f87d3eff699ca28214629d360c15e5df13156 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Jan 2018 23:51:43 +0000 Subject: disable some XmlResolver --- OpenSim/Server/Base/ServerUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index d0043ba..cc506bc 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -513,7 +513,7 @@ namespace OpenSim.Server.Base Dictionary ret = new Dictionary(); XmlDocument doc = new XmlDocument(); - + doc.XmlResolver = null; try { doc.LoadXml(data); -- cgit v1.1 From 707eb8de8284c1f3e27565a0dff99ed1563b42ee Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 17 Jan 2018 07:17:24 +0000 Subject: remove more xml things no longer needed on .net >4.5.2 --- OpenSim/Server/Base/ServerUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index cc506bc..d0043ba 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -513,7 +513,7 @@ namespace OpenSim.Server.Base Dictionary ret = new Dictionary(); XmlDocument doc = new XmlDocument(); - doc.XmlResolver = null; + try { doc.LoadXml(data); -- cgit v1.1 From 7c60e83f3052cc1a13d088838556f485f3c54e99 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 26 Aug 2018 08:37:30 +0100 Subject: don't shutdown robust twice --- OpenSim/Server/Base/ServicesServerBase.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 176e876..900327a 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -260,6 +260,8 @@ namespace OpenSim.Server.Base protected override void ShutdownSpecific() { + if(!m_Running) + return; m_Running = false; m_log.Info("[CONSOLE] Quitting"); -- cgit v1.1 From 37dcb8722c8bdb110dc9ad2f8e330dd93cdf402c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2018 22:32:34 +0100 Subject: make sure Culture is right on some spots --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index c52a1ab..1c1930a 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -156,7 +156,7 @@ namespace OpenSim.Server.Handlers.Simulation string theirVersionStr = args["my_version"].AsString(); string[] parts = theirVersionStr.Split(new char[] {'/'}); if (parts.Length > 1) - theirVersion = float.Parse(parts[1]); + theirVersion = float.Parse(parts[1], Culture.FormatProvider); } if (args.ContainsKey("context")) @@ -266,7 +266,7 @@ namespace OpenSim.Server.Handlers.Simulation resp["success"] = OSD.FromBoolean(result); resp["reason"] = OSD.FromString(reason); - string legacyVersion = String.Format("SIMULATION/{0}", version); + string legacyVersion = String.Format(Culture.FormatProvider,"SIMULATION/{0}", version); resp["version"] = OSD.FromString(legacyVersion); resp["negotiated_inbound_version"] = OSD.FromReal(inboundVersion); resp["negotiated_outbound_version"] = OSD.FromReal(outboundVersion); -- cgit v1.1 From 5a0c9c2fcf76ebe430602885c526f687a64f3cc1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 27 Sep 2018 19:04:11 +0100 Subject: more on culture issues --- OpenSim/Server/ServerMain.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 4b7fd8a..09f6920 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -77,6 +77,9 @@ namespace OpenSim.Server public static int Main(string[] args) { + Culture.SetCurrentCulture(); + Culture.SetDefaultCurrentCulture(); + ServicePointManager.DefaultConnectionLimit = 64; ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; -- cgit v1.1 From ed0e2623b9dd9e12f7660bb067166c294ad8a2ee Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 29 Sep 2018 17:42:12 +0100 Subject: add a few more gc collect in some spots --- OpenSim/Server/Base/ServerUtils.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index d0043ba..b020215 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -204,8 +204,7 @@ namespace OpenSim.Server.Base xw.Flush(); ms.Seek(0, SeekOrigin.Begin); - byte[] ret = ms.GetBuffer(); - Array.Resize(ref ret, (int)ms.Length); + byte[] ret = ms.ToArray(); return ret; } @@ -579,9 +578,12 @@ namespace OpenSim.Server.Base // Try to read it try { - XmlReader r = XmlReader.Create(url); - IConfigSource cs = new XmlConfigSource(r); - source.Merge(cs); + IConfigSource cs; + using( XmlReader r = XmlReader.Create(url)) + { + cs = new XmlConfigSource(r); + source.Merge(cs); + } } catch (Exception e) { -- cgit v1.1 From 35f5d4449bc96b6ee0eaaa128092a0c8035f79c3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Nov 2018 17:33:26 +0000 Subject: take login service out of basicDOSprot (too little, too late) --- OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs index 56ac3c2..70a054f 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs @@ -106,9 +106,10 @@ namespace OpenSim.Server.Handlers.Login private void InitializeHandlers(IHttpServer server) { LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy); - server.AddXmlRPCHandler("login_to_simulator", - new XmlRpcBasicDOSProtector(loginHandlers.HandleXMLRPCLogin,loginHandlers.HandleXMLRPCLoginBlocked, - m_DosProtectionOptions).Process, false); +// server.AddXmlRPCHandler("login_to_simulator", +// new XmlRpcBasicDOSProtector(loginHandlers.HandleXMLRPCLogin, loginHandlers.HandleXMLRPCLoginBlocked, +// m_DosProtectionOptions).Process, false); + server.AddXmlRPCHandler("login_to_simulator",loginHandlers.HandleXMLRPCLogin, false); server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); server.AddWebSocketHandler("/WebSocket/GridLogin", loginHandlers.HandleWebSocketLoginEvents); -- cgit v1.1 From 54b4e7a3e3fbe4267a1bf6f088f1dbb88bafab23 Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Wed, 14 Nov 2018 18:16:52 -0500 Subject: Fixed spelling error (availble -> available) --- OpenSim/Server/Base/CommandManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/CommandManager.cs b/OpenSim/Server/Base/CommandManager.cs index b6e2903..ffb20ce 100644 --- a/OpenSim/Server/Base/CommandManager.cs +++ b/OpenSim/Server/Base/CommandManager.cs @@ -84,7 +84,7 @@ namespace OpenSim.Server.Base HandleConsoleListAvailablePlugin); // List available updates MainConsole.Instance.Commands.AddCommand("Plugin", true, - "plugin updates", "plugin updates","List availble updates", + "plugin updates", "plugin updates","List available updates", HandleConsoleListUpdates); // Update plugin @@ -356,4 +356,4 @@ namespace OpenSim.Server.Base } #endregion } -} \ No newline at end of file +} -- cgit v1.1 From 0a4f0758fa4279739b09ff3002b2fa9f2d81dcc4 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 11 Mar 2019 23:40:55 +0000 Subject: Should have been in the last commit --- OpenSim/Server/Handlers/Map/MapGetServerConnector.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs index 1ae669c..017927a 100644 --- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs @@ -98,11 +98,20 @@ namespace OpenSim.Server.Handlers.MapImage // UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); UUID scopeID = UUID.Zero; + // This will be map/tilefile.ext, but on multitenancy it will be + // map/scope/teilefile.ext string[] bits = path.Trim('/').Split(new char[] {'/'}); - if (bits.Length > 1) + if (bits.Length > 2) { - scopeID = new UUID(bits[0]); - path = bits[1]; + try + { + scopeID = new UUID(bits[1]); + } + catch + { + return new byte[9]; + } + path = bits[2]; } result = m_MapService.GetMapTile(path.Trim('/'), scopeID, out format); if (result.Length > 0) -- cgit v1.1 From b82337de09b5e1e18f1df17cfe0c2123f062347f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Mar 2019 11:48:17 +0000 Subject: Robust: to tell main httpserver to stop on shutdown --- OpenSim/Server/Base/ServicesServerBase.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 900327a..422a8bc 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -250,6 +250,8 @@ namespace OpenSim.Server.Base } } + MainServer.Stop(); + MemoryWatchdog.Enabled = false; Watchdog.Enabled = false; WorkManager.Stop(); -- cgit v1.1 From 944a785a324c203c7ca5b8bdf770ec024b7b9a14 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Jul 2019 23:26:29 +0100 Subject: now i can login on win .net4.8, but just a little drop on a large (broken) OSD ocean. some of this changes are actually good even on good JIT. Failure seems to be on same code pattern, but same points seem to vary with each JIT compilation, sometimes work, others don't, others always fail, etc --- .../Server/Handlers/Simulation/AgentHandlers.cs | 124 +++++++++++---------- 1 file changed, 66 insertions(+), 58 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 1c1930a..788bd3d 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -115,15 +115,10 @@ namespace OpenSim.Server.Handlers.Simulation return responsedata; } - } protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID) { - Culture.SetCurrentCulture(); - - EntityTransferContext ctx = new EntityTransferContext(); - if (m_SimulationService == null) { m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless."); @@ -134,33 +129,37 @@ namespace OpenSim.Server.Handlers.Simulation return; } + Culture.SetCurrentCulture(); + // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); OSDMap args = Utils.GetOSDMap((string)request["body"]); bool viaTeleport = true; - if (args.ContainsKey("viaTeleport")) - viaTeleport = args["viaTeleport"].AsBoolean(); + OSD tmpOSD; + if (args.TryGetValue("viaTeleport",out tmpOSD)) + viaTeleport = tmpOSD.AsBoolean(); Vector3 position = Vector3.Zero; - if (args.ContainsKey("position")) - position = Vector3.Parse(args["position"].AsString()); + if (args.TryGetValue("position", out tmpOSD)) + position = Vector3.Parse(tmpOSD.AsString()); string agentHomeURI = null; - if (args.ContainsKey("agent_home_uri")) - agentHomeURI = args["agent_home_uri"].AsString(); + if (args.TryGetValue("agent_home_uri", out tmpOSD)) + agentHomeURI = tmpOSD.AsString(); // Decode the legacy (string) version and extract the number float theirVersion = 0f; - if (args.ContainsKey("my_version")) + if (args.TryGetValue("my_version", out tmpOSD)) { - string theirVersionStr = args["my_version"].AsString(); + string theirVersionStr = tmpOSD.AsString(); string[] parts = theirVersionStr.Split(new char[] {'/'}); if (parts.Length > 1) theirVersion = float.Parse(parts[1], Culture.FormatProvider); } - if (args.ContainsKey("context")) - ctx.Unpack((OSDMap)args["context"]); + EntityTransferContext ctx = new EntityTransferContext(); + if (args.TryGetValue("context", out tmpOSD) && tmpOSD is OSDMap) + ctx.Unpack((OSDMap)tmpOSD); // Decode the new versioning data float minVersionRequired = 0f; @@ -168,15 +167,15 @@ namespace OpenSim.Server.Handlers.Simulation float minVersionProvided = 0f; float maxVersionProvided = 0f; - if (args.ContainsKey("simulation_service_supported_min")) - minVersionProvided = (float)args["simulation_service_supported_min"].AsReal(); - if (args.ContainsKey("simulation_service_supported_max")) - maxVersionProvided = (float)args["simulation_service_supported_max"].AsReal(); + if (args.TryGetValue("simulation_service_supported_min", out tmpOSD)) + minVersionProvided = (float)tmpOSD.AsReal(); + if (args.TryGetValue("simulation_service_supported_max", out tmpOSD)) + maxVersionProvided = (float)tmpOSD.AsReal(); - if (args.ContainsKey("simulation_service_accepted_min")) - minVersionRequired = (float)args["simulation_service_accepted_min"].AsReal(); - if (args.ContainsKey("simulation_service_accepted_max")) - maxVersionRequired = (float)args["simulation_service_accepted_max"].AsReal(); + if (args.TryGetValue("simulation_service_accepted_min", out tmpOSD)) + minVersionRequired = (float)tmpOSD.AsReal(); + if (args.TryGetValue("simulation_service_accepted_max", out tmpOSD)) + maxVersionRequired = (float)tmpOSD.AsReal(); responsedata["int_response_code"] = HttpStatusCode.OK; OSDMap resp = new OSDMap(3); @@ -239,9 +238,9 @@ namespace OpenSim.Server.Handlers.Simulation List features = new List(); - if (args.ContainsKey("features")) + if (args.TryGetValue("features", out tmpOSD) && tmpOSD is OSDArray) { - OSDArray array = (OSDArray)args["features"]; + OSDArray array = (OSDArray)tmpOSD; foreach (OSD o in array) features.Add(new UUID(o.AsString())); @@ -414,8 +413,6 @@ namespace OpenSim.Server.Handlers.Simulation protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) { - EntityTransferContext ctx = new EntityTransferContext(); - OSDMap args = Utils.GetOSDMap((string)request["body"]); if (args == null) { @@ -424,8 +421,10 @@ namespace OpenSim.Server.Handlers.Simulation return; } - if (args.ContainsKey("context")) - ctx.Unpack((OSDMap)args["context"]); + OSD tmpOSD; + EntityTransferContext ctx = new EntityTransferContext(); + if (args.TryGetValue("context", out tmpOSD) && tmpOSD is OSDMap) + ctx.Unpack((OSDMap)tmpOSD); AgentDestinationData data = CreateAgentDestinationData(); UnpackData(args, data, request); @@ -453,16 +452,19 @@ namespace OpenSim.Server.Handlers.Simulation GridRegion source = null; - if (args.ContainsKey("source_uuid")) + if (args.TryGetValue("source_uuid", out tmpOSD)) { source = new GridRegion(); - source.RegionLocX = Int32.Parse(args["source_x"].AsString()); - source.RegionLocY = Int32.Parse(args["source_y"].AsString()); - source.RegionName = args["source_name"].AsString(); - source.RegionID = UUID.Parse(args["source_uuid"].AsString()); - - if (args.ContainsKey("source_server_uri")) - source.RawServerURI = args["source_server_uri"].AsString(); + source.RegionID = UUID.Parse(tmpOSD.AsString()); + tmpOSD = args["source_x"]; + source.RegionLocX = Int32.Parse(tmpOSD.AsString()); + tmpOSD = args["source_y"]; + source.RegionLocY = Int32.Parse(tmpOSD.AsString()); + tmpOSD = args["source_name"]; + source.RegionName = tmpOSD.AsString(); + + if (args.TryGetValue("source_server_uri", out tmpOSD)) + source.RawServerURI = tmpOSD.AsString(); else source.RawServerURI = null; } @@ -493,21 +495,26 @@ namespace OpenSim.Server.Handlers.Simulation protected virtual void UnpackData(OSDMap args, AgentDestinationData data, Hashtable request) { + OSD tmpOSD; // retrieve the input arguments - if (args.ContainsKey("destination_x") && args["destination_x"] != null) - Int32.TryParse(args["destination_x"].AsString(), out data.x); + if (args.TryGetValue("destination_x", out tmpOSD) && tmpOSD != null) + Int32.TryParse(tmpOSD.AsString(), out data.x); else m_log.WarnFormat(" -- request didn't have destination_x"); - if (args.ContainsKey("destination_y") && args["destination_y"] != null) - Int32.TryParse(args["destination_y"].AsString(), out data.y); + + if (args.TryGetValue("destination_y", out tmpOSD) && tmpOSD != null) + Int32.TryParse(tmpOSD.AsString(), out data.y); else m_log.WarnFormat(" -- request didn't have destination_y"); - if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) - UUID.TryParse(args["destination_uuid"].AsString(), out data.uuid); - if (args.ContainsKey("destination_name") && args["destination_name"] != null) - data.name = args["destination_name"].ToString(); - if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) - data.flags = args["teleport_flags"].AsUInteger(); + + if (args.TryGetValue("destination_uuid", out tmpOSD) && tmpOSD != null) + UUID.TryParse(tmpOSD.AsString(), out data.uuid); + + if (args.TryGetValue("destination_name", out tmpOSD) && tmpOSD != null) + data.name = tmpOSD.ToString(); + + if (args.TryGetValue("teleport_flags", out tmpOSD) && tmpOSD != null) + data.flags = tmpOSD.AsUInteger(); } protected virtual GridRegion ExtractGatekeeper(AgentDestinationData data) @@ -674,7 +681,6 @@ namespace OpenSim.Server.Handlers.Simulation protected void DoAgentPut(Hashtable request, Hashtable responsedata) { // TODO: Encode the ENtityTransferContext - EntityTransferContext ctx = new EntityTransferContext(); OSDMap args = Utils.GetOSDMap((string)request["body"]); if (args == null) @@ -685,19 +691,21 @@ namespace OpenSim.Server.Handlers.Simulation } // retrieve the input arguments + OSD tmpOSD; + EntityTransferContext ctx = new EntityTransferContext(); 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(); - if (args.ContainsKey("context")) - ctx.Unpack((OSDMap)args["context"]); + if (args.TryGetValue("destination_x", out tmpOSD) && tmpOSD != null) + Int32.TryParse(tmpOSD.AsString(), out x); + if (args.TryGetValue("destination_y", out tmpOSD) && tmpOSD != null) + Int32.TryParse(tmpOSD.AsString(), out y); + if (args.TryGetValue("destination_uuid", out tmpOSD) && tmpOSD != null) + UUID.TryParse(tmpOSD.AsString(), out uuid); + if (args.TryGetValue("destination_name", out tmpOSD) && tmpOSD != null) + regionname = tmpOSD.ToString(); + if (args.TryGetValue("context", out tmpOSD) && tmpOSD is OSDMap) + ctx.Unpack((OSDMap)tmpOSD); GridRegion destination = new GridRegion(); destination.RegionID = uuid; -- cgit v1.1 From c043008e04c3cb25b9fc4db62ed064775216d066 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 7 Aug 2019 21:06:20 +0100 Subject: add cap EstateChangeInfo --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 788bd3d..73bab61 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -456,12 +456,9 @@ namespace OpenSim.Server.Handlers.Simulation { source = new GridRegion(); source.RegionID = UUID.Parse(tmpOSD.AsString()); - tmpOSD = args["source_x"]; - source.RegionLocX = Int32.Parse(tmpOSD.AsString()); - tmpOSD = args["source_y"]; - source.RegionLocY = Int32.Parse(tmpOSD.AsString()); - tmpOSD = args["source_name"]; - source.RegionName = tmpOSD.AsString(); + source.RegionLocX = Int32.Parse(args["source_x"].AsString()); + source.RegionLocY = Int32.Parse(args["source_y"].AsString()); + source.RegionName = args["source_name"].AsString(); if (args.TryGetValue("source_server_uri", out tmpOSD)) source.RawServerURI = tmpOSD.AsString(); -- cgit v1.1 From c9b7ec2af91792b9d6558875c2a44267ac0ac5a0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 9 Aug 2019 12:06:33 +0100 Subject: Make the DNS cache timeout configurable. In containerized environments, DNS is simulated. It can change several times per second as containers move around. The hardcoded timeout was too long for a container environment. --- OpenSim/Server/ServerMain.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 09f6920..c180ca6 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -85,8 +85,6 @@ namespace OpenSim.Server ServicePointManager.UseNagleAlgorithm = false; ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; - try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { } - m_Server = new HttpServerBase("R.O.B.U.S.T.", args); string registryLocation; @@ -98,6 +96,9 @@ namespace OpenSim.Server throw new Exception("Configuration error"); } + int dnsTimeout = serverConfig.GetInt("DnsTimeout", 30000); + try { ServicePointManager.DnsRefreshTimeout = dnsTimeout; } catch { } + m_NoVerifyCertChain = serverConfig.GetBoolean("NoVerifyCertChain", m_NoVerifyCertChain); m_NoVerifyCertHostname = serverConfig.GetBoolean("NoVerifyCertHostname", m_NoVerifyCertHostname); -- cgit v1.1 From 0fd17c08ae642fac17b24dfad06c61cfe5739483 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 20 Aug 2019 23:28:59 +0100 Subject: Massive console refactor. Greatly simplify interface. --- OpenSim/Server/Base/CommandManager.cs | 15 ++++++++----- .../Server/Handlers/Asset/AssetServerConnector.cs | 26 +++++++++++----------- 2 files changed, 23 insertions(+), 18 deletions(-) mode change 100644 => 100755 OpenSim/Server/Base/CommandManager.cs mode change 100644 => 100755 OpenSim/Server/Handlers/Asset/AssetServerConnector.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/CommandManager.cs b/OpenSim/Server/Base/CommandManager.cs old mode 100644 new mode 100755 index ffb20ce..9ada974 --- a/OpenSim/Server/Base/CommandManager.cs +++ b/OpenSim/Server/Base/CommandManager.cs @@ -178,7 +178,8 @@ namespace OpenSim.Server.Base { Dictionary plugin = (Dictionary)result[k]; bool enabled = (bool)plugin["enabled"]; - MainConsole.Instance.OutputFormat("{0}) {1} {2} rev. {3}", + MainConsole.Instance.Output("{0}) {1} {2} rev. {3}", + null, k, enabled == true ? "[ ]" : "[X]", plugin["name"], plugin["version"]); @@ -215,7 +216,8 @@ namespace OpenSim.Server.Base { Dictionary plugin = (Dictionary)result[k]; bool enabled = (bool)plugin["enabled"]; - MainConsole.Instance.OutputFormat("{0}) {1} {2} rev. {3}", + MainConsole.Instance.Output("{0}) {1} {2} rev. {3}", + null, k, enabled == true ? "[ ]" : "[X]", plugin["name"], plugin["version"]); @@ -235,7 +237,8 @@ namespace OpenSim.Server.Base { // name, version, repository Dictionary plugin = (Dictionary)result[k]; - MainConsole.Instance.OutputFormat("{0}) {1} rev. {2} {3}", + MainConsole.Instance.Output("{0}) {1} rev. {2} {3}", + null, k, plugin["name"], plugin["version"], @@ -309,7 +312,8 @@ namespace OpenSim.Server.Base { Dictionary repo = (Dictionary)result[k]; bool enabled = (bool)repo["enabled"]; - MainConsole.Instance.OutputFormat("{0}) {1} {2}", + MainConsole.Instance.Output("{0}) {1} {2}", + null, k, enabled == true ? "[ ]" : "[X]", repo["name"], repo["url"]); @@ -329,7 +333,8 @@ namespace OpenSim.Server.Base int ndx = Convert.ToInt16(cmd[2]); PluginManager.AddinInfo(ndx, out result); - MainConsole.Instance.OutputFormat("Name: {0}\nURL: {1}\nFile: {2}\nAuthor: {3}\nCategory: {4}\nDesc: {5}", + MainConsole.Instance.Output("Name: {0}\nURL: {1}\nFile: {2}\nAuthor: {3}\nCategory: {4}\nDesc: {5}", + null, result["name"], result["url"], result["file_name"], diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs old mode 100644 new mode 100755 index bad3ea2..b710ec1 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs @@ -125,14 +125,14 @@ namespace OpenSim.Server.Handlers.Asset if (asset == null || asset.Data.Length == 0) { - MainConsole.Instance.OutputFormat("Could not find asset with ID {0}", args[2]); + MainConsole.Instance.Output("Could not find asset with ID {0}", null, args[2]); return; } if (!m_AssetService.Delete(asset.ID)) - MainConsole.Instance.OutputFormat("ERROR: Could not delete asset {0} {1}", asset.ID, asset.Name); + MainConsole.Instance.Output("ERROR: Could not delete asset {0} {1}", null, asset.ID, asset.Name); else - MainConsole.Instance.OutputFormat("Deleted asset {0} {1}", asset.ID, asset.Name); + MainConsole.Instance.Output("Deleted asset {0} {1}", null, asset.ID, asset.Name); } void HandleDumpAsset(string module, string[] args) @@ -148,14 +148,14 @@ namespace OpenSim.Server.Handlers.Asset if (!UUID.TryParse(rawAssetId, out assetId)) { - MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid ID format", rawAssetId); + MainConsole.Instance.Output("ERROR: {0} is not a valid ID format", null, rawAssetId); return; } AssetBase asset = m_AssetService.Get(assetId.ToString()); if (asset == null) { - MainConsole.Instance.OutputFormat("ERROR: No asset found with ID {0}", assetId); + MainConsole.Instance.Output("ERROR: No asset found with ID {0}", null, assetId); return; } @@ -172,7 +172,7 @@ namespace OpenSim.Server.Handlers.Asset } } - MainConsole.Instance.OutputFormat("Asset dumped to file {0}", fileName); + MainConsole.Instance.Output("Asset dumped to file {0}", null, fileName); } void HandleShowAsset(string module, string[] args) @@ -193,13 +193,13 @@ namespace OpenSim.Server.Handlers.Asset int i; - MainConsole.Instance.OutputFormat("Name: {0}", asset.Name); - MainConsole.Instance.OutputFormat("Description: {0}", asset.Description); - MainConsole.Instance.OutputFormat("Type: {0} (type number = {1})", (AssetType)asset.Type, asset.Type); - MainConsole.Instance.OutputFormat("Content-type: {0}", asset.Metadata.ContentType); - MainConsole.Instance.OutputFormat("Size: {0} bytes", asset.Data.Length); - MainConsole.Instance.OutputFormat("Temporary: {0}", asset.Temporary ? "yes" : "no"); - MainConsole.Instance.OutputFormat("Flags: {0}", asset.Metadata.Flags); + MainConsole.Instance.Output("Name: {0}", null, asset.Name); + MainConsole.Instance.Output("Description: {0}", null, asset.Description); + MainConsole.Instance.Output("Type: {0} (type number = {1})", null, (AssetType)asset.Type, asset.Type); + MainConsole.Instance.Output("Content-type: {0}", null, asset.Metadata.ContentType); + MainConsole.Instance.Output("Size: {0} bytes", null, asset.Data.Length); + MainConsole.Instance.Output("Temporary: {0}", null, asset.Temporary ? "yes" : "no"); + MainConsole.Instance.Output("Flags: {0}", null, asset.Metadata.Flags); for (i = 0 ; i < 5 ; i++) { -- cgit v1.1 From 7e136c67fd89f6c559420093acdee867967773bb Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 21 Aug 2019 21:15:58 +0100 Subject: Call SetServer on consoles reflectively to avoid having type checks in places where it tends to be forgotten to update them. --- OpenSim/Server/Base/HttpServerBase.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) mode change 100644 => 100755 OpenSim/Server/Base/HttpServerBase.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs old mode 100644 new mode 100755 index 3357250..5e76156 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -149,12 +149,14 @@ namespace OpenSim.Server.Base MainServer.RegisterHttpConsoleCommands(MainConsole.Instance); - if (MainConsole.Instance is RemoteConsole) + MethodInfo mi = m_console.GetType().GetMethod("SetServer", BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof(BaseHttpServer) }, null); + + if (mi != null) { if (m_consolePort == 0) - ((RemoteConsole)MainConsole.Instance).SetServer(MainServer.Instance); + mi.Invoke(MainConsole.Instance, new object[] { MainServer.Instance }); else - ((RemoteConsole)MainConsole.Instance).SetServer(MainServer.GetHttpServer(m_consolePort)); + mi.Invoke(MainConsole.Instance, new object[] { MainServer.GetHttpServer(m_consolePort) }); } } } -- cgit v1.1 From 110644c23a8f6c2dedc4392c833101d369c58f3e Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 21 Aug 2019 21:23:54 +0100 Subject: Make ReadConfig a general features of consoles, rather than type dependent --- OpenSim/Server/Base/ServicesServerBase.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) mode change 100644 => 100755 OpenSim/Server/Base/ServicesServerBase.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs old mode 100644 new mode 100755 index 422a8bc..3bede45 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -147,23 +147,15 @@ namespace OpenSim.Server.Base consoleType = startupConfig.GetString("console", consoleType); if (consoleType == "basic") - { MainConsole.Instance = new CommandConsole(prompt); - } else if (consoleType == "rest") - { MainConsole.Instance = new RemoteConsole(prompt); - ((RemoteConsole)MainConsole.Instance).ReadConfig(Config); - } else if (consoleType == "mock") - { MainConsole.Instance = new MockConsole(); - } else if (consoleType == "local") - { MainConsole.Instance = new LocalConsole(prompt, startupConfig); - } + MainConsole.Instance.ReadConfig(Config); m_console = MainConsole.Instance; if (logConfig != null) -- cgit v1.1 From 9d6c996570377f137f93d16c388746f949b9a841 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 11 Sep 2019 13:51:43 +0100 Subject: extent supported number of avatar textures/bakes/wearables, tell viewers about it on lludp RegionHandShake; propagate agenthover; block teleports/crossings based on worn wearables and peer version; --- .../Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs b/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs index b1b3c6f..2f8f151 100644 --- a/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs +++ b/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs @@ -129,7 +129,7 @@ namespace OpenSim.Server.Handlers.AgentPreferences AgentPrefs data = new AgentPrefs(userID); data.AccessPrefs = request["AccessPrefs"].ToString(); - data.HoverHeight = double.Parse(request["HoverHeight"].ToString()); + data.HoverHeight = float.Parse(request["HoverHeight"].ToString()); data.Language = request["Language"].ToString(); data.LanguageIsPublic = bool.Parse(request["LanguageIsPublic"].ToString()); data.PermEveryone = int.Parse(request["PermEveryone"].ToString()); -- cgit v1.1 From aed0eaf4d79d9cc7dedcdc7351a646bb97deec39 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 6 Oct 2019 19:51:13 +0100 Subject: Fix an issue where parameter parsing could lead to an exception --- OpenSim/Server/Base/ServerUtils.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index b020215..a21287a 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -227,8 +227,9 @@ namespace OpenSim.Server.Base // The path for a dynamic plugin will contain ":" on Windows string[] parts = dllName.Split (new char[] {':'}); - if (parts [0].Length > 1) + if (parts.Length < 3) { + // Linux. There will be ':' but the one we're looking for dllName = parts [0]; if (parts.Length > 1) className = parts[1]; -- cgit v1.1 From 46e36601cb3c54e6e441284aed7c0c5c35970a4c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Oct 2019 13:04:01 +0100 Subject: remove some more useless NULL arguments --- OpenSim/Server/Base/CommandManager.cs | 5 ----- .../Server/Handlers/Asset/AssetServerConnector.cs | 26 +++++++++++----------- 2 files changed, 13 insertions(+), 18 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/CommandManager.cs b/OpenSim/Server/Base/CommandManager.cs index 9ada974..bb103a0 100755 --- a/OpenSim/Server/Base/CommandManager.cs +++ b/OpenSim/Server/Base/CommandManager.cs @@ -179,7 +179,6 @@ namespace OpenSim.Server.Base Dictionary plugin = (Dictionary)result[k]; bool enabled = (bool)plugin["enabled"]; MainConsole.Instance.Output("{0}) {1} {2} rev. {3}", - null, k, enabled == true ? "[ ]" : "[X]", plugin["name"], plugin["version"]); @@ -217,7 +216,6 @@ namespace OpenSim.Server.Base Dictionary plugin = (Dictionary)result[k]; bool enabled = (bool)plugin["enabled"]; MainConsole.Instance.Output("{0}) {1} {2} rev. {3}", - null, k, enabled == true ? "[ ]" : "[X]", plugin["name"], plugin["version"]); @@ -238,7 +236,6 @@ namespace OpenSim.Server.Base // name, version, repository Dictionary plugin = (Dictionary)result[k]; MainConsole.Instance.Output("{0}) {1} rev. {2} {3}", - null, k, plugin["name"], plugin["version"], @@ -313,7 +310,6 @@ namespace OpenSim.Server.Base Dictionary repo = (Dictionary)result[k]; bool enabled = (bool)repo["enabled"]; MainConsole.Instance.Output("{0}) {1} {2}", - null, k, enabled == true ? "[ ]" : "[X]", repo["name"], repo["url"]); @@ -334,7 +330,6 @@ namespace OpenSim.Server.Base PluginManager.AddinInfo(ndx, out result); MainConsole.Instance.Output("Name: {0}\nURL: {1}\nFile: {2}\nAuthor: {3}\nCategory: {4}\nDesc: {5}", - null, result["name"], result["url"], result["file_name"], diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index b710ec1..511dbeb 100755 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs @@ -125,14 +125,14 @@ namespace OpenSim.Server.Handlers.Asset if (asset == null || asset.Data.Length == 0) { - MainConsole.Instance.Output("Could not find asset with ID {0}", null, args[2]); + MainConsole.Instance.Output("Could not find asset with ID {0}", args[2]); return; } if (!m_AssetService.Delete(asset.ID)) - MainConsole.Instance.Output("ERROR: Could not delete asset {0} {1}", null, asset.ID, asset.Name); + MainConsole.Instance.Output("ERROR: Could not delete asset {0} {1}", asset.ID, asset.Name); else - MainConsole.Instance.Output("Deleted asset {0} {1}", null, asset.ID, asset.Name); + MainConsole.Instance.Output("Deleted asset {0} {1}", asset.ID, asset.Name); } void HandleDumpAsset(string module, string[] args) @@ -148,14 +148,14 @@ namespace OpenSim.Server.Handlers.Asset if (!UUID.TryParse(rawAssetId, out assetId)) { - MainConsole.Instance.Output("ERROR: {0} is not a valid ID format", null, rawAssetId); + MainConsole.Instance.Output("ERROR: {0} is not a valid ID format", rawAssetId); return; } AssetBase asset = m_AssetService.Get(assetId.ToString()); if (asset == null) { - MainConsole.Instance.Output("ERROR: No asset found with ID {0}", null, assetId); + MainConsole.Instance.Output("ERROR: No asset found with ID {0}", assetId); return; } @@ -172,7 +172,7 @@ namespace OpenSim.Server.Handlers.Asset } } - MainConsole.Instance.Output("Asset dumped to file {0}", null, fileName); + MainConsole.Instance.Output("Asset dumped to file {0}", fileName); } void HandleShowAsset(string module, string[] args) @@ -193,13 +193,13 @@ namespace OpenSim.Server.Handlers.Asset int i; - MainConsole.Instance.Output("Name: {0}", null, asset.Name); - MainConsole.Instance.Output("Description: {0}", null, asset.Description); - MainConsole.Instance.Output("Type: {0} (type number = {1})", null, (AssetType)asset.Type, asset.Type); - MainConsole.Instance.Output("Content-type: {0}", null, asset.Metadata.ContentType); - MainConsole.Instance.Output("Size: {0} bytes", null, asset.Data.Length); - MainConsole.Instance.Output("Temporary: {0}", null, asset.Temporary ? "yes" : "no"); - MainConsole.Instance.Output("Flags: {0}", null, asset.Metadata.Flags); + MainConsole.Instance.Output("Name: {0}", asset.Name); + MainConsole.Instance.Output("Description: {0}", asset.Description); + MainConsole.Instance.Output("Type: {0} (type number = {1})", (AssetType)asset.Type, asset.Type); + MainConsole.Instance.Output("Content-type: {0}", asset.Metadata.ContentType); + MainConsole.Instance.Output("Size: {0} bytes", asset.Data.Length); + MainConsole.Instance.Output("Temporary: {0}", asset.Temporary ? "yes" : "no"); + MainConsole.Instance.Output("Flags: {0}", asset.Metadata.Flags); for (i = 0 ; i < 5 ; i++) { -- cgit v1.1 From 31aef4e82b2e746837a6ef0fcd8d3f1b7385bc8e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Nov 2019 06:34:44 +0000 Subject: work on previus 2 patchs --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 4e7ab00..c40bbd3 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -132,13 +132,8 @@ namespace OpenSim.Server.Handlers.Login //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); - - bool LibOMVclient = false; - if (request.Params.Count > 4 && (string)request.Params[4] == "gridproxy") - LibOMVclient = true; - LoginResponse reply = null; - reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient, LibOMVclient); + reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient); XmlRpcResponse response = new XmlRpcResponse(); response.Value = reply.ToHashtable(); @@ -221,7 +216,7 @@ namespace OpenSim.Server.Handlers.Login LoginResponse reply = null; reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, - map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient,false); + map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient); return reply.ToOSDMap(); } @@ -264,7 +259,7 @@ namespace OpenSim.Server.Handlers.Login (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint(); LoginResponse reply = null; reply = m_LocalService.Login(first, last, passwd, start, scope, version, - channel, mac, id0, endPoint,false); + channel, mac, id0, endPoint); sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap())); } -- cgit v1.1 From dcfd54b7608093d509cd045a152a4cde7317f66f Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 8 Sep 2020 21:17:45 +1000 Subject: Move various paths out of the bin directory. --- OpenSim/Server/Base/ServicesServerBase.cs | 2 +- OpenSim/Server/Handlers/BakedTextures/XBakes.cs | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 3bede45..8c16f61 100755 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -85,7 +85,7 @@ namespace OpenSim.Server.Base string fileName = ""; if (Assembly.GetEntryAssembly() != null) fileName = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location); - string iniFile = fileName + ".ini"; + string iniFile = Path.Combine(Util.configDir(), fileName + ".ini"); string logConfig = null; IConfig startupConfig = argvConfig.Configs["Startup"]; diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakes.cs b/OpenSim/Server/Handlers/BakedTextures/XBakes.cs index 4e55433..0c74564 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakes.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakes.cs @@ -67,12 +67,7 @@ namespace OpenSim.Server.Handlers.BakedTextures throw new Exception("No BakedTextureService configuration"); } - m_FSBase = assetConfig.GetString("BaseDirectory", String.Empty); - if (m_FSBase == String.Empty) - { - m_log.ErrorFormat("[BAKES]: BaseDirectory not specified"); - throw new Exception("Configuration error"); - } + m_FSBase = assetConfig.GetString("BaseDirectory", Util.cacheDir() + "/bakes"); m_log.Info("[BAKES]: XBakes service enabled"); } -- cgit v1.1 From c3f6c86c519d9934bfd1b9b0bf036381b10a87df Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 8 Sep 2020 21:20:28 +1000 Subject: Better ROBUST and sim startup console notification. --- OpenSim/Server/Base/ServicesServerBase.cs | 1 + OpenSim/Server/ServerMain.cs | 2 ++ 2 files changed, 3 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 8c16f61..3d87097 100755 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -357,6 +357,7 @@ namespace OpenSim.Server.Base Uri configUri; IConfigSource s = null; + System.Console.WriteLine("[CONFIG]: Reading configuration file. {0}", Path.GetFullPath(iniFile)); try { if (Uri.TryCreate(iniFile, UriKind.Absolute, out configUri) && diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index c180ca6..f1a7c97 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -190,6 +190,8 @@ namespace OpenSim.Server loader = new PluginLoader(m_Server.Config, registryLocation); + m_log.InfoFormat("[SERVER]: INITIALIZATION COMPLETE FOR ROBUST\n\n"); + int res = m_Server.Run(); if(m_Server != null) -- cgit v1.1 From 237659ba30a2d6a072aae989252a1e6be0423c3c Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 9 Sep 2020 00:52:35 +1000 Subject: Remove useless executable bit that Windows adds. --- OpenSim/Server/Base/CommandManager.cs | 0 OpenSim/Server/Base/HttpServerBase.cs | 0 OpenSim/Server/Base/ServicesServerBase.cs | 0 OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 OpenSim/Server/Base/CommandManager.cs mode change 100755 => 100644 OpenSim/Server/Base/HttpServerBase.cs mode change 100755 => 100644 OpenSim/Server/Base/ServicesServerBase.cs mode change 100755 => 100644 OpenSim/Server/Handlers/Asset/AssetServerConnector.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/CommandManager.cs b/OpenSim/Server/Base/CommandManager.cs old mode 100755 new mode 100644 diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs old mode 100755 new mode 100644 diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs old mode 100755 new mode 100644 diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs old mode 100755 new mode 100644 -- cgit v1.1 From 0fa5ff0ec03e5dfd6ebdd9af2268e0c33796368d Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 9 Sep 2020 04:33:43 +1000 Subject: Various logging fix ups. Mostly removing console spam. Swap a bunch of info / debug logs. Better archiver console spam. Have some "avatar has left" mesasge hit the INFO console. Tweak the login logging a bit, especially for impersonations. Default to INFO on the console and DEBUG in the log files. More time stamp resolution. Better sim startup console notification. Attempt to render "[LLUDPSERVER]: Malformed data, cannot parse" into something human readable as an aid to diagnosis. Beats hand translating the big block of hex codes it was spewing. Better sim startup finished messages. Inform neighbours we are up before the finished messages. Always send the "[RegionReady]: INITIALIZATION COMPLETE FOR" message. --- OpenSim/Server/ServerMain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index f1a7c97..c42e254 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -180,7 +180,7 @@ namespace OpenSim.Server if (connector != null) { m_ServiceConnectors.Add(connector); - m_log.InfoFormat("[SERVER]: {0} loaded successfully", friendlyName); +//// m_log.InfoFormat("[SERVER]: {0} loaded successfully", friendlyName); } else { -- cgit v1.1 From b95b03b409578da87f1dbaf809001e88e4e4fd56 Mon Sep 17 00:00:00 2001 From: onefang Date: Fri, 11 Sep 2020 00:41:12 +1000 Subject: Automatically add members to certain groups, and HGers from specific grids to certain other groups. It doesn't let them know, though the last group added will be their active group. This replaces a PHP script I used to use, that got broken by a PHP update. It also didn't let people know, no one complained. This is better. Another attempt at sorting out the auto group chicken and egg problems. Are you a local? Asking for a friend. Hypergridders have their full name in firstname, and their grid in lastname. Sometimes. Code filled with gotos may be spaghetti code, but object oriented code can be like chopped spaghetti that's hidden all over the kitchen. At least with gotos you can follow them. --- .../Server/Handlers/Authorization/AuthorizationServerPostHandler.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs index 310a542..07e09bc 100644 --- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs @@ -61,7 +61,8 @@ namespace OpenSim.Server.Handlers.Authorization AuthorizationRequest Authorization = (AuthorizationRequest) xs.Deserialize(request); string message = String.Empty; - bool authorized = m_AuthorizationService.IsAuthorizedForRegion(Authorization.ID, Authorization.FirstName, Authorization.SurName, Authorization.RegionID, out message); + bool isLocal = false; + bool authorized = m_AuthorizationService.IsAuthorizedForRegion(Authorization.ID, Authorization.FirstName, Authorization.SurName, Authorization.RegionID, out message, out isLocal); AuthorizationResponse result = new AuthorizationResponse(authorized, Authorization.ID + " has been authorized"); -- cgit v1.1