2 Комити fcddf631ce ... 00c0816275

Аутор SHA1 Порука Датум
  UbitUmarov 00c0816275 mantis 9157: remove trail '/' from remoteconsole urls пре 2 месеци
  UbitUmarov 3823940205 add GetLocalRegionByName to GridServicesConnector plus cosmetics пре 2 месеци

+ 3 - 6
OpenSim/Framework/Console/RemoteConsole.cs

@@ -29,10 +29,7 @@ using System;
 using System.Xml;
 using System.Collections;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Reflection;
-using System.Text;
-using System.Text.RegularExpressions;
 using System.Threading;
 using System.Timers;
 using OpenMetaverse;
@@ -185,9 +182,9 @@ namespace OpenSim.Framework.Console
             m_Server = server;
 
             // Add our handlers
-            m_Server.AddHTTPHandler("/StartSession/", HandleHttpStartSession);
-            m_Server.AddHTTPHandler("/CloseSession/", HandleHttpCloseSession);
-            m_Server.AddHTTPHandler("/SessionCommand/", HandleHttpSessionCommand);
+            m_Server.AddHTTPHandler("/StartSession", HandleHttpStartSession);
+            m_Server.AddHTTPHandler("/CloseSession", HandleHttpCloseSession);
+            m_Server.AddHTTPHandler("/SessionCommand", HandleHttpSessionCommand);
         }
 
         public override void Output(string format)

+ 1 - 3
OpenSim/Region/ClientStack/Linden/Caps/AgentPreferencesModule.cs

@@ -71,7 +71,6 @@ namespace OpenSim.Region.ClientStack.LindenCaps
             lock (m_scenes)
                 m_scenes.Remove(scene);
             scene.EventManager.OnRegisterCaps -= RegisterCaps;
-            scene = null;
         }
 
         public void RegionLoaded(Scene scene)
@@ -79,8 +78,7 @@ namespace OpenSim.Region.ClientStack.LindenCaps
             scene.EventManager.OnRegisterCaps += RegisterCaps;
 
             ISimulatorFeaturesModule simFeatures = scene.RequestModuleInterface<ISimulatorFeaturesModule>();
-            if(simFeatures != null)
-                simFeatures.AddFeature("AvatarHoverHeightEnabled",OSD.FromBoolean(true));
+            simFeatures?.AddFeature("AvatarHoverHeightEnabled",OSD.FromBoolean(true));
 
         }
 

+ 13 - 11
OpenSim/Server/Base/ServerUtils.cs

@@ -543,19 +543,21 @@ namespace OpenSim.Server.Base
 
         public static Dictionary<string, object> ParseXmlResponse(string data)
         {
-            try
-            {
-                using XmlReader xr = XmlReader.Create(new StringReader(data), 
-                    ParseXmlStringResponseXmlReaderSettings, ParseXmlResponseXmlParserContext);
-                if (!xr.ReadToFollowing("ServerResponse"))
-                    return new Dictionary<string, object>();
-                return ScanXmlResponse(xr);
-            }
-            catch (Exception e)
+            if(!string.IsNullOrEmpty(data))
             {
-                m_log.DebugFormat("[serverUtils.ParseXmlResponse]: failed error: {0}\n --string:\n{1}\n", e.Message, data);
+                try
+                {
+                    using XmlReader xr = XmlReader.Create(new StringReader(data), 
+                        ParseXmlStringResponseXmlReaderSettings, ParseXmlResponseXmlParserContext);
+                    if (xr.ReadToFollowing("ServerResponse"))
+                        return ScanXmlResponse(xr);
+                }
+                catch (Exception e)
+                {
+                    m_log.Debug($"[serverUtils.ParseXmlResponse]: failed error: {e.Message}\n --string:\n{data}\n");
+                }
             }
-            return new Dictionary<string, object>();
+            return [];
         }
 
         private static readonly XmlReaderSettings ParseXmlStreamResponseXmlReaderSettings = new()

+ 32 - 10
OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs

@@ -102,6 +102,9 @@ namespace OpenSim.Server.Handlers.Grid
                     case "get_region_by_name":
                         return GetRegionByName(request);
 
+                    case "get_localregion_by_name":
+                        return GetLocalRegionByName(request);
+
                     case "get_regions_by_name":
                         return GetRegionsByName(request);
 
@@ -327,21 +330,40 @@ namespace OpenSim.Server.Handlers.Grid
         byte[] GetRegionByName(Dictionary<string, object> request)
         {
             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 by name");
+            if (!request.TryGetValue("SCOPEID", out object scpo) || scpo is not string scps || !UUID.TryParse(scps, out scopeID))
+                m_log.WarnFormat("[GRID HANDLER]: no or invalid scopeID in request to get region by name");
 
-            string regionName = string.Empty;
-            if (request.ContainsKey("NAME"))
-                regionName = request["NAME"].ToString();
+            GridRegion rinfo = null;
+            if (request.TryGetValue("NAME", out object nameo) && nameo is string regionName)
+                rinfo = m_GridService.GetRegionByName(scopeID, regionName);
             else
                 m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name");
 
-            GridRegion rinfo = m_GridService.GetRegionByName(scopeID, regionName);
-            //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
+            Dictionary<string, object> result = [];
+            if (rinfo == null)
+                result["result"] = "null";
+            else
+                result["result"] = rinfo.ToKeyValuePairs();
 
-            Dictionary<string, object> result = new Dictionary<string, object>();
+            string xmlString = ServerUtils.BuildXmlResponse(result);
+
+            //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
+            return Util.UTF8NoBomEncoding.GetBytes(xmlString);
+        }
+
+        byte[] GetLocalRegionByName(Dictionary<string, object> request)
+        {
+            UUID scopeID = UUID.Zero;
+            if (!request.TryGetValue("SCOPEID", out object scpo) || scpo is not string scps || !UUID.TryParse(scps, out scopeID))
+                m_log.WarnFormat("[GRID HANDLER]: no or invalid scopeID in request to get region by name");
+
+            GridRegion rinfo = null;
+            if (request.TryGetValue("NAME", out object nameo) && nameo is string regionName)
+                rinfo = m_GridService.GetLocalRegionByName(scopeID, regionName);
+            else
+                m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name");
+
+            Dictionary<string, object> result = [];
             if (rinfo == null)
                 result["result"] = "null";
             else

+ 410 - 459
OpenSim/Services/Connectors/Grid/GridServicesConnector.cs

@@ -28,12 +28,10 @@
 using log4net;
 using System;
 using System.Collections.Generic;
-using System.IO;
 using System.Reflection;
 using Nini.Config;
 using OpenSim.Framework;
 
-using OpenSim.Framework.ServiceAuth;
 using OpenSim.Services.Interfaces;
 using GridRegion = OpenSim.Services.Interfaces.GridRegion;
 using OpenSim.Server.Base;
@@ -43,11 +41,9 @@ namespace OpenSim.Services.Connectors
 {
     public class GridServicesConnector : BaseServiceConnector, IGridService
     {
-        private static readonly ILog m_log =
-                LogManager.GetLogger(
-                MethodBase.GetCurrentMethod().DeclaringType);
-
+        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
         private string m_ServerURI = String.Empty;
+        private string m_ServerGridURI = string.Empty;
 
         public GridServicesConnector()
         {
@@ -56,6 +52,7 @@ namespace OpenSim.Services.Connectors
         public GridServicesConnector(string serverURI)
         {
             m_ServerURI = serverURI.TrimEnd('/');
+            m_ServerGridURI = serverURI + "/grid";
         }
 
         public GridServicesConnector(IConfigSource source)
@@ -66,21 +63,21 @@ namespace OpenSim.Services.Connectors
         public virtual void Initialise(IConfigSource source)
         {
             IConfig gridConfig = source.Configs["GridService"];
-            if (gridConfig == null)
+            if (gridConfig is null)
             {
                 m_log.Error("[GRID CONNECTOR]: GridService missing from OpenSim.ini");
                 throw new Exception("Grid connector init error");
             }
 
-            string serviceURI = gridConfig.GetString("GridServerURI",
-                    String.Empty);
+            string serviceURI = gridConfig.GetString("GridServerURI", string.Empty);
 
             if (serviceURI.Length == 0)
             {
                 m_log.Error("[GRID CONNECTOR]: No Server URI named in section GridService");
                 throw new Exception("Grid connector init error");
             }
-            m_ServerURI = serviceURI;
+            m_ServerURI = serviceURI.TrimEnd('/');
+            m_ServerGridURI = serviceURI + "/grid";
 
             base.Initialise(source, "GridService");
         }
@@ -91,91 +88,87 @@ namespace OpenSim.Services.Connectors
         public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
         {
             Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs();
-            Dictionary<string, object> sendData = new Dictionary<string,object>();
+            Dictionary<string, object> sendData = new()
+            {
+                ["SCOPEID"] = scopeID.ToString(),
+                ["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(),
+                ["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(),
+                ["METHOD"] = "register"
+            };
             foreach (KeyValuePair<string, object> kvp in rinfo)
                 sendData[kvp.Key] = (string)kvp.Value;
 
-            sendData["SCOPEID"] = scopeID.ToString();
-            sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
-            sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
-            sendData["METHOD"] = "register";
-
             string reqString = ServerUtils.BuildQueryString(sendData);
-            string uri = m_ServerURI + "/grid";
             // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
             try
             {
-                string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
-                if (!string.IsNullOrEmpty(reply))
+                string reply = SynchronousRestFormsRequester.MakePostRequest(m_ServerGridURI, reqString, m_Auth);
+                if (reply.Length > 0)
                 {
                     Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
-
-                    if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success"))
-                    {
-                        return String.Empty;
-                    }
-                    else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure"))
-                    {
-                        m_log.ErrorFormat(
-                            "[GRID CONNECTOR]: Registration failed: {0} when contacting {1}", replyData["Message"], uri);
-
-                        return replyData["Message"].ToString();
-                    }
-                    else if (!replyData.ContainsKey("Result"))
+                    if (replyData.TryGetValue("Result", out object tmpo) && tmpo is string tmps)
                     {
-                        m_log.ErrorFormat(
-                            "[GRID CONNECTOR]: reply data does not contain result field when contacting {0}", uri);
+                        if(tmps.Equals("success", StringComparison.CurrentCultureIgnoreCase))
+                            return string.Empty;
+                        if (tmps.Equals("failure", StringComparison.CurrentCultureIgnoreCase))
+                        {
+                            m_log.Error(
+                                $"[GRID CONNECTOR]: Registration failed: {replyData["Message"]} when contacting {m_ServerGridURI}");
+                            return replyData["Message"].ToString();
+                        }
+                        else
+                        {
+                            m_log.Error(
+                                $"[GRID CONNECTOR]: unexpected result {tmps} when contacting {m_ServerGridURI}");
+                            return "Unexpected result " + tmps;
+                        }
                     }
                     else
                     {
-                        m_log.ErrorFormat(
-                            "[GRID CONNECTOR]: unexpected result {0} when contacting {1}", replyData["Result"], uri);
-
-                        return "Unexpected result " + replyData["Result"].ToString();
+                        m_log.Error(
+                            $"[GRID CONNECTOR]: reply data does not contain result field when contacting {m_ServerGridURI}");
                     }
                 }
                 else
                 {
-                    m_log.ErrorFormat(
-                        "[GRID CONNECTOR]: RegisterRegion received null reply when contacting grid server at {0}", uri);
+                    m_log.Error(
+                        $"[GRID CONNECTOR]: RegisterRegion received null reply when contacting grid server at {m_ServerGridURI}");
                 }
             }
             catch (Exception e)
             {
-                m_log.ErrorFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
+                m_log.Error($"[GRID CONNECTOR]: Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
 
-            return string.Format("Error communicating with the grid service at {0}", uri);
+            return "Error communicating with the grid service at " + m_ServerGridURI;
         }
 
         public bool DeregisterRegion(UUID regionID)
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
-
-            sendData["REGIONID"] = regionID.ToString();
-
-            sendData["METHOD"] = "deregister";
+            Dictionary<string, object> sendData = new()
+            {
+                ["REGIONID"] = regionID.ToString(),
 
-            string uri = m_ServerURI + "/grid";
+                ["METHOD"] = "deregister"
+            };
 
             try
             {
-                string reply
-                    = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
+                string reply = SynchronousRestFormsRequester.MakePostRequest(m_ServerGridURI, ServerUtils.BuildQueryString(sendData), m_Auth);
 
-                if (reply != string.Empty)
+                if (reply.Length > 0)
                 {
                     Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
-
-                    if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
-                        return true;
+                    return replyData.TryGetValue("Result", out object tmpo) && 
+                            tmpo is string rs &&
+                            rs.Equals("success", StringComparison.InvariantCultureIgnoreCase);
                 }
                 else
-                    m_log.DebugFormat("[GRID CONNECTOR]: DeregisterRegion received null reply");
+                    m_log.Debug("[GRID CONNECTOR]: DeregisterRegion received empty reply");
             }
             catch (Exception e)
             {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
+                m_log.Error($"[GRID CONNECTOR]: Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
 
             return false;
@@ -183,196 +176,191 @@ namespace OpenSim.Services.Connectors
 
         public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
-
-            sendData["SCOPEID"] = scopeID.ToString();
-            sendData["REGIONID"] = regionID.ToString();
-
-            sendData["METHOD"] = "get_neighbours";
-
-            List<GridRegion> rinfos = new List<GridRegion>();
+            Dictionary<string, object> sendData = new()
+            {
+                ["SCOPEID"] = scopeID.ToString(),
+                ["REGIONID"] = regionID.ToString(),
 
-            string reqString = ServerUtils.BuildQueryString(sendData);
-            string reply = string.Empty;
-            string uri = m_ServerURI + "/grid";
+                ["METHOD"] = "get_neighbours"
+            };
 
             try
             {
-                reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
-                return rinfos;
-            }
+                string reply = SynchronousRestFormsRequester.MakePostRequest(
+                    m_ServerGridURI,
+                    ServerUtils.BuildQueryString(sendData), m_Auth);
 
-            Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
 
-            if (replyData != null)
-            {
-                Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
-                //m_log.DebugFormat("[GRID CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count);
-                foreach (object r in rinfosList)
+                //m_log.DebugFormat("[GRID CONNECTOR]: get neighbours returned {0} elements", replyData.Values.Count);
+                if (replyData.Count > 0)
                 {
-                    if (r is Dictionary<string, object>)
+                    List<GridRegion> rinfos = [];
+                    foreach (object r in replyData.Values)
                     {
-                        GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
-                        rinfos.Add(rinfo);
+                        if (r is Dictionary<string, object> dr)
+                        {
+                            GridRegion rinfo = new GridRegion(dr);
+                            rinfos.Add(rinfo);
+                        }
                     }
+                    return rinfos;
                 }
+
+            }
+            catch (Exception e)
+            {
+                m_log.Error($"[GRID CONNECTOR]: GetNeighbours Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
+                
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetNeighbours {0}, {1} received null response",
-                    scopeID, regionID);
 
-            return rinfos;
+            return [];
         }
 
         public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
-
-            sendData["SCOPEID"] = scopeID.ToString();
-            sendData["REGIONID"] = regionID.ToString();
-
-            sendData["METHOD"] = "get_region_by_uuid";
-
-            string reply = string.Empty;
-            string uri = m_ServerURI + "/grid";
-            try
+            Dictionary<string, object> sendData = new()
             {
-                reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
-                return null;
-            }
+                ["SCOPEID"] = scopeID.ToString(),
+                ["REGIONID"] = regionID.ToString(),
 
-            GridRegion rinfo = null;
+                ["METHOD"] = "get_region_by_uuid"
+            };
 
-            if (reply != string.Empty)
+            try
             {
-                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
-
-                if ((replyData != null) && (replyData["result"] != null))
+                string reply = SynchronousRestFormsRequester.MakePostRequest(m_ServerGridURI, ServerUtils.BuildQueryString(sendData), m_Auth);
+                if (reply.Length > 0)
                 {
-                    if (replyData["result"] is Dictionary<string, object>)
-                        rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+                    if(replyData.TryGetValue("result", out object tmpo) && tmpo is Dictionary<string, object> td)
+                        return new GridRegion(td);
                     //else
-                    //    m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response",
-                    //        scopeID, regionID);
+                    //    m_log.Debug($"[GRID CONNECTOR]: GetRegionByUUID {scopeID}, {regionID} received empty result response");
                 }
                 else
-                    m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response",
-                        scopeID, regionID);
+                    m_log.Debug($"[GRID CONNECTOR]: GetRegionByUUID received empty reply for {scopeID}, {regionID}");
+            }
+            catch (Exception e)
+            {
+                m_log.Debug($"[GRID CONNECTOR]: Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID received null reply");
 
-            return rinfo;
+            return null;
         }
 
         public GridRegion GetRegionByHandle(UUID scopeID, ulong regionhandle)
         {
-            //still not on protocol
             Util.RegionHandleToWorldLoc(regionhandle, out uint x, out uint y);
             return GetRegionByPosition(scopeID, (int)x, (int)y);
         }
 
         public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
         {
-            GridRegion rinfo = null;
-
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
+            Dictionary<string, object> sendData = new()
+            {
+                ["SCOPEID"] = scopeID.ToString(),
+                ["X"] = x.ToString(),
+                ["Y"] = y.ToString(),
 
-            sendData["SCOPEID"] = scopeID.ToString();
-            sendData["X"] = x.ToString();
-            sendData["Y"] = y.ToString();
+                ["METHOD"] = "get_region_by_position"
+            };
 
-            sendData["METHOD"] = "get_region_by_position";
-            string reply = string.Empty;
-            string uri = m_ServerURI + "/grid";
             try
             {
-                reply = SynchronousRestFormsRequester.MakeRequest("POST",
-                        uri,
+                string reply = SynchronousRestFormsRequester.MakePostRequest(
+                        m_ServerGridURI,
                         ServerUtils.BuildQueryString(sendData), m_Auth);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
-                return null;
-            }
 
-            if (reply != string.Empty)
-            {
-                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
-
-                if ((replyData != null) && (replyData["result"] != null))
+                if (reply.Length > 0)
                 {
-                    if (replyData["result"] is Dictionary<string, object>)
-                        rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+                    if(replyData.TryGetValue("result", out object tmpo) && tmpo is Dictionary<string, object> td)
+                        return new GridRegion(td);
                     //else
-                    //    m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received no region",
-                    //        scopeID, x, y);
+                    //    m_log.Debug($"[GRID CONNECTOR]: GetRegionByPosition {scopeID}, {x}-{y} received empty result response");
                 }
                 else
-                    m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response",
-                        scopeID, x, y);
+                    m_log.Debug($"[GRID CONNECTOR]: GetRegionByPosition {scopeID}, {x}-{y} received empty response");
+            }
+            catch (Exception e)
+            {
+                m_log.Debug($"[GRID CONNECTOR]: Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply");
 
-            return rinfo;
+            return null;
         }
 
         public GridRegion GetRegionByName(UUID scopeID, string regionName)
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
+            Dictionary<string, object> sendData = new()
+            {
+                ["SCOPEID"] = scopeID.ToString(),
+                ["NAME"] = regionName,
 
-            sendData["SCOPEID"] = scopeID.ToString();
-            sendData["NAME"] = regionName;
+                ["METHOD"] = "get_region_by_name"
+            };
 
-            sendData["METHOD"] = "get_region_by_name";
-            string reply = string.Empty;
-            string uri = m_ServerURI + "/grid";
             try
             {
-                reply = SynchronousRestFormsRequester.MakeRequest("POST",
-                        uri,
+                string reply = SynchronousRestFormsRequester.MakePostRequest(
+                        m_ServerGridURI,
                         ServerUtils.BuildQueryString(sendData), m_Auth);
+
+                if (reply.Length > 0)
+                {
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+                    if(replyData.TryGetValue("result", out object tmpo) && tmpo is Dictionary<string, object> td)
+                        return new GridRegion(td);
+                    //else
+                    //    m_log.DebugFormat("$[GRID CONNECTOR]: GetRegionByName {scopeID}, {regionName} received empty result");
+                }
+                else
+                     m_log.DebugFormat("$[GRID CONNECTOR]: GetRegionByName {scopeID}, {regionName} received empty reply");
             }
             catch (Exception e)
             {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
-                return null;
+                m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByName, Exception when contacting grid server at {0}: {1}", m_ServerGridURI, e.Message);
             }
 
-            GridRegion rinfo = null;
-            if (reply != string.Empty)
+            return null;
+        }
+
+        public GridRegion GetLocalRegionByName(UUID scopeID, string regionName)
+        {
+            Dictionary<string, object> sendData = new()
             {
-                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+                ["SCOPEID"] = scopeID.ToString(),
+                ["NAME"] = regionName,
 
-                if ((replyData != null) && (replyData["result"] != null))
+                ["METHOD"] = "get_localregion_by_name"
+            };
+
+            try
+            {
+                string reply = SynchronousRestFormsRequester.MakePostRequest(
+                        m_ServerGridURI,
+                        ServerUtils.BuildQueryString(sendData), m_Auth);
+
+                if (reply.Length > 0)
                 {
-                    if (replyData["result"] is Dictionary<string, object>)
-                        rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+                    if(replyData.TryGetValue("result", out object tmpo) && tmpo is Dictionary<string, object> td)
+                        return new GridRegion(td);
+                    //else
+                    //    m_log.DebugFormat("$[GRID CONNECTOR]: GetLocalRegionByName {scopeID}, {regionName} received empty result");
                 }
                 else
-                    m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response",
-                        scopeID, regionName);
+                     m_log.DebugFormat("$[GRID CONNECTOR]: GetLocalRegionByName {scopeID}, {regionName} received empty reply");
+            }
+            catch (Exception e)
+            {
+                m_log.Debug($"[GRID CONNECTOR]: GetLocalRegionByName, Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByName received null reply");
-
-            return rinfo;
-        }
 
-        public GridRegion GetLocalRegionByName(UUID scopeID, string regionName)
-        {
             return null;
         }
+
         public GridRegion GetRegionByURI(UUID scopeID, RegionURI uri)
         {
             return null;
@@ -385,52 +373,49 @@ namespace OpenSim.Services.Connectors
 
         public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
+            Dictionary<string, object> sendData = new()
+            {
+                ["SCOPEID"] = scopeID.ToString(),
+                ["NAME"] = name,
+                ["MAX"] = maxNumber.ToString(),
 
-            sendData["SCOPEID"] = scopeID.ToString();
-            sendData["NAME"] = name;
-            sendData["MAX"] = maxNumber.ToString();
+                ["METHOD"] = "get_regions_by_name"
+            };
 
-            sendData["METHOD"] = "get_regions_by_name";
-            List<GridRegion> rinfos = new List<GridRegion>();
-            string reply = string.Empty;
-            string uri = m_ServerURI + "/grid";
             try
             {
-                reply = SynchronousRestFormsRequester.MakeRequest("POST",
-                        uri,
+                string reply = SynchronousRestFormsRequester.MakePostRequest(
+                        m_ServerGridURI,
                         ServerUtils.BuildQueryString(sendData), m_Auth);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
-                return rinfos;
-            }
-
-            if (reply != string.Empty)
-            {
-                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
 
-                if (replyData != null)
+                if (reply.Length > 0)
                 {
-                    Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
-                    foreach (object r in rinfosList)
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+                    if (replyData.Count > 0)
                     {
-                        if (r is Dictionary<string, object>)
+                        List<GridRegion> rinfos = [];
+                        foreach (object r in replyData.Values)
                         {
-                            GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
-                            rinfos.Add(rinfo);
+                            if (r is Dictionary<string, object> dr)
+                            {
+                                GridRegion rinfo = new GridRegion(dr);
+                                rinfos.Add(rinfo);
+                            }
                         }
+                        return rinfos;
                     }
+                    else
+                        m_log.Debug($"[GRID CONNECTOR]: GetRegionsByName {scopeID}, {name}, {maxNumber} received empty reply data");
                 }
                 else
-                    m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response",
-                        scopeID, name, maxNumber);
+                    m_log.Debug($"[GRID CONNECTOR]: GetRegionsByName {scopeID}, {name}, {maxNumber} received empty reply");
+            }
+            catch (Exception e)
+            {
+                m_log.Debug($"[GRID CONNECTOR]: Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName received null reply");
 
-            return rinfos;
+            return [];
         }
 
         public List<GridRegion> GetRegionsByURI(UUID scopeID, RegionURI uri, int maxNumber)
@@ -440,402 +425,368 @@ namespace OpenSim.Services.Connectors
 
         public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
-
-            sendData["SCOPEID"] = scopeID.ToString();
-            sendData["XMIN"] = xmin.ToString();
-            sendData["XMAX"] = xmax.ToString();
-            sendData["YMIN"] = ymin.ToString();
-            sendData["YMAX"] = ymax.ToString();
-
-            sendData["METHOD"] = "get_region_range";
+            Dictionary<string, object> sendData = new()
+            {
+                ["SCOPEID"] = scopeID.ToString(),
+                ["XMIN"] = xmin.ToString(),
+                ["XMAX"] = xmax.ToString(),
+                ["YMIN"] = ymin.ToString(),
+                ["YMAX"] = ymax.ToString(),
 
-            List<GridRegion> rinfos = new List<GridRegion>();
-            string reply = string.Empty;
-            string uri = m_ServerURI + "/grid";
+                ["METHOD"] = "get_region_range"
+            };
 
             try
             {
-                reply = SynchronousRestFormsRequester.MakeRequest("POST",
-                        uri,
+                string reply = SynchronousRestFormsRequester.MakePostRequest(
+                        m_ServerGridURI,
                         ServerUtils.BuildQueryString(sendData), m_Auth);
 
-                //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
-                return rinfos;
-            }
-
-            if (reply != string.Empty)
-            {
-                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
-
-                if (replyData != null)
+                //m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange reply was {0}", reply);
+                if (reply.Length > 0)
                 {
-                    Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
-                    foreach (object r in rinfosList)
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+                    if (replyData.Count > 0)
                     {
-                        if (r is Dictionary<string, object>)
+                        List<GridRegion> rinfos = [];
+                        foreach (object r in replyData.Values)
                         {
-                            GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
-                            rinfos.Add(rinfo);
+                            if (r is Dictionary<string, object> dr)
+                            {
+                                GridRegion rinfo = new(dr);
+                                rinfos.Add(rinfo);
+                            }
                         }
+                        return rinfos;
                     }
+                    else
+                        m_log.Debug($"[GRID CONNECTOR]: GetRegionRange {scopeID}, {xmin}-{xmax} {ymin}-{ymax} received null response");
                 }
                 else
-                    m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received null response",
-                        scopeID, xmin, xmax, ymin, ymax);
+                    m_log.Debug("[GRID CONNECTOR]: GetRegionRange received empty reply");
+
+            }
+            catch (Exception e)
+            {
+                m_log.Debug($"[GRID CONNECTOR]: Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange received null reply");
 
-            return rinfos;
+            return [];
         }
 
         public List<GridRegion> GetDefaultRegions(UUID scopeID)
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
-
-            sendData["SCOPEID"] = scopeID.ToString();
+            Dictionary<string, object> sendData = new()
+            {
+                ["SCOPEID"] = scopeID.ToString(),
 
-            sendData["METHOD"] = "get_default_regions";
+                ["METHOD"] = "get_default_regions"
+            };
 
-            List<GridRegion> rinfos = new List<GridRegion>();
-            string reply = string.Empty;
-            string uri = m_ServerURI + "/grid";
             try
             {
-                reply = SynchronousRestFormsRequester.MakeRequest("POST",
-                        uri,
+                string reply = SynchronousRestFormsRequester.MakePostRequest(
+                        m_ServerGridURI,
                         ServerUtils.BuildQueryString(sendData), m_Auth);
 
                 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
-                return rinfos;
-            }
-
-            if (reply != string.Empty)
-            {
-                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
-
-                if (replyData != null)
+                if (reply.Length > 0)
                 {
-                    Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
-                    foreach (object r in rinfosList)
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+
+                    if (replyData.Count > 0)
                     {
-                        if (r is Dictionary<string, object>)
+                        List<GridRegion> rinfos = [];
+                        Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
+                        foreach (object r in rinfosList)
                         {
-                            GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
-                            rinfos.Add(rinfo);
+                            if (r is Dictionary<string, object>)
+                            {
+                                GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
+                                rinfos.Add(rinfo);
+                            }
                         }
+                        return rinfos;
                     }
+                    else
+                        m_log.Debug($"[GRID CONNECTOR]: GetDefaultRegions {scopeID} received empty response");
                 }
                 else
-                    m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultRegions {0} received null response",
-                        scopeID);
+                    m_log.Debug("[GRID CONNECTOR]: GetDefaultRegions received empty reply");
+
+            }
+            catch (Exception e)
+            {
+                m_log.Debug($"[GRID CONNECTOR]: GetDefaultRegions Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultRegions received null reply");
 
-            return rinfos;
+            return [];
         }
 
         public List<GridRegion> GetDefaultHypergridRegions(UUID scopeID)
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
-
-            sendData["SCOPEID"] = scopeID.ToString();
+            Dictionary<string, object> sendData = new()
+            {
+                ["SCOPEID"] = scopeID.ToString(),
 
-            sendData["METHOD"] = "get_default_hypergrid_regions";
+                ["METHOD"] = "get_default_hypergrid_regions"
+            };
 
-            List<GridRegion> rinfos = new List<GridRegion>();
-            string reply = string.Empty;
-            string uri = m_ServerURI + "/grid";
             try
             {
-                reply = SynchronousRestFormsRequester.MakeRequest("POST",
-                        uri,
+                string reply = SynchronousRestFormsRequester.MakePostRequest(
+                        m_ServerGridURI,
                         ServerUtils.BuildQueryString(sendData), m_Auth);
 
                 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
-                return rinfos;
-            }
-
-            if (reply != string.Empty)
-            {
-                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
-
-                if (replyData != null)
+                if (reply.Length > 0)
                 {
-                    Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
-                    foreach (object r in rinfosList)
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+
+                    if (replyData.Count > 0)
                     {
-                        if (r is Dictionary<string, object>)
+                        List<GridRegion> rinfos = [];
+                        foreach (object r in replyData.Values)
                         {
-                            GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
-                            rinfos.Add(rinfo);
+                            if (r is Dictionary<string, object> dr)
+                            {
+                                GridRegion rinfo = new(dr);
+                                rinfos.Add(rinfo);
+                            }
                         }
+                        return rinfos;
                     }
+                    else
+                        m_log.Debug($"[GRID CONNECTOR]: GetDefaultHypergridRegions {scopeID} received empty response");
                 }
                 else
-                    m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultHypergridRegions {0} received null response",
-                        scopeID);
+                    m_log.Debug("[GRID CONNECTOR]: GetDefaultHypergridRegions received empty reply");
+
+            }
+            catch (Exception e)
+            {
+                m_log.Debug($"[GRID CONNECTOR]: Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultHypergridRegions received null reply");
 
-            return rinfos;
+            return [];
         }
 
         public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
-
-            sendData["SCOPEID"] = scopeID.ToString();
-            sendData["X"] = x.ToString();
-            sendData["Y"] = y.ToString();
+            Dictionary<string, object> sendData = new()
+            {
+                ["SCOPEID"] = scopeID.ToString(),
+                ["X"] = x.ToString(),
+                ["Y"] = y.ToString(),
 
-            sendData["METHOD"] = "get_fallback_regions";
+                ["METHOD"] = "get_fallback_regions"
+            };
 
-            List<GridRegion> rinfos = new List<GridRegion>();
-            string reply = string.Empty;
-            string uri = m_ServerURI + "/grid";
             try
             {
-                reply = SynchronousRestFormsRequester.MakeRequest("POST",
-                        uri,
+                string reply = SynchronousRestFormsRequester.MakePostRequest(
+                        m_ServerGridURI,
                         ServerUtils.BuildQueryString(sendData), m_Auth);
 
                 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
-                return rinfos;
-            }
-
-            if (reply != string.Empty)
-            {
-                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
-
-                if (replyData != null)
+                if (reply.Length > 0)
                 {
-                    Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
-                    foreach (object r in rinfosList)
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+
+                    if (replyData.Count > 0)
                     {
-                        if (r is Dictionary<string, object>)
+                        List<GridRegion> rinfos = [];
+                        foreach (object r in replyData.Values)
                         {
-                            GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
-                            rinfos.Add(rinfo);
+                            if (r is Dictionary<string, object> dr)
+                            {
+                                GridRegion rinfo = new(dr);
+                                rinfos.Add(rinfo);
+                            }
                         }
+                        return rinfos;
                     }
+                    else
+                        m_log.Debug($"[GRID CONNECTOR]: GetFallbackRegions {scopeID}, {x}-{y} received empty response");
                 }
                 else
-                    m_log.DebugFormat("[GRID CONNECTOR]: GetFallbackRegions {0}, {1}-{2} received null response",
-                        scopeID, x, y);
+                    m_log.Debug("[GRID CONNECTOR]: GetFallbackRegions received empty reply");
+            }
+            catch (Exception e)
+            {
+                m_log.Debug($"[GRID CONNECTOR]: Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetFallbackRegions received null reply");
 
-            return rinfos;
+            return [];
         }
 
         public List<GridRegion> GetOnlineRegions(UUID scopeID, int x, int y, int maxCount)
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
-
-            sendData["SCOPEID"] = scopeID.ToString();
-            sendData["X"] = x.ToString();
-            sendData["Y"] = y.ToString();
-            sendData["MC"] = maxCount.ToString();
+            Dictionary<string, object> sendData = new()
+            {
+                ["SCOPEID"] = scopeID.ToString(),
+                ["X"] = x.ToString(),
+                ["Y"] = y.ToString(),
+                ["MC"] = maxCount.ToString(),
 
-            sendData["METHOD"] = "get_online_regions";
+                ["METHOD"] = "get_online_regions"
+            };
 
-            List<GridRegion> rinfos = new List<GridRegion>();
-            string reply = string.Empty;
             try
             {
-                reply = SynchronousRestFormsRequester.MakePostRequest(m_ServerURI + "/grid",
-                        ServerUtils.BuildQueryString(sendData), m_Auth);
+                string reply = SynchronousRestFormsRequester.MakePostRequest(m_ServerGridURI, ServerUtils.BuildQueryString(sendData), m_Auth);
 
                 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", m_ServerURI + "/grid", e.Message);
-                return rinfos;
-            }
-
-            if (reply != string.Empty)
-            {
-                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
-
-                if (replyData != null)
+                if (reply.Length > 0)
                 {
-                    Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
-                    foreach (object r in rinfosList)
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+
+                    if (replyData.Count > 0)
                     {
-                        if (r is Dictionary<string, object>)
+                        List<GridRegion> rinfos = [];
+                        foreach (object r in  replyData.Values)
                         {
-                            GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
-                            rinfos.Add(rinfo);
+                            if (r is Dictionary<string, object> dr)
+                            {
+                                GridRegion rinfo = new(dr);
+                                rinfos.Add(rinfo);
+                            }
                         }
+                        return rinfos;
                     }
+                    else
+                        m_log.Debug($"[GRID CONNECTOR]: GetOnlineRegions {scopeID}, {x}-{y} received empty response");
                 }
                 else
-                    m_log.DebugFormat("[GRID CONNECTOR]: GetOnlineRegions {0}, {1}-{2} received null response",
-                        scopeID, x, y);
+                    m_log.Debug("[GRID CONNECTOR]: GetOnlineRegions received empty reply");
+            }
+            catch (Exception e)
+            {
+                m_log.Debug($"[GRID CONNECTOR]: Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetOnlineRegions received null reply");
 
-            return rinfos;
+            return [];
         }
 
         public List<GridRegion> GetHyperlinks(UUID scopeID)
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
-
-            sendData["SCOPEID"] = scopeID.ToString();
+            Dictionary<string, object> sendData = new()
+            {
+                ["SCOPEID"] = scopeID.ToString(),
 
-            sendData["METHOD"] = "get_hyperlinks";
+                ["METHOD"] = "get_hyperlinks"
+            };
 
-            List<GridRegion> rinfos = new List<GridRegion>();
-            string reply = string.Empty;
-            string uri = m_ServerURI + "/grid";
             try
             {
-                reply = SynchronousRestFormsRequester.MakeRequest("POST",
-                        uri,
+                string reply = SynchronousRestFormsRequester.MakePostRequest(
+                        m_ServerGridURI,
                         ServerUtils.BuildQueryString(sendData), m_Auth);
 
                 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
-                return rinfos;
-            }
-
-            if (reply != string.Empty)
-            {
-                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
-
-                if (replyData != null)
+                if (reply.Length > 0)
                 {
-                    Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
-                    foreach (object r in rinfosList)
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+
+                    if (replyData.Count > 0)
                     {
-                        if (r is Dictionary<string, object>)
+                        List<GridRegion> rinfos = [];
+                        foreach (object r in replyData.Values)
                         {
-                            GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
-                            rinfos.Add(rinfo);
+                            if (r is Dictionary<string, object> dr)
+                            {
+                                GridRegion rinfo = new(dr);
+                                rinfos.Add(rinfo);
+                            }
                         }
+                        return rinfos;
                     }
+                    else
+                        m_log.Debug($"[GRID CONNECTOR]: GetHyperlinks {scopeID} received empty response");
                 }
                 else
-                    m_log.DebugFormat("[GRID CONNECTOR]: GetHyperlinks {0} received null response",
-                        scopeID);
+                    m_log.Debug("[GRID CONNECTOR]: GetHyperlinks received empty reply");
+            }
+            catch (Exception e)
+            {
+                m_log.Debug($"[GRID CONNECTOR]: Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetHyperlinks received null reply");
 
-            return rinfos;
+            return [];
         }
 
         public int GetRegionFlags(UUID scopeID, UUID regionID)
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
-
-            sendData["SCOPEID"] = scopeID.ToString();
-            sendData["REGIONID"] = regionID.ToString();
+            Dictionary<string, object> sendData = new()
+            {
+                ["SCOPEID"] = scopeID.ToString(),
+                ["REGIONID"] = regionID.ToString(),
 
-            sendData["METHOD"] = "get_region_flags";
+                ["METHOD"] = "get_region_flags"
+            };
 
-            string reply = string.Empty;
-            string uri = m_ServerURI + "/grid";
             try
             {
-                reply = SynchronousRestFormsRequester.MakeRequest("POST",
-                        uri,
+                string reply = SynchronousRestFormsRequester.MakePostRequest(
+                        m_ServerGridURI,
                         ServerUtils.BuildQueryString(sendData), m_Auth);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
-                return -1;
-            }
-
-            int flags = -1;
 
-            if (reply != string.Empty)
-            {
-                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
-
-                if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null))
+                if (reply.Length > 0)
                 {
-                    Int32.TryParse((string)replyData["result"], out flags);
-                    //else
-                    //    m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags {0}, {1} received wrong type {2}",
-                    //        scopeID, regionID, replyData["result"].GetType());
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+                    if (replyData.TryGetValue("result", out object tmpo) &&
+                            tmpo is string tmps &&
+                            Int32.TryParse(tmps, out int flags))
+                        return flags;
+                     else
+                        m_log.Debug($"[GRID CONNECTOR]: GetRegionFlags {scopeID}, {regionID} received invalid response");
                 }
                 else
-                    m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags {0}, {1} received null response",
-                        scopeID, regionID);
+                    m_log.Debug("[GRID CONNECTOR]: GetRegionFlags received empty reply");
+
+            }
+            catch (Exception e)
+            {
+                m_log.Debug($"[GRID CONNECTOR]: Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags received null reply");
 
-            return flags;
+            return -1;
         }
 
         public Dictionary<string, object> GetExtraFeatures()
         {
-            Dictionary<string, object> sendData = new Dictionary<string, object>();
-            Dictionary<string, object> extraFeatures = new Dictionary<string, object>();
-
-            sendData["METHOD"] = "get_grid_extra_features";
-
-            string reply = string.Empty;
-            string uri = m_ServerURI + "/grid";
+            Dictionary<string, object> sendData = new()
+            {
+                ["METHOD"] = "get_grid_extra_features"
+            };
 
             try
             {
-                reply = SynchronousRestFormsRequester.MakeRequest("POST",
-                                                                  uri,
+                string reply = SynchronousRestFormsRequester.MakePostRequest(
+                                                                  m_ServerGridURI,
                                                                   ServerUtils.BuildQueryString(sendData), m_Auth);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID CONNECTOR]: GetExtraFeatures - Exception when contacting grid server at {0}: {1}", uri, e.Message);
-                return extraFeatures;
-            }
-
-            if (reply != string.Empty)
-            {
-                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
-
-                if ((replyData != null) && replyData.Count > 0)
+                if (reply.Length > 0)
                 {
-                    foreach (string key in replyData.Keys)
+                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
+                    if (replyData.Count > 0)
                     {
-                        extraFeatures[key] = replyData[key].ToString();
+                        Dictionary<string, object> extraFeatures = [];
+                        foreach (string key in replyData.Keys)
+                        {
+                            extraFeatures[key] = replyData[key].ToString();
+                        }
+                        return extraFeatures;
                     }
                 }
+                else
+                    m_log.Debug("[GRID CONNECTOR]: GetExtraServiceURLs received empty reply");
+            }
+            catch (Exception e)
+            {
+                m_log.Debug($"[GRID CONNECTOR]: GetExtraFeatures - Exception when contacting grid server at {m_ServerGridURI}: {e.Message}");
             }
-            else
-                m_log.DebugFormat("[GRID CONNECTOR]: GetExtraServiceURLs received null reply");
 
-            return extraFeatures;
+            return [];
         }
         #endregion
 

+ 2 - 4
OpenSim/Services/GridService/GridService.cs

@@ -44,9 +44,7 @@ namespace OpenSim.Services.GridService
 {
     public class GridService : GridServiceBase, IGridService
     {
-        private static readonly ILog m_log =
-                LogManager.GetLogger(
-                MethodBase.GetCurrentMethod().DeclaringType);
+        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
         private string LogHeader = "[GRID SERVICE]";
 
         private bool m_DeleteOnUnregister = true;
@@ -599,7 +597,7 @@ namespace OpenSim.Services.GridService
                 if (!uri.ResolveDNS())
                     return null;
                 if(!m_HypergridLinker.IsLocalGrid(uri.HostUrl))
-                return null;
+                    return null;
             }
 
             if (uri.HasRegionName)