diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index b76d6af038..e31ffbb607 100755 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -429,7 +429,7 @@ namespace OpenSim.Framework.Console } // This call is a CAP. The URL is the authentication. - string uri = "/ReadResponses/" + sessionID.ToString() + "/"; + string uri = "/ReadResponses/" + sessionID.ToString(); m_Server.AddPollServiceHTTPHandler(new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, null, sessionID,25000)); // 25 secs timeout diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 4c74184b3e..06384c285e 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -672,10 +672,7 @@ namespace OpenSim.Framework.Servers.HttpServer return; } - // workaround for Lumiya and others that append a extra / - int len = path.Length - 1; - if (len > 1 && path[len] == '/' && path[len - 1] == '/') - path = path.Substring(0, len); + path = Util.TrimEndSlash(path); if (TryGetSimpleStreamHandler(path, out ISimpleStreamHandler hdr)) { diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e09d64fb62..e7aac71f6a 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2451,7 +2451,27 @@ namespace OpenSim.Framework return found.ToArray(); } - public static string ServerURI(string uri) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public static string AppendEndSlash(string path) + { + int len = path.Length; + --len; + if (len > 0 && path[len] != '/') + return path + '/'; + return path; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public static string TrimEndSlash(string path) + { + int len = path.Length; + --len; + if (len > 0 && path[len] == '/') + return path.Substring(0, len); + return path; + } + + public static string ServerURIasIP(string uri) { if (uri == string.Empty) return string.Empty; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs index 01a7cc917c..79026b1ec1 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs @@ -120,7 +120,7 @@ namespace OpenSim.Region.ClientStack.Linden // m_log.DebugFormat("[AVATAR PICKER SEARCH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); if(m_People != null) caps.RegisterSimpleHandler("AvatarPickerSearch", - new SimpleStreamHandler("/" + UUID.Random() + "/", ProcessRequest)); + new SimpleStreamHandler("/" + UUID.Random(), ProcessRequest)); } else { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 90213e40dd..f969bc8a3a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -237,7 +237,7 @@ namespace OpenSim.Region.ClientStack.Linden public void RegisterHandlers() { // this path is also defined elsewhere so keeping it - string seedcapsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath + "0000/"; + string seedcapsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath + "0000"; m_HostCapsObj.RegisterSimpleHandler("SEED", new SimpleStreamHandler(seedcapsBase, SeedCapRequest)); // m_log.DebugFormat( @@ -342,7 +342,7 @@ namespace OpenSim.Region.ClientStack.Linden if (m_UserManager != null) { m_HostCapsObj.RegisterSimpleHandler("GetDisplayNames", - new SimpleStreamHandler(GetNewCapPath() +"/", GetDisplayNames)); + new SimpleStreamHandler(GetNewCapPath(), GetDisplayNames)); } } catch (Exception e) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs b/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs index b74f3dbc42..72dec52ac9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs @@ -128,7 +128,7 @@ namespace OpenSim.Region.ClientStack.Linden public void RegisterCaps(UUID agentID, Caps caps) { caps.RegisterSimpleHandler("EstateAccess", - new SimpleStreamHandler("/" + UUID.Random() + "/", + new SimpleStreamHandler("/" + UUID.Random(), delegate(IOSHttpRequest request, IOSHttpResponse response) { ProcessRequest(request, response, agentID); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetAssetsModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetAssetsModule.cs index abab47f535..8c0decf169 100755 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetAssetsModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetAssetsModule.cs @@ -393,7 +393,7 @@ namespace OpenSim.Region.ClientStack.Linden if (m_GetTextureURL == "localhost") { - string capUrl = "/CAPS/" + UUID.Random() + "/"; + string capUrl = "/" + UUID.Random(); // Register this as a poll service PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene); @@ -415,7 +415,7 @@ namespace OpenSim.Region.ClientStack.Linden //GetMesh if (m_GetMeshURL == "localhost") { - string capUrl = "/CAPS/" + UUID.Random() + "/"; + string capUrl = "/" + UUID.Random(); PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene); //args.Type = PollServiceEventArgs.EventType.Mesh; @@ -433,7 +433,7 @@ namespace OpenSim.Region.ClientStack.Linden //GetMesh2 if (m_GetMesh2URL == "localhost") { - string capUrl = "/CAPS/" + UUID.Random() + "/"; + string capUrl = "/" + UUID.Random(); PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene); //args.Type = PollServiceEventArgs.EventType.Mesh2; @@ -452,7 +452,7 @@ namespace OpenSim.Region.ClientStack.Linden //ViewerAsset if (m_GetAssetURL == "localhost") { - string capUrl = "/CAPS/" + UUID.Random() + "/"; + string capUrl = "/" + UUID.Random(); PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene); //args.Type = PollServiceEventArgs.EventType.Asset; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 0b80ec7800..3459c268b2 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -216,7 +216,7 @@ namespace OpenSim.Region.ClientStack.Linden public void RegisterCaps(UUID agentID, Caps caps) { caps.RegisterSimpleHandler("SimulatorFeatures", - new SimpleStreamHandler("/" + UUID.Random() + "/", + new SimpleStreamHandler("/" + UUID.Random(), delegate (IOSHttpRequest request, IOSHttpResponse response) { HandleSimulatorFeaturesRequest(request, response, agentID); @@ -225,7 +225,7 @@ namespace OpenSim.Region.ClientStack.Linden if (m_doScriptSyntax && m_scriptSyntaxID != UUID.Zero && m_scriptSyntaxXML != null) { caps.RegisterSimpleHandler("LSLSyntax", - new SimpleStreamHandler("/" + UUID.Random() + "/", HandleSyntaxRequest)); + new SimpleStreamHandler("/" + UUID.Random(), HandleSyntaxRequest)); } } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index e117ec798f..1580eae7e2 100755 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -380,7 +380,7 @@ namespace OpenSim.Region.ClientStack.Linden // handled by the simulator else if (url == "localhost") { - capUrl = "/CAPS/" + UUID.Random() + "/"; + capUrl = "/" + UUID.Random(); // Register this as a poll service PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(this, capUrl, agentID); diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index ad560d0522..2a54308013 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -257,7 +257,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp m_UrlMap[url] = urlData; - string uri = "/lslhttp/" + urlcode.ToString() + "/"; + string uri = "/lslhttp/" + urlcode.ToString(); PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, Drop, urlcode, 25000); @@ -315,7 +315,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp m_UrlMap[url] = urlData; - string uri = "/lslhttps/" + urlcode.ToString() + "/"; + string uri = "/lslhttps/" + urlcode.ToString(); PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, Drop, urlcode, 25000); diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 261c745ba3..c08373a84b 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -111,13 +111,13 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap caps.RegisterSimpleHandler("ObjectMedia", - new SimpleStreamHandler("/" + UUID.Random() + "/", delegate (IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + new SimpleStreamHandler("/" + UUID.Random(), delegate (IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { HandleObjectMediaMessage(httpRequest, httpResponse, agentID); })); caps.RegisterSimpleHandler("ObjectMediaNavigate", - new SimpleStreamHandler("/" + UUID.Random() + "/", delegate (IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + new SimpleStreamHandler("/" + UUID.Random(), delegate (IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { HandleObjectMediaNavigateMessage(httpRequest, httpResponse, agentID); })); diff --git a/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs b/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs index 4046efe877..e2c3192d8f 100644 --- a/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs @@ -130,8 +130,8 @@ namespace OpenSim.Region.UserStatistics // End Own reports section //// - MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest); - MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest); + MainServer.Instance.AddHTTPHandler("/SStats", HandleStatsRequest); + MainServer.Instance.AddHTTPHandler("/VS", HandleUnknownCAPSRequest); } public virtual void AddRegion(Scene scene) @@ -340,7 +340,7 @@ namespace OpenSim.Region.UserStatistics { // m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); - string capsPath = "/CAPS/VS/" + UUID.Random(); + string capsPath = "/" + UUID.Random(); caps.RegisterHandler( "ViewerStats", new RestStreamHandler(