Merge branch 'master' of /home/opensim/var/repo/opensim
commit
6ec59ee892
|
@ -149,6 +149,11 @@
|
|||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.capabilities.handlers.tests">
|
||||
<arg value="./bin/OpenSim.Capabilities.Handlers.Tests.dll" />
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
|
||||
|
||||
<delete dir="%temp%"/>
|
||||
|
||||
</target>
|
||||
|
@ -338,6 +343,11 @@
|
|||
<arg value="-xml=test-results/OpenSim.Data.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.capabilities.handlers.tests">
|
||||
<arg value="./bin/OpenSim.Capabilities.Handlers.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Capabilities.Handlers.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
|
||||
|
@ -347,6 +357,7 @@
|
|||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.optionalmodules.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
|
||||
|
||||
</target>
|
||||
<!-- <exec program="nunit-console.exe" failonerror="false" resultproperty="testresult.acceptancetestassembly"> -->
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
{
|
||||
#region GET methods
|
||||
public string GetHandler(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// foreach (string h in httpRequest.Headers.AllKeys)
|
||||
// foreach (string v in httpRequest.Headers.GetValues(h))
|
||||
|
@ -64,7 +64,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
}
|
||||
}
|
||||
|
||||
public string GetHandlerRegions(OSHttpResponse httpResponse)
|
||||
public string GetHandlerRegions(IOSHttpResponse httpResponse)
|
||||
{
|
||||
RestXmlWriter rxw = new RestXmlWriter(new StringWriter());
|
||||
|
||||
|
@ -95,7 +95,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
return rxw.ToString();
|
||||
}
|
||||
|
||||
public string GetHandlerRegion(OSHttpResponse httpResponse, string param)
|
||||
public string GetHandlerRegion(IOSHttpResponse httpResponse, string param)
|
||||
{
|
||||
// be resilient and don't get confused by a terminating '/'
|
||||
param = param.TrimEnd(new char[]{'/'});
|
||||
|
@ -180,7 +180,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
}
|
||||
#endregion GET methods
|
||||
|
||||
protected string RegionTerrain(OSHttpResponse httpResponse, Scene scene)
|
||||
protected string RegionTerrain(IOSHttpResponse httpResponse, Scene scene)
|
||||
{
|
||||
httpResponse.SendChunked = true;
|
||||
httpResponse.ContentType = "text/xml";
|
||||
|
@ -190,7 +190,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
// "GET", "terrain not implemented");
|
||||
}
|
||||
|
||||
protected string RegionStats(OSHttpResponse httpResponse, Scene scene)
|
||||
protected string RegionStats(IOSHttpResponse httpResponse, Scene scene)
|
||||
{
|
||||
int users = scene.GetRootAgentCount();
|
||||
int objects = scene.Entities.Count - users;
|
||||
|
@ -213,7 +213,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
return rxw.ToString();
|
||||
}
|
||||
|
||||
protected string RegionPrims(OSHttpResponse httpResponse, Scene scene, Vector3 min, Vector3 max)
|
||||
protected string RegionPrims(IOSHttpResponse httpResponse, Scene scene, Vector3 min, Vector3 max)
|
||||
{
|
||||
httpResponse.SendChunked = true;
|
||||
httpResponse.ContentType = "text/xml";
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
{
|
||||
#region GET methods
|
||||
public string GetRegionInfoHandler(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// foreach (string h in httpRequest.Headers.AllKeys)
|
||||
// foreach (string v in httpRequest.Headers.GetValues(h))
|
||||
|
@ -64,7 +64,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
}
|
||||
}
|
||||
|
||||
public string GetRegionInfoHandlerRegions(OSHttpResponse httpResponse)
|
||||
public string GetRegionInfoHandlerRegions(IOSHttpResponse httpResponse)
|
||||
{
|
||||
RestXmlWriter rxw = new RestXmlWriter(new StringWriter());
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
#region POST methods
|
||||
|
||||
public string PostHandler(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// foreach (string h in httpRequest.Headers.AllKeys)
|
||||
// foreach (string v in httpRequest.Headers.GetValues(h))
|
||||
|
@ -92,7 +92,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
}
|
||||
}
|
||||
|
||||
public string CreateRegion(OSHttpRequest request, OSHttpResponse response)
|
||||
public string CreateRegion(IOSHttpRequest request, IOSHttpResponse response)
|
||||
{
|
||||
RestXmlWriter rxw = new RestXmlWriter(new StringWriter());
|
||||
|
||||
|
@ -108,7 +108,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
return rxw.ToString();
|
||||
}
|
||||
|
||||
public string LoadPrims(string requestBody, OSHttpRequest request, OSHttpResponse response, Scene scene)
|
||||
public string LoadPrims(string requestBody, IOSHttpRequest request, IOSHttpResponse response, Scene scene)
|
||||
{
|
||||
IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>();
|
||||
if (serialiser != null)
|
||||
|
|
|
@ -328,7 +328,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
|||
/// </summary>
|
||||
/// <param name="request">HTTP request header</param>
|
||||
/// <returns>true when the HTTP request came from god.</returns>
|
||||
protected bool IsGod(OSHttpRequest request)
|
||||
protected bool IsGod(IOSHttpRequest request)
|
||||
{
|
||||
string[] keys = request.Headers.GetValues("X-OpenSim-Godkey");
|
||||
if (null == keys) return false;
|
||||
|
@ -342,7 +342,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
|||
/// HTTP header is indeed the password on file for the avatar
|
||||
/// specified by the UUID
|
||||
/// </summary>
|
||||
protected bool IsVerifiedUser(OSHttpRequest request, UUID uuid)
|
||||
protected bool IsVerifiedUser(IOSHttpRequest request, UUID uuid)
|
||||
{
|
||||
// XXX under construction
|
||||
return false;
|
||||
|
@ -377,7 +377,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
|||
/// <param name="message">failure message</param>
|
||||
/// <remarks>This should probably set a return code as
|
||||
/// well. (?)</remarks>
|
||||
protected string Failure(OSHttpResponse response, OSHttpStatusCode status,
|
||||
protected string Failure(IOSHttpResponse response, OSHttpStatusCode status,
|
||||
string method, string format, params string[] msg)
|
||||
{
|
||||
string m = String.Format(format, msg);
|
||||
|
@ -396,7 +396,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
|||
/// <param name="e">exception causing the failure message</param>
|
||||
/// <remarks>This should probably set a return code as
|
||||
/// well. (?)</remarks>
|
||||
public string Failure(OSHttpResponse response, OSHttpStatusCode status,
|
||||
public string Failure(IOSHttpResponse response, OSHttpStatusCode status,
|
||||
string method, Exception e)
|
||||
{
|
||||
string m = String.Format("exception occurred: {0}", e.Message);
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
m_assetService = assService;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
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);
|
||||
|
@ -127,7 +127,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
/// <param name="textureID"></param>
|
||||
/// <param name="format"></param>
|
||||
/// <returns>False for "caller try another codec"; true otherwise</returns>
|
||||
private bool FetchTexture(OSHttpRequest httpRequest, OSHttpResponse httpResponse, UUID textureID, string format)
|
||||
private bool FetchTexture(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID textureID, string format)
|
||||
{
|
||||
// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
|
||||
AssetBase texture;
|
||||
|
@ -211,7 +211,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
return true;
|
||||
}
|
||||
|
||||
private void WriteTextureData(OSHttpRequest request, OSHttpResponse response, AssetBase texture, string format)
|
||||
private void WriteTextureData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture, string format)
|
||||
{
|
||||
string range = request.Headers.GetOne("Range");
|
||||
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* 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.Net;
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Capabilities.Handlers;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers.GetTexture.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class GetTextureHandlerTests
|
||||
{
|
||||
[Test]
|
||||
public void TestTextureNotFound()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Overkill - we only really need the asset service, not a whole scene.
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
|
||||
GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService);
|
||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||
req.Url = new Uri("http://localhost/?texture_id=00000000-0000-1111-9999-000000000012");
|
||||
handler.Handle(null, null, req, resp);
|
||||
Assert.That(resp.StatusCode, Is.EqualTo((int)System.Net.HttpStatusCode.NotFound));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -73,12 +73,10 @@ namespace OpenSim.Capabilities.Handlers
|
|||
/// <param name="httpResponse"></param>
|
||||
/// <returns>The upload response if the request is successful, null otherwise.</returns>
|
||||
public string UploadBakedTexture(
|
||||
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
// m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + m_regionName);
|
||||
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
|
||||
|
@ -106,7 +104,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[UPLOAD BAKED TEXTURE HANDLER]: " + e.ToString());
|
||||
m_log.Error("[CAPS]: " + e.ToString());
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -132,8 +130,6 @@ namespace OpenSim.Capabilities.Handlers
|
|||
|
||||
class BakedTextureUploader
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public event Action<UUID, byte[]> OnUpLoad;
|
||||
|
||||
private string uploaderPath = String.Empty;
|
||||
|
@ -158,12 +154,10 @@ namespace OpenSim.Capabilities.Handlers
|
|||
public string uploaderCaps(byte[] data, string path, string param)
|
||||
{
|
||||
Action<UUID, byte[]> handlerUpLoad = OnUpLoad;
|
||||
|
||||
// Don't do this asynchronously, otherwise it's possible for the client to send set appearance information
|
||||
// on another thread which might send out avatar updates before the asset has been put into the asset
|
||||
// service.
|
||||
if (handlerUpLoad != null)
|
||||
handlerUpLoad(newAssetID, data);
|
||||
{
|
||||
Util.FireAndForget(delegate(object o) { handlerUpLoad(newAssetID, data); });
|
||||
}
|
||||
|
||||
string res = String.Empty;
|
||||
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
|
||||
|
@ -175,7 +169,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
|
||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||
|
||||
// m_log.DebugFormat("[BAKED TEXTURE UPLOADER]: baked texture upload completed for {0}", newAssetID);
|
||||
// m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
m_LibraryService = libService;
|
||||
}
|
||||
|
||||
public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// lock (m_fetchLock)
|
||||
// {
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
//Encoding encoding = Util.UTF8;
|
||||
//StreamReader streamReader = new StreamReader(request, false);
|
||||
|
|
|
@ -600,7 +600,7 @@ namespace OpenSim.Framework.Servers
|
|||
|
||||
}
|
||||
|
||||
public string StatReport(OSHttpRequest httpRequest)
|
||||
public string StatReport(IOSHttpRequest httpRequest)
|
||||
{
|
||||
// If we catch a request for "callback", wrap the response in the value for jsonp
|
||||
if (httpRequest.Query.ContainsKey("callback"))
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler
|
||||
{
|
||||
public abstract byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse);
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
|
||||
|
||||
protected BaseStreamHandler(string httpMethod, string path) : base(httpMethod, path)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
private BinaryMethod m_method;
|
||||
|
||||
public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
byte[] data = ReadFully(request);
|
||||
string param = GetParam(path);
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public interface IOSHttpRequest
|
||||
{
|
||||
string[] AcceptTypes { get; }
|
||||
Encoding ContentEncoding { get; }
|
||||
long ContentLength { get; }
|
||||
long ContentLength64 { get; }
|
||||
string ContentType { get; }
|
||||
HttpCookieCollection Cookies { get; }
|
||||
bool HasEntityBody { get; }
|
||||
NameValueCollection Headers { get; }
|
||||
string HttpMethod { get; }
|
||||
Stream InputStream { get; }
|
||||
bool IsSecured { get; }
|
||||
bool KeepAlive { get; }
|
||||
NameValueCollection QueryString { get; }
|
||||
Hashtable Query { get; }
|
||||
string RawUrl { get; }
|
||||
IPEndPoint RemoteIPEndPoint { get; }
|
||||
Uri Url { get; }
|
||||
string UserAgent { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* 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;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public interface IOSHttpResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Content type property.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Setting this property will also set IsContentTypeSet to
|
||||
/// true.
|
||||
/// </remarks>
|
||||
string ContentType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Boolean property indicating whether the content type
|
||||
/// property actively has been set.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// IsContentTypeSet will go away together with .NET base.
|
||||
/// </remarks>
|
||||
// public bool IsContentTypeSet
|
||||
// {
|
||||
// get { return _contentTypeSet; }
|
||||
// }
|
||||
// private bool _contentTypeSet;
|
||||
|
||||
/// <summary>
|
||||
/// Length of the body content; 0 if there is no body.
|
||||
/// </summary>
|
||||
long ContentLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alias for ContentLength.
|
||||
/// </summary>
|
||||
long ContentLength64 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Encoding of the body content.
|
||||
/// </summary>
|
||||
Encoding ContentEncoding { get; set; }
|
||||
|
||||
bool KeepAlive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get or set the keep alive timeout property (default is
|
||||
/// 20). Setting this to 0 also disables KeepAlive. Setting
|
||||
/// this to something else but 0 also enable KeepAlive.
|
||||
/// </summary>
|
||||
int KeepAliveTimeout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return the output stream feeding the body.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// On its way out...
|
||||
/// </remarks>
|
||||
Stream OutputStream { get; }
|
||||
|
||||
string ProtocolVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return the output stream feeding the body.
|
||||
/// </summary>
|
||||
Stream Body { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Set a redirct location.
|
||||
/// </summary>
|
||||
string RedirectLocation { set; }
|
||||
|
||||
/// <summary>
|
||||
/// Chunk transfers.
|
||||
/// </summary>
|
||||
bool SendChunked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code.
|
||||
/// </summary>
|
||||
int StatusCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status description.
|
||||
/// </summary>
|
||||
string StatusDescription { get; set; }
|
||||
|
||||
bool ReuseContext { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Add a header field and content to the response.
|
||||
/// </summary>
|
||||
/// <param name="key">string containing the header field
|
||||
/// name</param>
|
||||
/// <param name="value">string containing the header field
|
||||
/// value</param>
|
||||
void AddHeader(string key, string value);
|
||||
|
||||
/// <summary>
|
||||
/// Send the response back to the remote client
|
||||
/// </summary>
|
||||
void Send();
|
||||
}
|
||||
}
|
||||
|
|
@ -45,13 +45,13 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
public interface IStreamedRequestHandler : IRequestHandler
|
||||
{
|
||||
// Handle request stream, return byte array
|
||||
byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse);
|
||||
byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
|
||||
}
|
||||
|
||||
public interface IStreamHandler : IRequestHandler
|
||||
{
|
||||
// Handle request stream, return byte array
|
||||
void Handle(string path, Stream request, Stream response, OSHttpRequest httpReqbuest, OSHttpResponse httpResponse);
|
||||
void Handle(string path, Stream request, Stream response, IOSHttpRequest httpReqbuest, IOSHttpResponse httpResponse);
|
||||
}
|
||||
|
||||
public interface IGenericHTTPHandler : IRequestHandler
|
||||
|
|
|
@ -39,7 +39,7 @@ using log4net;
|
|||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public class OSHttpRequest
|
||||
public class OSHttpRequest : IOSHttpRequest
|
||||
{
|
||||
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
@ -174,7 +174,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
private Dictionary<string, object> _whiteboard = new Dictionary<string, object>();
|
||||
|
||||
|
||||
public OSHttpRequest() {}
|
||||
|
||||
public OSHttpRequest(IHttpClientContext context, IHttpRequest req)
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// OSHttpResponse is the OpenSim representation of an HTTP
|
||||
/// response.
|
||||
/// </summary>
|
||||
public class OSHttpResponse
|
||||
public class OSHttpResponse : IOSHttpResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Content type property.
|
||||
|
@ -275,7 +275,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected IHttpResponse _httpResponse;
|
||||
private IHttpClientContext _httpClientContext;
|
||||
|
||||
|
@ -331,4 +330,4 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
|
||||
public void Handle(string path, Stream request, Stream responseStream,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
TRequest deserial;
|
||||
using (XmlTextReader xmlReader = new XmlTextReader(request))
|
||||
|
|
|
@ -28,5 +28,5 @@
|
|||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public delegate string RestMethod(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse);
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
|
||||
public void Handle(string path, Stream request, Stream responseStream,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
RestSessionObject<TRequest> deserial = default(RestSessionObject<TRequest>);
|
||||
bool fail = false;
|
||||
|
@ -270,7 +270,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
|
||||
public void Handle(string path, Stream request, Stream responseStream,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
TRequest deserial = default(TRequest);
|
||||
bool fail = false;
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
get { return m_restMethod; }
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
Encoding encoding = Encoding.UTF8;
|
||||
StreamReader streamReader = new StreamReader(request, encoding);
|
||||
|
|
|
@ -718,7 +718,7 @@ namespace OpenSim
|
|||
public class SimStatusHandler : IStreamedRequestHandler
|
||||
{
|
||||
public byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return Util.UTF8.GetBytes("OK");
|
||||
}
|
||||
|
@ -755,7 +755,7 @@ namespace OpenSim
|
|||
}
|
||||
|
||||
public byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||
}
|
||||
|
@ -796,7 +796,7 @@ namespace OpenSim
|
|||
}
|
||||
|
||||
public byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
/// <param name="httpResponse">HTTP response header object</param>
|
||||
/// <returns></returns>
|
||||
public string SeedCapRequest(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName);
|
||||
|
||||
|
@ -256,7 +256,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
/// <param name="httpResponse">HTTP response header object</param>
|
||||
/// <returns></returns>
|
||||
public string ScriptTaskInventory(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -685,7 +685,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public string NoteCardAgentInventory(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
//m_log.Debug("[CAPS]: NoteCardAgentInventory Request in region: " + m_regionName + "\n" + request);
|
||||
//m_log.Debug("[CAPS]: NoteCardAgentInventory Request is: " + request);
|
||||
|
|
|
@ -104,7 +104,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
"UploadBakedTexture",
|
||||
new RestStreamHandler(
|
||||
"POST",
|
||||
"/CAPS/" + m_uploadBakedTexturePath,
|
||||
"/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath,
|
||||
new UploadBakedTextureHandler(
|
||||
caps, m_scene.AssetService, m_persistBakedTextures).UploadBakedTexture));
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
m_FriendsModule = fmodule;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
public override byte[] Handle(
|
||||
string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
|
|
|
@ -1421,7 +1421,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
caps.RegisterHandler("RemoteParcelRequest",
|
||||
new RestStreamHandler("POST", capsBase + remoteParcelRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return RemoteParcelRequest(request, path, param, agentID, caps);
|
||||
}));
|
||||
|
@ -1429,7 +1429,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
caps.RegisterHandler("ParcelPropertiesUpdate",
|
||||
new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ProcessPropertiesUpdate(request, path, param, agentID, caps);
|
||||
}));
|
||||
|
|
|
@ -293,7 +293,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
|
|||
/// <param name="httpResponse"></param>
|
||||
/// <returns></returns>
|
||||
protected string HandleObjectMediaMessage(
|
||||
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request);
|
||||
|
||||
|
@ -474,7 +474,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
|
|||
/// <param name="httpResponse">/param>
|
||||
/// <returns></returns>
|
||||
protected string HandleObjectMediaNavigateMessage(
|
||||
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request);
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
caps.RegisterHandler("MapLayer",
|
||||
new RestStreamHandler("POST", capsBase + m_mapLayerPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return MapLayerRequest(request, path, param,
|
||||
agentID, caps);
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace OpenSim.Region.DataSnapshot
|
|||
}
|
||||
|
||||
public string OnDiscoveryAttempt(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
//Very static for now, flexible enough to add new formats
|
||||
LLSDDiscoveryResponse llsd_response = new LLSDDiscoveryResponse();
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
osXStatsURI = Util.SHA1Hash(regionInfo.osSecret);
|
||||
}
|
||||
|
||||
public byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
public byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return Util.UTF8.GetBytes(Report());
|
||||
}
|
||||
|
|
|
@ -48,10 +48,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
|
|||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AppearanceInfoModule")]
|
||||
public class AppearanceInfoModule : ISharedRegionModule
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||
protected IAvatarFactoryModule m_avatarFactory;
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public const string SHOW_APPEARANCE_FORMAT = "{0,-9} {1}";
|
||||
|
||||
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||
private IAvatarFactoryModule m_avatarFactory;
|
||||
|
||||
public string Name { get { return "Appearance Information Module"; } }
|
||||
|
||||
|
@ -90,46 +92,154 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
|
|||
// m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
|
||||
|
||||
lock (m_scenes)
|
||||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||
|
||||
scene.AddCommand(
|
||||
this, "show appearance",
|
||||
"show appearance [<first-name> <last-name>]",
|
||||
"Synonym for 'appearance show'",
|
||||
HandleShowAppearanceCommand);
|
||||
|
||||
scene.AddCommand(
|
||||
this, "appearance show",
|
||||
"appearance show",
|
||||
"appearance show [<first-name> <last-name>]",
|
||||
"Show appearance information for each avatar in the simulator.",
|
||||
"At the moment this actually just checks that we have all the required baked textures. If not, then appearance is 'corrupt' and other avatars will continue to see a cloud.",
|
||||
ShowAppearanceInfo);
|
||||
"This command checks whether the simulator has all the baked textures required to display an avatar to other viewers. "
|
||||
+ "\nIf not, then appearance is 'corrupt' and other avatars will continue to see it as a cloud."
|
||||
+ "\nOptionally, you can view just a particular avatar's appearance information."
|
||||
+ "\nIn this case, the texture UUID for each bake type is also shown and whether the simulator can find the referenced texture.",
|
||||
HandleShowAppearanceCommand);
|
||||
|
||||
scene.AddCommand(
|
||||
this, "appearance send",
|
||||
"appearance send",
|
||||
"Send appearance data for each avatar in the simulator to viewers.",
|
||||
SendAppearance);
|
||||
"appearance send [<first-name> <last-name>]",
|
||||
"Send appearance data for each avatar in the simulator to other viewers.",
|
||||
"Optionally, you can specify that only a particular avatar's appearance data is sent.",
|
||||
HandleSendAppearanceCommand);
|
||||
}
|
||||
|
||||
private void SendAppearance(string module, string[] cmd)
|
||||
private void HandleSendAppearanceCommand(string module, string[] cmd)
|
||||
{
|
||||
if (cmd.Length != 2 && cmd.Length < 4)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("Usage: appearance send [<first-name> <last-name>]");
|
||||
return;
|
||||
}
|
||||
|
||||
bool targetNameSupplied = false;
|
||||
string optionalTargetFirstName = null;
|
||||
string optionalTargetLastName = null;
|
||||
|
||||
if (cmd.Length >= 4)
|
||||
{
|
||||
targetNameSupplied = true;
|
||||
optionalTargetFirstName = cmd[2];
|
||||
optionalTargetLastName = cmd[3];
|
||||
}
|
||||
|
||||
lock (m_scenes)
|
||||
{
|
||||
foreach (Scene scene in m_scenes.Values)
|
||||
{
|
||||
scene.ForEachRootScenePresence(sp => scene.AvatarFactory.SendAppearance(sp.UUID));
|
||||
if (targetNameSupplied)
|
||||
{
|
||||
ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName);
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"Sending appearance information for {0} to all other avatars in {1}",
|
||||
sp.Name, scene.RegionInfo.RegionName);
|
||||
|
||||
scene.AvatarFactory.SendAppearance(sp.UUID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
scene.ForEachRootScenePresence(
|
||||
sp =>
|
||||
{
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"Sending appearance information for {0} to all other avatars in {1}",
|
||||
sp.Name, scene.RegionInfo.RegionName);
|
||||
|
||||
scene.AvatarFactory.SendAppearance(sp.UUID);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void ShowAppearanceInfo(string module, string[] cmd)
|
||||
{
|
||||
protected void HandleShowAppearanceCommand(string module, string[] cmd)
|
||||
{
|
||||
if (cmd.Length != 2 && cmd.Length < 4)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("Usage: appearance show [<first-name> <last-name>]");
|
||||
return;
|
||||
}
|
||||
|
||||
bool targetNameSupplied = false;
|
||||
string optionalTargetFirstName = null;
|
||||
string optionalTargetLastName = null;
|
||||
|
||||
if (cmd.Length >= 4)
|
||||
{
|
||||
targetNameSupplied = true;
|
||||
optionalTargetFirstName = cmd[2];
|
||||
optionalTargetLastName = cmd[3];
|
||||
}
|
||||
|
||||
lock (m_scenes)
|
||||
{
|
||||
foreach (Scene scene in m_scenes.Values)
|
||||
{
|
||||
scene.ForEachRootScenePresence(
|
||||
delegate(ScenePresence sp)
|
||||
if (targetNameSupplied)
|
||||
{
|
||||
ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName);
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("For {0} in {1}", sp.Name, scene.RegionInfo.RegionName);
|
||||
MainConsole.Instance.OutputFormat(SHOW_APPEARANCE_FORMAT, "Bake Type", "UUID");
|
||||
|
||||
Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures
|
||||
= scene.AvatarFactory.GetBakedTextureFaces(sp.UUID);
|
||||
foreach (BakeType bt in bakedTextures.Keys)
|
||||
{
|
||||
string rawTextureID;
|
||||
|
||||
if (bakedTextures[bt] == null)
|
||||
{
|
||||
rawTextureID = "not set";
|
||||
}
|
||||
else
|
||||
{
|
||||
rawTextureID = bakedTextures[bt].TextureID.ToString();
|
||||
|
||||
if (scene.AssetService.Get(rawTextureID) == null)
|
||||
rawTextureID += " (not found)";
|
||||
else
|
||||
rawTextureID += " (uploaded)";
|
||||
}
|
||||
|
||||
MainConsole.Instance.OutputFormat(SHOW_APPEARANCE_FORMAT, bt, rawTextureID);
|
||||
}
|
||||
|
||||
bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(sp);
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt");
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
scene.ForEachRootScenePresence(
|
||||
sp =>
|
||||
{
|
||||
bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(sp);
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt");
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -309,7 +309,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
caps.RegisterHandler("ProvisionVoiceAccountRequest",
|
||||
new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ProvisionVoiceAccountRequest(scene, request, path, param,
|
||||
agentID, caps);
|
||||
|
@ -317,7 +317,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
caps.RegisterHandler("ParcelVoiceInfoRequest",
|
||||
new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ParcelVoiceInfoRequest(scene, request, path, param,
|
||||
agentID, caps);
|
||||
|
@ -325,7 +325,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
caps.RegisterHandler("ChatSessionRequest",
|
||||
new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ChatSessionRequest(scene, request, path, param,
|
||||
agentID, caps);
|
||||
|
|
|
@ -421,7 +421,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
|
|||
caps.RegisterHandler("ProvisionVoiceAccountRequest",
|
||||
new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ProvisionVoiceAccountRequest(scene, request, path, param,
|
||||
agentID, caps);
|
||||
|
@ -429,7 +429,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
|
|||
caps.RegisterHandler("ParcelVoiceInfoRequest",
|
||||
new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ParcelVoiceInfoRequest(scene, request, path, param,
|
||||
agentID, caps);
|
||||
|
@ -437,7 +437,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
|
|||
caps.RegisterHandler("ChatSessionRequest",
|
||||
new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ChatSessionRequest(scene, request, path, param,
|
||||
agentID, caps);
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
httpResponse.ContentType = "image/jpeg";
|
||||
|
||||
|
|
|
@ -306,7 +306,7 @@ namespace OpenSim.Region.UserStatistics
|
|||
caps.RegisterHandler("ViewerStats",
|
||||
new RestStreamHandler("POST", capsPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ViewerStatsReport(request, path, param,
|
||||
agentID, caps);
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
byte[] result = new byte[0];
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
|
||||
AssetBase asset = (AssetBase) xs.Deserialize(request);
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
string[] p = SplitParams(path);
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
|
|||
/// Handles all GET and POST requests for OpenID identifier pages and endpoint
|
||||
/// server communication
|
||||
/// </summary>
|
||||
public void Handle(string path, Stream request, Stream response, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
public void Handle(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));
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace OpenSim.Server.Handlers.Authorization
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest));
|
||||
AuthorizationRequest Authorization = (AuthorizationRequest) xs.Deserialize(request);
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Avatar
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace OpenSim.Server.Handlers.Base
|
|||
}
|
||||
}
|
||||
|
||||
public static bool GetAuthentication(OSHttpRequest httpRequest, out string authority, out string authKey)
|
||||
public static bool GetAuthentication(IOSHttpRequest httpRequest, out string authority, out string authKey)
|
||||
{
|
||||
authority = string.Empty;
|
||||
authKey = string.Empty;
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Server.Handlers.Friends
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
}
|
||||
|
||||
public string RestGetGridInfoMethod(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.GridUser
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
|
|
|
@ -63,12 +63,12 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return OKResponse(httpResponse);
|
||||
}
|
||||
|
||||
private byte[] OKResponse(OSHttpResponse httpResponse)
|
||||
private byte[] OKResponse(IOSHttpResponse httpResponse)
|
||||
{
|
||||
m_log.Debug("[HELO]: hi, GET was called");
|
||||
httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType);
|
||||
|
@ -92,12 +92,12 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return OKResponse(httpResponse);
|
||||
}
|
||||
|
||||
private byte[] OKResponse(OSHttpResponse httpResponse)
|
||||
private byte[] OKResponse(IOSHttpResponse httpResponse)
|
||||
{
|
||||
m_log.Debug("[HELO]: hi, HEAD was called");
|
||||
httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType);
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Inventory
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
XmlSerializer xs = new XmlSerializer(typeof (List<InventoryItemBase>));
|
||||
List<InventoryItemBase> items = (List<InventoryItemBase>)xs.Deserialize(request);
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace OpenSim.Server.Handlers.MapImage
|
|||
m_MapService = service;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace OpenSim.Server.Handlers.MapImage
|
|||
m_MapService = service;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
byte[] result = new byte[0];
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace OpenSim.Server.Handlers.Neighbour
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// Not implemented yet
|
||||
Console.WriteLine("--- Get region --- " + path);
|
||||
|
@ -84,7 +84,7 @@ namespace OpenSim.Server.Handlers.Neighbour
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
byte[] result = new byte[0];
|
||||
|
||||
|
@ -177,7 +177,7 @@ namespace OpenSim.Server.Handlers.Neighbour
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// Not implemented yet
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented;
|
||||
|
@ -198,7 +198,7 @@ namespace OpenSim.Server.Handlers.Neighbour
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// Not implemented yet
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented;
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
|
|
|
@ -249,7 +249,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[SIMULATION]: Stream handler called");
|
||||
|
||||
|
@ -436,7 +436,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[SIMULATION]: Stream handler called");
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
|
|||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
|
|
|
@ -0,0 +1,179 @@
|
|||
/*
|
||||
* 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Tests.Common.Mock
|
||||
{
|
||||
public class TestOSHttpRequest : IOSHttpRequest
|
||||
{
|
||||
public string[] AcceptTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public Encoding ContentEncoding
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public long ContentLength
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public long ContentLength64
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public string ContentType
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public HttpCookieCollection Cookies
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasEntityBody
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public NameValueCollection Headers { get; set; }
|
||||
|
||||
public string HttpMethod
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public Stream InputStream
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSecured
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public bool KeepAlive
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public NameValueCollection QueryString
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public Hashtable Query
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public string RawUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public IPEndPoint RemoteIPEndPoint
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public Uri Url { get; set; }
|
||||
|
||||
public string UserAgent
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public TestOSHttpRequest()
|
||||
{
|
||||
Headers = new NameValueCollection();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,25 +27,107 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Tests.Common.Mock
|
||||
{
|
||||
public class TestOSHttpResponse : OSHttpResponse
|
||||
public class TestOSHttpResponse : IOSHttpResponse
|
||||
{
|
||||
private int m_statusCode;
|
||||
public override int StatusCode
|
||||
{
|
||||
get { return m_statusCode; }
|
||||
set { m_statusCode = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Content type property.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Setting this property will also set IsContentTypeSet to
|
||||
/// true.
|
||||
/// </remarks>
|
||||
public string ContentType { get; set; }
|
||||
|
||||
private string m_contentType;
|
||||
public override string ContentType
|
||||
{
|
||||
get { return m_contentType; }
|
||||
set { m_contentType = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Boolean property indicating whether the content type
|
||||
/// property actively has been set.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// IsContentTypeSet will go away together with .NET base.
|
||||
/// </remarks>
|
||||
// public bool IsContentTypeSet
|
||||
// {
|
||||
// get { return _contentTypeSet; }
|
||||
// }
|
||||
// private bool _contentTypeSet;
|
||||
|
||||
/// <summary>
|
||||
/// Length of the body content; 0 if there is no body.
|
||||
/// </summary>
|
||||
public long ContentLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alias for ContentLength.
|
||||
/// </summary>
|
||||
public long ContentLength64 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Encoding of the body content.
|
||||
/// </summary>
|
||||
public Encoding ContentEncoding { get; set; }
|
||||
|
||||
public bool KeepAlive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get or set the keep alive timeout property (default is
|
||||
/// 20). Setting this to 0 also disables KeepAlive. Setting
|
||||
/// this to something else but 0 also enable KeepAlive.
|
||||
/// </summary>
|
||||
public int KeepAliveTimeout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return the output stream feeding the body.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// On its way out...
|
||||
/// </remarks>
|
||||
public Stream OutputStream { get; private set; }
|
||||
|
||||
public string ProtocolVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return the output stream feeding the body.
|
||||
/// </summary>
|
||||
public Stream Body { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set a redirct location.
|
||||
/// </summary>
|
||||
public string RedirectLocation { private get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Chunk transfers.
|
||||
/// </summary>
|
||||
public bool SendChunked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status code.
|
||||
/// </summary>
|
||||
public int StatusCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// HTTP status description.
|
||||
/// </summary>
|
||||
public string StatusDescription { get; set; }
|
||||
|
||||
public bool ReuseContext { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Add a header field and content to the response.
|
||||
/// </summary>
|
||||
/// <param name="key">string containing the header field
|
||||
/// name</param>
|
||||
/// <param name="value">string containing the header field
|
||||
/// value</param>
|
||||
public void AddHeader(string key, string value) { throw new NotImplementedException(); }
|
||||
|
||||
public void Send() { }
|
||||
}
|
||||
}
|
||||
}
|
55
prebuild.xml
55
prebuild.xml
|
@ -2677,9 +2677,11 @@
|
|||
<ReferencePath>../../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Core"/>
|
||||
<Reference name="System.Data"/>
|
||||
<Reference name="System.Drawing"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Data"/>
|
||||
<Reference name="System.Web"/>
|
||||
<Reference name="HttpServer_OpenSim" path="../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../bin/"/>
|
||||
<Reference name="Mono.Addins" path="../../../bin/"/>
|
||||
<Reference name="Nini" path="../../../bin/"/>
|
||||
|
@ -2726,6 +2728,57 @@
|
|||
</Files>
|
||||
</Project>
|
||||
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Capabilities.Handlers.Tests" path="OpenSim/Capabilities/Handlers" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Core"/>
|
||||
<Reference name="System.Drawing"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Web"/>
|
||||
<Reference name="nunit.framework" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Capabilities"/>
|
||||
<Reference name="OpenSim.Capabilities.Handlers"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenSim.Server.Base"/>
|
||||
<Reference name="OpenSim.Server.Handlers"/>
|
||||
<Reference name="OpenSim.Services.Base"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="OpenSim.Tests.Common"/>
|
||||
<Reference name="Nini" path="../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../bin/"/>
|
||||
<Reference name="DotNetOpenId" path="../../../bin/"/>
|
||||
|
||||
<!--
|
||||
TODO: this is kind of lame, we basically build a duplicate
|
||||
assembly but with tests added in, just so that we don't
|
||||
need to hard code in a bunch of Test directories here. If
|
||||
pattern="Tests/*.cs" worked, we wouldn't need this.
|
||||
-->
|
||||
<Files>
|
||||
<!-- SADLY the way this works means you need to keep adding these paths -->
|
||||
<Match path="GetTexture/Tests" pattern="*.cs" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Data.Tests" path="OpenSim/Data/Tests" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
|
|
Loading…
Reference in New Issue