From ac135c649c55fefc73e2f5f654a5ff65f45d50c0 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 30 Apr 2013 23:35:59 +0200
Subject: Fix CAPS to work like they should - do not send caps to the viewer if
they're not in the requested caps list. The previous wrong behavior caused
the debug setting "UseHTTPInventory" to fail on all viewers when turned off.
UDB inventory would not be correctly used in that case.
---
OpenSim/Capabilities/CapsHandlers.cs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/CapsHandlers.cs b/OpenSim/Capabilities/CapsHandlers.cs
index 1709f46..458272d 100644
--- a/OpenSim/Capabilities/CapsHandlers.cs
+++ b/OpenSim/Capabilities/CapsHandlers.cs
@@ -158,7 +158,7 @@ namespace OpenSim.Framework.Capabilities
/// capabilities and their handler details.
///
/// If true, then exclude the seed cap.
- public Hashtable GetCapsDetails(bool excludeSeed)
+ public Hashtable GetCapsDetails(bool excludeSeed, List requestedCaps)
{
Hashtable caps = new Hashtable();
string protocol = "http://";
@@ -175,6 +175,9 @@ namespace OpenSim.Framework.Capabilities
if (excludeSeed && "SEED" == capsName)
continue;
+ if (requestedCaps != null && !requestedCaps.Contains(capsName))
+ continue;
+
caps[capsName] = baseUrl + m_capsHandlers[capsName].Path;
}
}
@@ -182,4 +185,4 @@ namespace OpenSim.Framework.Capabilities
return caps;
}
}
-}
\ No newline at end of file
+}
--
cgit v1.1
From e92c05ebbdc44084326c3dcfa0a2ca0958e4b5e6 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Tue, 7 May 2013 18:01:48 -0700
Subject: Added AvatarPickerSearch capability handler.
---
.../AvatarPickerSearchHandler.cs | 116 +++++++++++++++++++++
OpenSim/Capabilities/LLSDAvatarPicker.cs | 51 +++++++++
2 files changed, 167 insertions(+)
create mode 100644 OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
create mode 100644 OpenSim/Capabilities/LLSDAvatarPicker.cs
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
new file mode 100644
index 0000000..4dca592
--- /dev/null
+++ b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
@@ -0,0 +1,116 @@
+/*
+ * 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.Collections.Specialized;
+using System.IO;
+using System.Reflection;
+using System.Web;
+using log4net;
+using Nini.Config;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Framework.Capabilities;
+using OpenSim.Framework.Servers;
+using OpenSim.Framework.Servers.HttpServer;
+//using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Services.Interfaces;
+using Caps = OpenSim.Framework.Capabilities.Caps;
+
+namespace OpenSim.Capabilities.Handlers
+{
+ public class AvatarPickerSearchHandler : BaseStreamHandler
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ private IPeople m_PeopleService;
+
+ public AvatarPickerSearchHandler(string path, IPeople peopleService, string name, string description)
+ : base("GET", path, name, description)
+ {
+ m_PeopleService = peopleService;
+ }
+
+ public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
+ {
+ // Try to parse the texture ID from the request URL
+ NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
+ string names = query.GetOne("names");
+ string psize = query.GetOne("page_size");
+ string pnumber = query.GetOne("page");
+
+ if (m_PeopleService == null)
+ return FailureResponse(names, (int)System.Net.HttpStatusCode.InternalServerError, httpResponse);
+
+ if (string.IsNullOrEmpty(names) || names.Length < 3)
+ return FailureResponse(names, (int)System.Net.HttpStatusCode.BadRequest, httpResponse);
+
+ m_log.DebugFormat("[AVATAR PICKER SEARCH]: search for {0}", names);
+
+ int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize));
+ int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber));
+
+ // Full content request
+ httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
+ //httpResponse.ContentLength = ??;
+ httpResponse.ContentType = "application/llsd+xml";
+
+ List users = m_PeopleService.GetUserData(names, page_size, page_number);
+
+ LLSDAvatarPicker osdReply = new LLSDAvatarPicker();
+ osdReply.next_page_url = httpRequest.RawUrl;
+ foreach (UserData u in users)
+ osdReply.agents.Array.Add(ConvertUserData(u));
+
+ string reply = LLSDHelpers.SerialiseLLSDReply(osdReply);
+ return System.Text.Encoding.UTF8.GetBytes(reply);
+ }
+
+ private LLSDPerson ConvertUserData(UserData user)
+ {
+ LLSDPerson p = new LLSDPerson();
+ p.legacy_first_name = user.FirstName;
+ p.legacy_last_name = user.LastName;
+ p.display_name = user.FirstName + " " + user.LastName;
+ if (user.LastName.StartsWith("@"))
+ p.username = user.FirstName.ToLower() + user.LastName.ToLower();
+ else
+ p.username = user.FirstName.ToLower() + "." + user.LastName.ToLower();
+ p.id = user.Id;
+ p.is_display_name_default = false;
+ return p;
+ }
+
+ private byte[] FailureResponse(string names, int statuscode, IOSHttpResponse httpResponse)
+ {
+ m_log.Error("[AVATAR PICKER SEARCH]: Error searching for " + names);
+ httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
+ return System.Text.Encoding.UTF8.GetBytes(string.Empty);
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Capabilities/LLSDAvatarPicker.cs b/OpenSim/Capabilities/LLSDAvatarPicker.cs
new file mode 100644
index 0000000..d0b3f3a
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDAvatarPicker.cs
@@ -0,0 +1,51 @@
+/*
+ * 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 OpenMetaverse;
+
+namespace OpenSim.Framework.Capabilities
+{
+ [OSDMap]
+ public class LLSDAvatarPicker
+ {
+ public string next_page_url;
+ // an array of LLSDPerson
+ public OSDArray agents = new OSDArray();
+ }
+
+ [OSDMap]
+ public class LLSDPerson
+ {
+ public string username;
+ public string display_name;
+ //'display_name_next_update':d"1970-01-01T00:00:00Z"
+ public string legacy_first_name;
+ public string legacy_last_name;
+ public UUID id;
+ public bool is_display_name_default;
+ }
+}
\ No newline at end of file
--
cgit v1.1
From 57141e34bf415861a8acfdaa0086e0e651c679d9 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Mon, 10 Jun 2013 13:26:19 -0700
Subject: Remove Temporary from use to shortcut asset stores. The Local
property differentiates between local & grid storage. The Temporary property
just says that which service handles the it, the asset can be safely removed
in the future.
---
OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | 1 +
1 file changed, 1 insertion(+)
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index b497fde..9f3cc19 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -189,6 +189,7 @@ namespace OpenSim.Capabilities.Handlers
newTexture.Flags = AssetFlags.Collectable;
newTexture.Temporary = true;
+ newTexture.Local = true;
m_assetService.Store(newTexture);
WriteTextureData(httpRequest, httpResponse, newTexture, format);
return true;
--
cgit v1.1
From 3370e19205352a4ba75e384f8719836a0da0b1df Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 20 Jun 2013 00:17:20 +0100
Subject: minor: fix mono compiler warning in FetchInventory2Handler
---
.../Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs
index c0ca1e1..2c91328 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Capabilities.Handlers
{
public class FetchInventory2Handler
{
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IInventoryService m_inventoryService;
@@ -121,4 +121,4 @@ namespace OpenSim.Capabilities.Handlers
return llsdItem;
}
}
-}
+}
\ No newline at end of file
--
cgit v1.1
From ff47cf77ab52d42195fb0f089599618511d4919b Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 29 Jun 2013 19:15:25 -0700
Subject: A little more debug for the Unknown User problem mantis #6625
---
.../Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs | 3 +++
1 file changed, 3 insertions(+)
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
index 4dca592..1db4ad0 100644
--- a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
+++ b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
@@ -103,6 +103,9 @@ namespace OpenSim.Capabilities.Handlers
p.username = user.FirstName.ToLower() + "." + user.LastName.ToLower();
p.id = user.Id;
p.is_display_name_default = false;
+
+ if (user.FirstName.StartsWith("Unknown") && user.LastName.StartsWith("User"))
+ m_log.DebugFormat("[AVATAR PICKER SEARCH]: Sending {0} {1}", user.FirstName, user.LastName);
return p;
}
--
cgit v1.1
From d7775d1e113560307af0170f8d2eab628a5e8acb Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sun, 30 Jun 2013 07:22:27 -0700
Subject: Revert "A little more debug for the Unknown User problem mantis
#6625"
This reverts commit ff47cf77ab52d42195fb0f089599618511d4919b.
---
.../Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs | 3 ---
1 file changed, 3 deletions(-)
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
index 1db4ad0..4dca592 100644
--- a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
+++ b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
@@ -103,9 +103,6 @@ namespace OpenSim.Capabilities.Handlers
p.username = user.FirstName.ToLower() + "." + user.LastName.ToLower();
p.id = user.Id;
p.is_display_name_default = false;
-
- if (user.FirstName.StartsWith("Unknown") && user.LastName.StartsWith("User"))
- m_log.DebugFormat("[AVATAR PICKER SEARCH]: Sending {0} {1}", user.FirstName, user.LastName);
return p;
}
--
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
---
OpenSim/Capabilities/CapsHandlers.cs | 16 ++++++++++++++--
.../AvatarPickerSearch/AvatarPickerSearchHandler.cs | 2 +-
.../Handlers/GetTexture/GetTextureHandler.cs | 2 +-
OpenSim/Capabilities/LLSDStreamHandler.cs | 2 +-
4 files changed, 17 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/CapsHandlers.cs b/OpenSim/Capabilities/CapsHandlers.cs
index 458272d..890df90 100644
--- a/OpenSim/Capabilities/CapsHandlers.cs
+++ b/OpenSim/Capabilities/CapsHandlers.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Framework.Capabilities
///
public class CapsHandlers
{
- private Dictionary m_capsHandlers = new Dictionary();
+ private Dictionary m_capsHandlers = new Dictionary();
private IHttpServer m_httpListener;
private string m_httpListenerHostName;
private uint m_httpListenerPort;
@@ -184,5 +184,17 @@ namespace OpenSim.Framework.Capabilities
return caps;
}
+
+ ///
+ /// Returns a copy of the dictionary of all the HTTP cap handlers
+ ///
+ ///
+ /// The dictionary copy. The key is the capability name, the value is the HTTP handler.
+ ///
+ public Dictionary GetCapsHandlers()
+ {
+ lock (m_capsHandlers)
+ return new Dictionary(m_capsHandlers);
+ }
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
index 4dca592..426174d 100644
--- a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
+++ b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Capabilities.Handlers
m_PeopleService = peopleService;
}
- public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
+ protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Try to parse the texture ID from the request URL
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index 9f3cc19..789bf2b 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Capabilities.Handlers
m_assetService = assService;
}
- public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
+ protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Try to parse the texture ID from the request URL
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
diff --git a/OpenSim/Capabilities/LLSDStreamHandler.cs b/OpenSim/Capabilities/LLSDStreamHandler.cs
index 5df24b2..4fa1153 100644
--- a/OpenSim/Capabilities/LLSDStreamHandler.cs
+++ b/OpenSim/Capabilities/LLSDStreamHandler.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Capabilities
m_method = method;
}
- public override byte[] Handle(string path, Stream request,
+ protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
//Encoding encoding = Util.UTF8;
--
cgit v1.1
From 013710168b3878fc0a93a92a1c026efb49da9935 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 8 Jul 2013 22:39:07 +0100
Subject: For stat purposes, add names to capability request handlers where
these were not set
---
OpenSim/Capabilities/Caps.cs | 1 -
1 file changed, 1 deletion(-)
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs
index bc6f6f9..1bed1a5 100644
--- a/OpenSim/Capabilities/Caps.cs
+++ b/OpenSim/Capabilities/Caps.cs
@@ -144,7 +144,6 @@ namespace OpenSim.Framework.Capabilities
public void RegisterHandler(string capName, IRequestHandler handler)
{
m_capsHandlers[capName] = handler;
- //m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path);
}
///
--
cgit v1.1
From 8be59829d1fcf4c4f42a1a859aef6aa5f4f29073 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 8 Jul 2013 22:41:24 +0100
Subject: minor: Add back commented out logging message in
Caps.RegisterHandler() that I accidentally removed.
---
OpenSim/Capabilities/Caps.cs | 1 +
1 file changed, 1 insertion(+)
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs
index 1bed1a5..6c95d8b 100644
--- a/OpenSim/Capabilities/Caps.cs
+++ b/OpenSim/Capabilities/Caps.cs
@@ -143,6 +143,7 @@ namespace OpenSim.Framework.Capabilities
///
public void RegisterHandler(string capName, IRequestHandler handler)
{
+ //m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path);
m_capsHandlers[capName] = handler;
}
--
cgit v1.1
From cd64a70c793e746416a7f91e423d52dda4b05722 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 13 Jul 2013 08:31:03 -0700
Subject: Added UploadBakedTexture/UploadBakedTextureServerConnector, so that
this can eventually be served by a robust instance. NOT FINISHED YET.
---
.../UploadBakedTextureServerConnector.cs | 76 ++++++++++++++++++++++
1 file changed, 76 insertions(+)
create mode 100644 OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs
new file mode 100644
index 0000000..10ea8ee
--- /dev/null
+++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs
@@ -0,0 +1,76 @@
+/*
+ * 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;
+using OpenMetaverse;
+
+namespace OpenSim.Capabilities.Handlers
+{
+ public class UploadBakedTextureServerConnector : ServiceConnector
+ {
+ private IAssetService m_AssetService;
+ private string m_ConfigName = "CapsService";
+
+ public UploadBakedTextureServerConnector(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("AssetService", String.Empty);
+
+ if (assetService == String.Empty)
+ throw new Exception("No AssetService in config file");
+
+ Object[] args = new Object[] { config };
+ m_AssetService =
+ ServerUtils.LoadPlugin(assetService, args);
+
+ if (m_AssetService == null)
+ throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
+
+ // NEED TO FIX THIS
+ OpenSim.Framework.Capabilities.Caps caps = new OpenSim.Framework.Capabilities.Caps(server, "", server.Port, "", UUID.Zero, "");
+ server.AddStreamHandler(new RestStreamHandler(
+ "POST",
+ "/CAPS/UploadBakedTexture/",
+ new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture,
+ "UploadBakedTexture",
+ "Upload Baked Texture Capability"));
+
+ }
+ }
+}
\ No newline at end of file
--
cgit v1.1
From 1b7b664c8696531fec26378d1386362d8a3da55e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 15 Jul 2013 23:22:39 +0100
Subject: Add request received/handling stats for caps which are served by http
poll handlers.
This adds explicit cap poll handler supporting to the Caps classes rather than relying on callers to do the complicated coding.
Other refactoring was required to get logic into the right places to support this.
---
OpenSim/Capabilities/Caps.cs | 93 +++++++++++++++++++++++++++++++++++++++++---
1 file changed, 87 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs
index 6c95d8b..bbf3b27 100644
--- a/OpenSim/Capabilities/Caps.cs
+++ b/OpenSim/Capabilities/Caps.cs
@@ -63,7 +63,11 @@ namespace OpenSim.Framework.Capabilities
public string CapsObjectPath { get { return m_capsObjectPath; } }
private CapsHandlers m_capsHandlers;
- private Dictionary m_externalCapsHandlers;
+
+ private Dictionary m_pollServiceHandlers
+ = new Dictionary();
+
+ private Dictionary m_externalCapsHandlers = new Dictionary();
private IHttpServer m_httpListener;
private UUID m_agentID;
@@ -132,7 +136,6 @@ namespace OpenSim.Framework.Capabilities
m_agentID = agent;
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
- m_externalCapsHandlers = new Dictionary();
m_regionName = regionName;
}
@@ -147,6 +150,27 @@ namespace OpenSim.Framework.Capabilities
m_capsHandlers[capName] = handler;
}
+ public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler)
+ {
+ m_pollServiceHandlers.Add(capName, pollServiceHandler);
+
+ m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler.Url, pollServiceHandler);
+
+// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
+// string protocol = "http";
+// string hostName = m_httpListenerHostName;
+//
+// if (MainServer.Instance.UseSSL)
+// {
+// hostName = MainServer.Instance.SSLCommonName;
+// port = MainServer.Instance.SSLPort;
+// protocol = "https";
+// }
+
+// RegisterHandler(
+// capName, String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, pollServiceHandler.Url));
+ }
+
///
/// Register an external handler. The service for this capability is somewhere else
/// given by the URL.
@@ -163,13 +187,70 @@ namespace OpenSim.Framework.Capabilities
///
public void DeregisterHandlers()
{
- if (m_capsHandlers != null)
+ foreach (string capsName in m_capsHandlers.Caps)
+ {
+ m_capsHandlers.Remove(capsName);
+ }
+
+ foreach (PollServiceEventArgs handler in m_pollServiceHandlers.Values)
+ {
+ m_httpListener.RemovePollServiceHTTPHandler("", handler.Url);
+ }
+ }
+
+ public bool TryGetPollHandler(string name, out PollServiceEventArgs pollHandler)
+ {
+ return m_pollServiceHandlers.TryGetValue(name, out pollHandler);
+ }
+
+ public Dictionary GetPollHandlers()
+ {
+ return new Dictionary(m_pollServiceHandlers);
+ }
+
+ ///
+ /// Return an LLSD-serializable Hashtable describing the
+ /// capabilities and their handler details.
+ ///
+ /// If true, then exclude the seed cap.
+ public Hashtable GetCapsDetails(bool excludeSeed, List requestedCaps)
+ {
+ Hashtable caps = CapsHandlers.GetCapsDetails(excludeSeed, requestedCaps);
+
+ lock (m_pollServiceHandlers)
{
- foreach (string capsName in m_capsHandlers.Caps)
+ foreach (KeyValuePair kvp in m_pollServiceHandlers)
{
- m_capsHandlers.Remove(capsName);
+ if (!requestedCaps.Contains(kvp.Key))
+ continue;
+
+ string hostName = m_httpListenerHostName;
+ uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
+ string protocol = "http";
+
+ if (MainServer.Instance.UseSSL)
+ {
+ hostName = MainServer.Instance.SSLCommonName;
+ port = MainServer.Instance.SSLPort;
+ protocol = "https";
+ }
+ //
+ // caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
+
+ caps[kvp.Key] = string.Format("{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url);
}
}
+
+ // Add the external too
+ foreach (KeyValuePair kvp in ExternalCapsHandlers)
+ {
+ if (!requestedCaps.Contains(kvp.Key))
+ continue;
+
+ caps[kvp.Key] = kvp.Value;
+ }
+
+ return caps;
}
}
-}
+}
\ No newline at end of file
--
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/Capabilities/Handlers/Properties/AssemblyInfo.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs
index f8f63f4..0cf8bf4 100644
--- a/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs
+++ b/OpenSim/Capabilities/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 7cab41f4223b7febd3fdd42fa7cfefef25e4a9c9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 15 Nov 2013 21:45:08 +0000
Subject: refactor: replace verbose checks with String.IsNullOrEmpty where
applicable.
Thanks to Kira for this patch from http://opensimulator.org/mantis/view.php?id=6845
---
OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Capabilities')
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index 789bf2b..7b3124a 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -85,7 +85,7 @@ namespace OpenSim.Capabilities.Handlers
// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID);
string[] formats;
- if (format != null && format != string.Empty)
+ if (!string.IsNullOrEmpty(format))
{
formats = new string[1] { format.ToLower() };
}
--
cgit v1.1