Merge branch 'master' into careminster

Conflicts:
	OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
	OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
	OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
	OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
	OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
	OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
	OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
	OpenSim/Region/Framework/Scenes/Scene.cs
	OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
	OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
	OpenSim/Region/Framework/Scenes/ScenePresence.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
	OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
	OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
	OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
	OpenSim/Services/HypergridService/UserAgentService.cs
This commit is contained in:
Melanie
2013-07-18 10:08:10 +01:00
134 changed files with 2941 additions and 1318 deletions

View File

@@ -70,7 +70,7 @@ namespace OpenSim.Server.Handlers.Asset
m_allowedTypes = allowedTypes;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
bool result = false;

View File

@@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Asset
m_AssetService = service;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
byte[] result = new byte[0];

View File

@@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Asset
m_AssetService = service;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
AssetBase asset;

View File

@@ -70,7 +70,7 @@ namespace OpenSim.Server.Handlers.Authentication
}
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
string[] p = SplitParams(path);

View File

@@ -147,7 +147,7 @@ namespace OpenSim.Server.Handlers.Authentication
#endregion
}
public class OpenIdStreamHandler : IStreamHandler
public class OpenIdStreamHandler : BaseOutputStreamHandler
{
#region HTML
@@ -191,42 +191,34 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
#endregion HTML
public string Name { get { return "OpenId"; } }
public string Description { get { return null; } }
public string ContentType { get { return m_contentType; } }
public string HttpMethod { get { return m_httpMethod; } }
public string Path { get { return m_path; } }
string m_contentType;
string m_httpMethod;
string m_path;
IAuthenticationService m_authenticationService;
IUserAccountService m_userAccountService;
ProviderMemoryStore m_openidStore = new ProviderMemoryStore();
public override string ContentType { get { return "text/html"; } }
/// <summary>
/// Constructor
/// </summary>
public OpenIdStreamHandler(string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService)
public OpenIdStreamHandler(
string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService)
: base(httpMethod, path, "OpenId", "OpenID stream handler")
{
m_authenticationService = authService;
m_userAccountService = userService;
m_httpMethod = httpMethod;
m_path = path;
m_contentType = "text/html";
}
/// <summary>
/// Handles all GET and POST requests for OpenID identifier pages and endpoint
/// server communication
/// </summary>
public void Handle(string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
protected override void ProcessRequest(
string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath));
// Defult to returning HTML content
m_contentType = "text/html";
httpResponse.ContentType = ContentType;
try
{
@@ -276,7 +268,7 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type");
if (contentTypeValues != null && contentTypeValues.Length == 1)
m_contentType = contentTypeValues[0];
httpResponse.ContentType = contentTypeValues[0];
// Set the response code and document body based on the OpenID result
httpResponse.StatusCode = (int)provider.Request.Response.Code;
@@ -344,4 +336,4 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
return false;
}
}
}
}

View File

@@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Authorization
m_AuthorizationService = service;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest));

View File

@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Avatar
m_AvatarService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Friends
m_FriendsService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Grid
m_GridService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.GridUser
m_GridUserService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@@ -68,7 +68,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
m_log.ErrorFormat("[HGFRIENDS HANDLER]: TheService is null!");
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@@ -91,7 +91,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
m_HandlersType = handlersType;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
return OKResponse(httpResponse);

View File

@@ -68,6 +68,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
{
return new ExtendedAgentDestinationData();
}
protected override void UnpackData(OSDMap args, AgentDestinationData d, Hashtable request)
{
base.UnpackData(args, d, request);

View File

@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Inventory
m_InventoryService = service;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
XmlSerializer xs = new XmlSerializer(typeof (List<InventoryItemBase>));

View File

@@ -87,7 +87,7 @@ namespace OpenSim.Server.Handlers.Asset
m_InventoryService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@@ -99,7 +99,7 @@ namespace OpenSim.Server.Handlers.MapImage
m_Proxy = proxy;
}
public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
StreamReader sr = new StreamReader(requestData);

View File

@@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.MapImage
m_MapService = service;
}
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
ev.WaitOne();
lock (ev)

View File

@@ -58,7 +58,7 @@ namespace OpenSim.Server.Handlers.Neighbour
// TODO: unused: m_AuthenticationService = authentication;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Not implemented yet
@@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.Neighbour
// TODO: unused: m_AllowForeignGuests = foreignGuests;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
byte[] result = new byte[0];
@@ -176,7 +176,7 @@ namespace OpenSim.Server.Handlers.Neighbour
// TODO: unused: m_AuthenticationService = authentication;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Not implemented yet
@@ -197,7 +197,7 @@ namespace OpenSim.Server.Handlers.Neighbour
// TODO: unused: m_AuthenticationService = authentication;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Not implemented yet

View File

@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Presence
m_PresenceService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@@ -27,11 +27,13 @@
using System;
using System.Collections;
using System.Collections.Specialized;
using System.IO;
using System.IO.Compression;
using System.Reflection;
using System.Net;
using System.Text;
using System.Web;
using OpenSim.Server.Base;
using OpenSim.Server.Handlers.Base;
@@ -90,19 +92,13 @@ namespace OpenSim.Server.Handlers.Simulation
// Next, let's parse the verb
string method = (string)request["http-method"];
if (method.Equals("GET"))
if (method.Equals("DELETE"))
{
DoAgentGet(request, responsedata, agentID, regionID);
return responsedata;
}
else if (method.Equals("DELETE"))
{
DoAgentDelete(request, responsedata, agentID, action, regionID);
return responsedata;
}
else if (method.Equals("DELETECHILD"))
{
DoChildAgentDelete(request, responsedata, agentID, action, regionID);
string auth_token = string.Empty;
if (request.ContainsKey("auth"))
auth_token = request["auth"].ToString();
DoAgentDelete(request, responsedata, agentID, action, regionID, auth_token);
return responsedata;
}
else if (method.Equals("QUERYACCESS"))
@@ -112,7 +108,7 @@ namespace OpenSim.Server.Handlers.Simulation
}
else
{
m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method);
m_log.ErrorFormat("[AGENT HANDLER]: method {0} not supported in agent message {1} (caller is {2})", method, (string)request["uri"], Util.GetCallerIP(request));
responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed;
responsedata["str_response_string"] = "Method not allowed";
@@ -161,61 +157,12 @@ namespace OpenSim.Server.Handlers.Simulation
// Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]);
}
protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID, string auth_token)
{
if (m_SimulationService == null)
{
m_log.Debug("[AGENT HANDLER]: Agent GET called. Harmless but useless.");
responsedata["content_type"] = "application/json";
responsedata["int_response_code"] = HttpStatusCode.NotImplemented;
responsedata["str_response_string"] = string.Empty;
return;
}
GridRegion destination = new GridRegion();
destination.RegionID = regionID;
IAgentData agent = null;
bool result = m_SimulationService.RetrieveAgent(destination, id, out agent);
OSDMap map = null;
if (result)
{
if (agent != null) // just to make sure
{
map = agent.Pack();
string strBuffer = "";
try
{
strBuffer = OSDParser.SerializeJsonString(map);
}
catch (Exception e)
{
m_log.WarnFormat("[AGENT HANDLER]: Exception thrown on serialization of DoAgentGet: {0}", e.Message);
responsedata["int_response_code"] = HttpStatusCode.InternalServerError;
// ignore. buffer will be empty, caller should check.
}
responsedata["content_type"] = "application/json";
responsedata["int_response_code"] = HttpStatusCode.OK;
responsedata["str_response_string"] = strBuffer;
}
else
{
responsedata["int_response_code"] = HttpStatusCode.InternalServerError;
responsedata["str_response_string"] = "Internal error";
}
}
if (string.IsNullOrEmpty(action))
m_log.DebugFormat("[AGENT HANDLER]: >>> DELETE <<< RegionID: {0}; from: {1}; auth_code: {2}", regionID, Util.GetCallerIP(request), auth_token);
else
{
responsedata["int_response_code"] = HttpStatusCode.NotFound;
responsedata["str_response_string"] = "Not Found";
}
}
protected void DoChildAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID)
{
m_log.Debug(" >>> DoChildAgentDelete action:" + action + "; RegionID:" + regionID);
m_log.DebugFormat("[AGENT HANDLER]: Release {0} to RegionID: {1}", id, regionID);
GridRegion destination = new GridRegion();
destination.RegionID = regionID;
@@ -223,30 +170,12 @@ namespace OpenSim.Server.Handlers.Simulation
if (action.Equals("release"))
ReleaseAgent(regionID, id);
else
m_SimulationService.CloseChildAgent(destination, id);
Util.FireAndForget(delegate { m_SimulationService.CloseAgent(destination, id, auth_token); });
responsedata["int_response_code"] = HttpStatusCode.OK;
responsedata["str_response_string"] = "OpenSim agent " + id.ToString();
m_log.Debug("[AGENT HANDLER]: Child Agent Released/Deleted.");
}
protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID)
{
m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID);
GridRegion destination = new GridRegion();
destination.RegionID = regionID;
if (action.Equals("release"))
ReleaseAgent(regionID, id);
else
Util.FireAndForget(delegate { m_SimulationService.CloseAgent(destination, id); });
responsedata["int_response_code"] = HttpStatusCode.OK;
responsedata["str_response_string"] = "OpenSim agent " + id.ToString();
m_log.DebugFormat("[AGENT HANDLER]: Agent {0} Released/Deleted from region {1}", id, regionID);
//m_log.DebugFormat("[AGENT HANDLER]: Agent {0} Released/Deleted from region {1}", id, regionID);
}
protected virtual void ReleaseAgent(UUID regionID, UUID id)
@@ -274,7 +203,7 @@ namespace OpenSim.Server.Handlers.Simulation
m_SimulationService = null;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[SIMULATION]: Stream handler called");
@@ -488,7 +417,7 @@ namespace OpenSim.Server.Handlers.Simulation
m_SimulationService = null;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[SIMULATION]: Stream handler called");

View File

@@ -68,7 +68,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
}
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);