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

@@ -689,7 +689,7 @@ namespace OpenSim.Framework.Servers.HttpServer
if (buffer != null)
{
if (!response.SendChunked)
if (!response.SendChunked && response.ContentLength64 <= 0)
response.ContentLength64 = buffer.LongLength;
response.OutputStream.Write(buffer, 0, buffer.Length);

View File

@@ -0,0 +1,60 @@
/*
* 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.IO;
namespace OpenSim.Framework.Servers.HttpServer
{
/// <summary>
/// Base handler for writing to an output stream
/// </summary>
/// <remarks>
/// Inheriting classes should override ProcessRequest() rather than Handle()
/// </remarks>
public abstract class BaseOutputStreamHandler : BaseRequestHandler, IRequestHandler
{
protected BaseOutputStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {}
protected BaseOutputStreamHandler(string httpMethod, string path, string name, string description)
: base(httpMethod, path, name, description) {}
public virtual void Handle(
string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
RequestsReceived++;
ProcessRequest(path, request, response, httpRequest, httpResponse);
RequestsHandled++;
}
protected virtual void ProcessRequest(
string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
}
}
}

View File

@@ -31,6 +31,10 @@ namespace OpenSim.Framework.Servers.HttpServer
{
public abstract class BaseRequestHandler
{
public int RequestsReceived { get; protected set; }
public int RequestsHandled { get; protected set; }
public virtual string ContentType
{
get { return "application/xml"; }

View File

@@ -29,14 +29,35 @@ using System.IO;
namespace OpenSim.Framework.Servers.HttpServer
{
/// <summary>
/// Base streamed request handler.
/// </summary>
/// <remarks>
/// Inheriting classes should override ProcessRequest() rather than Handle()
/// </remarks>
public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler
{
public abstract byte[] Handle(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {}
protected BaseStreamHandler(string httpMethod, string path, string name, string description)
: base(httpMethod, path, name, description) {}
public virtual byte[] Handle(
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
RequestsReceived++;
byte[] result = ProcessRequest(path, request, httpRequest, httpResponse);
RequestsHandled++;
return result;
}
protected virtual byte[] ProcessRequest(
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
return null;
}
}
}

View File

@@ -45,7 +45,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_method = binaryMethod;
}
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
byte[] data = ReadFully(request);
string param = GetParam(path);

View File

@@ -32,7 +32,6 @@ namespace OpenSim.Framework.Servers.HttpServer
{
public interface IRequestHandler
{
/// <summary>
/// Name for this handler.
/// </summary>
@@ -59,6 +58,19 @@ namespace OpenSim.Framework.Servers.HttpServer
// Return path
string Path { get; }
/// <summary>
/// Number of requests received by this handler
/// </summary>
int RequestsReceived { get; }
/// <summary>
/// Number of requests handled.
/// </summary>
/// <remarks>
/// Should be equal to RequestsReceived unless requested are being handled slowly or there is deadlock.
/// </remarks>
int RequestsHandled { get; }
}
public interface IStreamedRequestHandler : IRequestHandler
@@ -69,7 +81,6 @@ namespace OpenSim.Framework.Servers.HttpServer
public interface IStreamHandler : IRequestHandler
{
// Handle request stream, return byte array
void Handle(string path, Stream request, Stream response, IOSHttpRequest httpReqbuest, IOSHttpResponse httpResponse);
}

View File

@@ -33,7 +33,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
public delegate TResponse RestDeserialiseMethod<TRequest, TResponse>(TRequest request);
public class RestDeserialiseHandler<TRequest, TResponse> : BaseRequestHandler, IStreamHandler
public class RestDeserialiseHandler<TRequest, TResponse> : BaseOutputStreamHandler, IStreamHandler
where TRequest : new()
{
private RestDeserialiseMethod<TRequest, TResponse> m_method;
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_method = method;
}
public void Handle(string path, Stream request, Stream responseStream,
protected override void ProcessRequest(string path, Stream request, Stream responseStream,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
TRequest deserial;

View File

@@ -183,7 +183,7 @@ namespace OpenSim.Framework.Servers.HttpServer
public delegate bool CheckIdentityMethod(string sid, string aid);
public class RestDeserialiseSecureHandler<TRequest, TResponse> : BaseRequestHandler, IStreamHandler
public class RestDeserialiseSecureHandler<TRequest, TResponse> : BaseOutputStreamHandler, IStreamHandler
where TRequest : new()
{
private static readonly ILog m_log
@@ -201,7 +201,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_method = method;
}
public void Handle(string path, Stream request, Stream responseStream,
protected override void ProcessRequest(string path, Stream request, Stream responseStream,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
RestSessionObject<TRequest> deserial = default(RestSessionObject<TRequest>);
@@ -237,7 +237,7 @@ namespace OpenSim.Framework.Servers.HttpServer
public delegate bool CheckTrustedSourceMethod(IPEndPoint peer);
public class RestDeserialiseTrustedHandler<TRequest, TResponse> : BaseRequestHandler, IStreamHandler
public class RestDeserialiseTrustedHandler<TRequest, TResponse> : BaseOutputStreamHandler, IStreamHandler
where TRequest : new()
{
private static readonly ILog m_log
@@ -260,7 +260,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_method = method;
}
public void Handle(string path, Stream request, Stream responseStream,
protected override void ProcessRequest(string path, Stream request, Stream responseStream,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
TRequest deserial = default(TRequest);
@@ -292,6 +292,5 @@ namespace OpenSim.Framework.Servers.HttpServer
serializer.Serialize(xmlWriter, response);
}
}
}
}
}
}

View File

@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_restMethod = restMethod;
}
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
Encoding encoding = Encoding.UTF8;
StreamReader streamReader = new StreamReader(request, encoding);