remove end slash from most URLs we send to viewers

master
UbitUmarov 2020-05-10 21:14:52 +01:00
parent c1d69018bd
commit aafc6579a1
12 changed files with 41 additions and 24 deletions

View File

@ -429,7 +429,7 @@ namespace OpenSim.Framework.Console
} }
// This call is a CAP. The URL is the authentication. // 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 m_Server.AddPollServiceHTTPHandler(new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, null, sessionID,25000)); // 25 secs timeout

View File

@ -672,10 +672,7 @@ namespace OpenSim.Framework.Servers.HttpServer
return; return;
} }
// workaround for Lumiya and others that append a extra / path = Util.TrimEndSlash(path);
int len = path.Length - 1;
if (len > 1 && path[len] == '/' && path[len - 1] == '/')
path = path.Substring(0, len);
if (TryGetSimpleStreamHandler(path, out ISimpleStreamHandler hdr)) if (TryGetSimpleStreamHandler(path, out ISimpleStreamHandler hdr))
{ {

View File

@ -2451,7 +2451,27 @@ namespace OpenSim.Framework
return found.ToArray(); 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) if (uri == string.Empty)
return string.Empty; return string.Empty;

View File

@ -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); // m_log.DebugFormat("[AVATAR PICKER SEARCH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
if(m_People != null) if(m_People != null)
caps.RegisterSimpleHandler("AvatarPickerSearch", caps.RegisterSimpleHandler("AvatarPickerSearch",
new SimpleStreamHandler("/" + UUID.Random() + "/", ProcessRequest)); new SimpleStreamHandler("/" + UUID.Random(), ProcessRequest));
} }
else else
{ {

View File

@ -237,7 +237,7 @@ namespace OpenSim.Region.ClientStack.Linden
public void RegisterHandlers() public void RegisterHandlers()
{ {
// this path is also defined elsewhere so keeping it // 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_HostCapsObj.RegisterSimpleHandler("SEED", new SimpleStreamHandler(seedcapsBase, SeedCapRequest));
// m_log.DebugFormat( // m_log.DebugFormat(
@ -342,7 +342,7 @@ namespace OpenSim.Region.ClientStack.Linden
if (m_UserManager != null) if (m_UserManager != null)
{ {
m_HostCapsObj.RegisterSimpleHandler("GetDisplayNames", m_HostCapsObj.RegisterSimpleHandler("GetDisplayNames",
new SimpleStreamHandler(GetNewCapPath() +"/", GetDisplayNames)); new SimpleStreamHandler(GetNewCapPath(), GetDisplayNames));
} }
} }
catch (Exception e) catch (Exception e)

View File

@ -128,7 +128,7 @@ namespace OpenSim.Region.ClientStack.Linden
public void RegisterCaps(UUID agentID, Caps caps) public void RegisterCaps(UUID agentID, Caps caps)
{ {
caps.RegisterSimpleHandler("EstateAccess", caps.RegisterSimpleHandler("EstateAccess",
new SimpleStreamHandler("/" + UUID.Random() + "/", new SimpleStreamHandler("/" + UUID.Random(),
delegate(IOSHttpRequest request, IOSHttpResponse response) delegate(IOSHttpRequest request, IOSHttpResponse response)
{ {
ProcessRequest(request, response, agentID); ProcessRequest(request, response, agentID);

View File

@ -393,7 +393,7 @@ namespace OpenSim.Region.ClientStack.Linden
if (m_GetTextureURL == "localhost") if (m_GetTextureURL == "localhost")
{ {
string capUrl = "/CAPS/" + UUID.Random() + "/"; string capUrl = "/" + UUID.Random();
// Register this as a poll service // Register this as a poll service
PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene); PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene);
@ -415,7 +415,7 @@ namespace OpenSim.Region.ClientStack.Linden
//GetMesh //GetMesh
if (m_GetMeshURL == "localhost") if (m_GetMeshURL == "localhost")
{ {
string capUrl = "/CAPS/" + UUID.Random() + "/"; string capUrl = "/" + UUID.Random();
PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene); PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene);
//args.Type = PollServiceEventArgs.EventType.Mesh; //args.Type = PollServiceEventArgs.EventType.Mesh;
@ -433,7 +433,7 @@ namespace OpenSim.Region.ClientStack.Linden
//GetMesh2 //GetMesh2
if (m_GetMesh2URL == "localhost") if (m_GetMesh2URL == "localhost")
{ {
string capUrl = "/CAPS/" + UUID.Random() + "/"; string capUrl = "/" + UUID.Random();
PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene); PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene);
//args.Type = PollServiceEventArgs.EventType.Mesh2; //args.Type = PollServiceEventArgs.EventType.Mesh2;
@ -452,7 +452,7 @@ namespace OpenSim.Region.ClientStack.Linden
//ViewerAsset //ViewerAsset
if (m_GetAssetURL == "localhost") if (m_GetAssetURL == "localhost")
{ {
string capUrl = "/CAPS/" + UUID.Random() + "/"; string capUrl = "/" + UUID.Random();
PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene); PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene);
//args.Type = PollServiceEventArgs.EventType.Asset; //args.Type = PollServiceEventArgs.EventType.Asset;

View File

@ -216,7 +216,7 @@ namespace OpenSim.Region.ClientStack.Linden
public void RegisterCaps(UUID agentID, Caps caps) public void RegisterCaps(UUID agentID, Caps caps)
{ {
caps.RegisterSimpleHandler("SimulatorFeatures", caps.RegisterSimpleHandler("SimulatorFeatures",
new SimpleStreamHandler("/" + UUID.Random() + "/", new SimpleStreamHandler("/" + UUID.Random(),
delegate (IOSHttpRequest request, IOSHttpResponse response) delegate (IOSHttpRequest request, IOSHttpResponse response)
{ {
HandleSimulatorFeaturesRequest(request, response, agentID); HandleSimulatorFeaturesRequest(request, response, agentID);
@ -225,7 +225,7 @@ namespace OpenSim.Region.ClientStack.Linden
if (m_doScriptSyntax && m_scriptSyntaxID != UUID.Zero && m_scriptSyntaxXML != null) if (m_doScriptSyntax && m_scriptSyntaxID != UUID.Zero && m_scriptSyntaxXML != null)
{ {
caps.RegisterSimpleHandler("LSLSyntax", caps.RegisterSimpleHandler("LSLSyntax",
new SimpleStreamHandler("/" + UUID.Random() + "/", HandleSyntaxRequest)); new SimpleStreamHandler("/" + UUID.Random(), HandleSyntaxRequest));
} }
} }

View File

@ -380,7 +380,7 @@ namespace OpenSim.Region.ClientStack.Linden
// handled by the simulator // handled by the simulator
else if (url == "localhost") else if (url == "localhost")
{ {
capUrl = "/CAPS/" + UUID.Random() + "/"; capUrl = "/" + UUID.Random();
// Register this as a poll service // Register this as a poll service
PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(this, capUrl, agentID); PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(this, capUrl, agentID);

View File

@ -257,7 +257,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
m_UrlMap[url] = urlData; m_UrlMap[url] = urlData;
string uri = "/lslhttp/" + urlcode.ToString() + "/"; string uri = "/lslhttp/" + urlcode.ToString();
PollServiceEventArgs args PollServiceEventArgs args
= new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, Drop, urlcode, 25000); = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, Drop, urlcode, 25000);
@ -315,7 +315,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
m_UrlMap[url] = urlData; m_UrlMap[url] = urlData;
string uri = "/lslhttps/" + urlcode.ToString() + "/"; string uri = "/lslhttps/" + urlcode.ToString();
PollServiceEventArgs args PollServiceEventArgs args
= new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, Drop, urlcode, 25000); = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, Drop, urlcode, 25000);

View File

@ -111,13 +111,13 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
caps.RegisterSimpleHandler("ObjectMedia", 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); HandleObjectMediaMessage(httpRequest, httpResponse, agentID);
})); }));
caps.RegisterSimpleHandler("ObjectMediaNavigate", 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); HandleObjectMediaNavigateMessage(httpRequest, httpResponse, agentID);
})); }));

View File

@ -130,8 +130,8 @@ namespace OpenSim.Region.UserStatistics
// End Own reports section // End Own reports section
//// ////
MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest); MainServer.Instance.AddHTTPHandler("/SStats", HandleStatsRequest);
MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest); MainServer.Instance.AddHTTPHandler("/VS", HandleUnknownCAPSRequest);
} }
public virtual void AddRegion(Scene scene) 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); // 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( caps.RegisterHandler(
"ViewerStats", "ViewerStats",
new RestStreamHandler( new RestStreamHandler(