move SEED cap to simpleStreamHandler
parent
ba8d188a0d
commit
7856192da6
|
@ -31,7 +31,9 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
|
@ -130,7 +132,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
private bool m_AllowCapGroupMemberData = true;
|
private bool m_AllowCapGroupMemberData = true;
|
||||||
private IUserManagement m_UserManager;
|
private IUserManagement m_UserManager;
|
||||||
private IUserAccountService m_userAccountService;
|
private IUserAccountService m_userAccountService;
|
||||||
|
private IMoneyModule m_moneyModule;
|
||||||
|
|
||||||
private enum FileAgentInventoryState : int
|
private enum FileAgentInventoryState : int
|
||||||
{
|
{
|
||||||
|
@ -212,6 +214,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
m_regionName = m_Scene.RegionInfo.RegionName;
|
m_regionName = m_Scene.RegionInfo.RegionName;
|
||||||
m_UserManager = m_Scene.RequestModuleInterface<IUserManagement>();
|
m_UserManager = m_Scene.RequestModuleInterface<IUserManagement>();
|
||||||
m_userAccountService = m_Scene.RequestModuleInterface<IUserAccountService>();
|
m_userAccountService = m_Scene.RequestModuleInterface<IUserAccountService>();
|
||||||
|
m_moneyModule = m_Scene.RequestModuleInterface<IMoneyModule>();
|
||||||
if (m_UserManager == null)
|
if (m_UserManager == null)
|
||||||
m_log.Error("[CAPS]: GetDisplayNames disabled because user management component not found");
|
m_log.Error("[CAPS]: GetDisplayNames disabled because user management component not found");
|
||||||
|
|
||||||
|
@ -244,10 +247,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
// 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/";
|
||||||
|
|
||||||
// the root of all evil path needs to be capsBase + m_requestPath
|
m_HostCapsObj.RegisterSimpleHandler("SEED", new SimpleStreamHandler(seedcapsBase, SeedCapRequest));
|
||||||
m_HostCapsObj.RegisterHandler(
|
|
||||||
"SEED", new RestStreamHandler("POST", seedcapsBase, SeedCapRequest, "SEED", null));
|
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[CAPS]: Registered seed capability {0} for {1}", seedcapsBase, m_HostCapsObj.AgentID);
|
// "[CAPS]: Registered seed capability {0} for {1}", seedcapsBase, m_HostCapsObj.AgentID);
|
||||||
|
|
||||||
|
@ -368,41 +368,62 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
/// <param name="httpRequest">HTTP request header object</param>
|
/// <param name="httpRequest">HTTP request header object</param>
|
||||||
/// <param name="httpResponse">HTTP response header object</param>
|
/// <param name="httpResponse">HTTP response header object</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string SeedCapRequest(string request, string path, string param,
|
public void SeedCapRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
|
||||||
{
|
{
|
||||||
UUID agentID = m_HostCapsObj.AgentID;
|
UUID agentID = m_HostCapsObj.AgentID;
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, agentID);
|
"[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, agentID);
|
||||||
|
|
||||||
|
if(httpRequest.HttpMethod != "POST" || httpRequest.ContentType != "application/llsd+xml")
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_HostCapsObj.WaitForActivation())
|
if (!m_HostCapsObj.WaitForActivation())
|
||||||
return string.Empty;
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.ServiceUnavailable;
|
||||||
|
httpResponse.AddHeader("Retry-After", "30");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_Scene.CheckClient(agentID, httpRequest.RemoteIPEndPoint))
|
if (!m_Scene.CheckClient(agentID, httpRequest.RemoteIPEndPoint))
|
||||||
{
|
{
|
||||||
m_log.WarnFormat(
|
m_log.WarnFormat(
|
||||||
"[CAPS]: Unauthorized CAPS client {0} from {1}",
|
"[CAPS]: Unauthorized CAPS client {0} from {1}",
|
||||||
agentID, httpRequest.RemoteIPEndPoint);
|
agentID, httpRequest.RemoteIPEndPoint);
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||||
return string.Empty;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSDArray capsRequested = (OSDArray)OSDParser.DeserializeLLSDXml(request);
|
OSDArray capsRequested;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
capsRequested = (OSDArray)OSDParser.DeserializeLLSDXml(httpRequest.InputStream);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<string> validCaps = new List<string>();
|
List<string> validCaps = new List<string>();
|
||||||
|
|
||||||
foreach (OSD c in capsRequested)
|
foreach (OSD c in capsRequested)
|
||||||
{
|
{
|
||||||
string cstr = c.AsString();
|
string cstr = c.AsString();
|
||||||
if(cstr == "ObjectAnimation")
|
if (cstr.Equals("ObjectAnimation"))
|
||||||
m_HostCapsObj.Flags |= Caps.CapsFlags.ObjectAnim;
|
m_HostCapsObj.Flags |= Caps.CapsFlags.ObjectAnim;
|
||||||
|
else if (cstr.Equals("ExtEnvironment"))
|
||||||
|
m_HostCapsObj.Flags |= Caps.CapsFlags.AdvEnv;
|
||||||
validCaps.Add(cstr);
|
validCaps.Add(cstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
string result = LLSDHelpers.SerialiseLLSDReply(m_HostCapsObj.GetCapsDetails(true, validCaps));
|
string result = LLSDHelpers.SerialiseLLSDReply(m_HostCapsObj.GetCapsDetails(true, validCaps));
|
||||||
|
httpResponse.RawBuffer = Encoding.UTF8.GetBytes(result);
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||||
//m_log.DebugFormat("[CAPS] CapsRequest {0}", result);
|
//m_log.DebugFormat("[CAPS] CapsRequest {0}", result);
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue