From 4567555c49cb560dd6f109bbfec42086af3de56f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 5 Dec 2011 20:44:20 +0000 Subject: Implement IOSHttpRequest and IOSHttpResponse http interfaces and use instead of OSHttpRequest/OSHttpResponse. This is required for the substitution of different HTTP servers or the newer HttpServer.dll without having to commit to a particular implementation. This is also required to write regression tests that involve the HTTP layer. If you need to recompile, all you need to do is replace OSHttpRequest/OSHttpResponse references with IOSHttpRequest/IOSHttpResponse. --- .../ApplicationPlugins/Rest/Regions/GETHandler.cs | 12 +- .../Rest/Regions/GETRegionInfoHandler.cs | 4 +- .../ApplicationPlugins/Rest/Regions/POSTHandler.cs | 6 +- OpenSim/ApplicationPlugins/Rest/RestPlugin.cs | 8 +- .../Handlers/GetTexture/GetTextureHandler.cs | 6 +- .../UploadBakedTextureHandler.cs | 2 +- .../WebFetchInvDescHandler.cs | 2 +- OpenSim/Capabilities/LLSDStreamHandler.cs | 2 +- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 2 +- .../Servers/HttpServer/BaseStreamHandler.cs | 2 +- .../Servers/HttpServer/BinaryStreamHandler.cs | 2 +- .../HttpServer/Interfaces/IOSHttpRequest.cs | 59 +++++++++ .../HttpServer/Interfaces/IOSHttpResponse.cs | 138 +++++++++++++++++++++ .../HttpServer/Interfaces/IStreamHandler.cs | 4 +- .../Framework/Servers/HttpServer/OSHttpRequest.cs | 3 +- .../Framework/Servers/HttpServer/OSHttpResponse.cs | 5 +- .../Servers/HttpServer/RestDeserialiseHandler.cs | 2 +- OpenSim/Framework/Servers/HttpServer/RestMethod.cs | 2 +- .../Servers/HttpServer/RestSessionService.cs | 4 +- .../Servers/HttpServer/RestStreamHandler.cs | 2 +- OpenSim/Region/Application/OpenSimBase.cs | 6 +- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 6 +- .../Avatar/Friends/FriendsRequestHandler.cs | 4 +- .../CoreModules/World/Land/LandManagementModule.cs | 4 +- .../CoreModules/World/Media/Moap/MoapModule.cs | 4 +- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- OpenSim/Region/DataSnapshot/DataRequestHandler.cs | 2 +- .../Region/Framework/Scenes/RegionStatsHandler.cs | 2 +- .../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 6 +- .../Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | 6 +- .../World/WorldView/WorldViewRequestHandler.cs | 2 +- OpenSim/Region/UserStatistics/WebStatsModule.cs | 2 +- .../Handlers/Asset/AssetServerDeleteHandler.cs | 2 +- .../Server/Handlers/Asset/AssetServerGetHandler.cs | 2 +- .../Handlers/Asset/AssetServerPostHandler.cs | 2 +- .../AuthenticationServerPostHandler.cs | 2 +- .../Handlers/Authentication/OpenIdServerHandler.cs | 2 +- .../AuthorizationServerPostHandler.cs | 2 +- .../Handlers/Avatar/AvatarServerPostHandler.cs | 2 +- OpenSim/Server/Handlers/Base/Utils.cs | 2 +- .../Handlers/Friends/FriendsServerPostHandler.cs | 2 +- OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | 2 +- .../Server/Handlers/Grid/GridServerPostHandler.cs | 2 +- .../Handlers/GridUser/GridUserServerPostHandler.cs | 2 +- .../Hypergrid/HGFriendsServerPostHandler.cs | 2 +- .../Handlers/Hypergrid/HeloServerConnector.cs | 8 +- .../Inventory/InventoryServerMoveItemsHandler.cs | 2 +- .../Handlers/Inventory/XInventoryInConnector.cs | 2 +- .../Server/Handlers/Map/MapAddServerConnector.cs | 2 +- .../Server/Handlers/Map/MapGetServerConnector.cs | 2 +- .../Server/Handlers/Neighbour/NeighbourHandlers.cs | 8 +- .../Handlers/Presence/PresenceServerPostHandler.cs | 2 +- .../Server/Handlers/Simulation/AgentHandlers.cs | 4 +- .../UserAccounts/UserAccountServerPostHandler.cs | 2 +- OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs | 112 ++++++++++++++--- 55 files changed, 380 insertions(+), 103 deletions(-) create mode 100644 OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpRequest.cs create mode 100644 OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs (limited to 'OpenSim') diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs index dea166d..d99ba57 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs @@ -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"; diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs index 279db4c..468faea 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs @@ -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()); diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs index e0318e5..f666f45 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs @@ -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(); if (serialiser != null) diff --git a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs index ff1502a..eb16750 100644 --- a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs +++ b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs @@ -328,7 +328,7 @@ namespace OpenSim.ApplicationPlugins.Rest /// /// HTTP request header /// true when the HTTP request came from god. - 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 /// - 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 /// failure message /// This should probably set a return code as /// well. (?) - 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 /// exception causing the failure message /// This should probably set a return code as /// well. (?) - 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); diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 7ab30ce..ae95821 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs @@ -64,7 +64,7 @@ namespace OpenSim.Capabilities.Handlers m_assetService = assService; } - public override byte[] Handle(string path, Stream request, 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 /// /// /// False for "caller try another codec"; true otherwise - 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"); diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs index b89fd6a..e0ccc3c 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs @@ -73,7 +73,7 @@ namespace OpenSim.Capabilities.Handlers /// /// The upload response if the request is successful, null otherwise. public string UploadBakedTexture( - string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) + string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { try { diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs index 2dade5b..a086c0e 100644 --- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs @@ -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) // { diff --git a/OpenSim/Capabilities/LLSDStreamHandler.cs b/OpenSim/Capabilities/LLSDStreamHandler.cs index 7aaa994..c7c1fc9 100644 --- a/OpenSim/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Capabilities/LLSDStreamHandler.cs @@ -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); diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index db063f1..4c381d0 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -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")) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs index 04943d1..f1cde74 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs @@ -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) { diff --git a/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs index bae4e1b..1699233 100644 --- a/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs @@ -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); diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpRequest.cs new file mode 100644 index 0000000..caf0edd --- /dev/null +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpRequest.cs @@ -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; } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs new file mode 100644 index 0000000..33a1663 --- /dev/null +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs @@ -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 + { + /// + /// Content type property. + /// + /// + /// Setting this property will also set IsContentTypeSet to + /// true. + /// + string ContentType { get; set; } + + /// + /// Boolean property indicating whether the content type + /// property actively has been set. + /// + /// + /// IsContentTypeSet will go away together with .NET base. + /// + // public bool IsContentTypeSet + // { + // get { return _contentTypeSet; } + // } + // private bool _contentTypeSet; + + /// + /// Length of the body content; 0 if there is no body. + /// + long ContentLength { get; set; } + + /// + /// Alias for ContentLength. + /// + long ContentLength64 { get; set; } + + /// + /// Encoding of the body content. + /// + Encoding ContentEncoding { get; set; } + + bool KeepAlive { get; set; } + + /// + /// 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. + /// + int KeepAliveTimeout { get; set; } + + /// + /// Return the output stream feeding the body. + /// + /// + /// On its way out... + /// + Stream OutputStream { get; } + + string ProtocolVersion { get; set; } + + /// + /// Return the output stream feeding the body. + /// + Stream Body { get; } + + /// + /// Set a redirct location. + /// + string RedirectLocation { set; } + + /// + /// Chunk transfers. + /// + bool SendChunked { get; set; } + + /// + /// HTTP status code. + /// + int StatusCode { get; set; } + + /// + /// HTTP status description. + /// + string StatusDescription { get; set; } + + bool ReuseContext { get; set; } + + /// + /// Add a header field and content to the response. + /// + /// string containing the header field + /// name + /// string containing the header field + /// value + void AddHeader(string key, string value); + + /// + /// Send the response back to the remote client + /// + void Send(); + } +} + diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs index 2e1bc0b..a449c2d 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs @@ -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 diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs index e354dfb..fc8daf3 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs @@ -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 _whiteboard = new Dictionary(); - public OSHttpRequest() {} public OSHttpRequest(IHttpClientContext context, IHttpRequest req) diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs index 7029289..f9227ac 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs @@ -36,7 +36,7 @@ namespace OpenSim.Framework.Servers.HttpServer /// OSHttpResponse is the OpenSim representation of an HTTP /// response. /// - public class OSHttpResponse + public class OSHttpResponse : IOSHttpResponse { /// /// 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 } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs index 3f2b265..a467a83 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs @@ -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)) diff --git a/OpenSim/Framework/Servers/HttpServer/RestMethod.cs b/OpenSim/Framework/Servers/HttpServer/RestMethod.cs index f97efbe..80bc7ef 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestMethod.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestMethod.cs @@ -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); } diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 7ebb462..19c03a8 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs @@ -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 deserial = default(RestSessionObject); 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; diff --git a/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs index 2d43cd4..d2c4002 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs @@ -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); diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 0a78df2..bae44ee 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -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)); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 98dda36..2347cf2 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -223,7 +223,7 @@ namespace OpenSim.Region.ClientStack.Linden /// HTTP response header object /// 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 /// HTTP response header object /// 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 /// /// 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); diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs index 1b53a42..637beef 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs @@ -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(); diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 2117827..94bba83 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -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); })); diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 898ca4a..5239f50 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -293,7 +293,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap /// /// 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> /// 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); diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 95c727f..9b0e2ff 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -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); diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs index a505999..b760454 100644 --- a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs +++ b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs @@ -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(); diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs index 4578236..6c5685c 100644 --- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs +++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs @@ -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()); } diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index a5bba4f..5323a95 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -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); diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index 534bf92..70e2f7e 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs @@ -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); diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs index f47d9c7..550b5d4 100644 --- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs +++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs @@ -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"; diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index 0251ee8..fca9fd0 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -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); diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs index 8014fb5..0cfe5b1 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs @@ -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; diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index 43c1693..8f7412b 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs @@ -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]; diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs index 1fcd3ed..87b3d2d 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs @@ -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); diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index 4d1b0ff..a19b599 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs @@ -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); diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs index e73961b..440b898 100644 --- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs @@ -219,7 +219,7 @@ For more information, see http://openid.net/. /// Handles all GET and POST requests for OpenID identifier pages and endpoint /// server communication /// - 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)); diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs index d656238..bcf9d47 100644 --- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs @@ -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); diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs index 49c2e43..3ee405c 100644 --- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs @@ -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(); diff --git a/OpenSim/Server/Handlers/Base/Utils.cs b/OpenSim/Server/Handlers/Base/Utils.cs index 92372a0..48d923f 100644 --- a/OpenSim/Server/Handlers/Base/Utils.cs +++ b/OpenSim/Server/Handlers/Base/Utils.cs @@ -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; diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index fc97d8c..59420f5 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs @@ -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(); diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index afe2f27..645a77f 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs @@ -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(); diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index edc0561..bebf482 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -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(); diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 485bc3e..4c0d52e 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs @@ -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(); diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index 56f130e..661507e 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs @@ -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(); diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs index 4accea1..f306b1c 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs @@ -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); diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs index 850bf14..231e32f 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs @@ -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)); List items = (List)xs.Deserialize(request); diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 899f9c0..9d6f964 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -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(); diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 8291107..75dd711 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -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); diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs index 501074d..fb85d1c 100644 --- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs @@ -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]; diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs index 68bb01e..8a1f824 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs @@ -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; diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 85bf96e..6b6a552 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -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(); diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index fdb4967..1d1f9ef 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -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"); diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index 5ab4caf..ab383ef 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -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(); diff --git a/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs b/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs index 581985a..e10fe82 100644 --- a/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs +++ b/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs @@ -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; } - } - - private string m_contentType; - public override string ContentType - { - get { return m_contentType; } - set { m_contentType = value; } - } + /// + /// Content type property. + /// + /// + /// Setting this property will also set IsContentTypeSet to + /// true. + /// + public string ContentType { get; set; } + + /// + /// Boolean property indicating whether the content type + /// property actively has been set. + /// + /// + /// IsContentTypeSet will go away together with .NET base. + /// + // public bool IsContentTypeSet + // { + // get { return _contentTypeSet; } + // } + // private bool _contentTypeSet; + + /// + /// Length of the body content; 0 if there is no body. + /// + public long ContentLength { get; set; } + + /// + /// Alias for ContentLength. + /// + public long ContentLength64 { get; set; } + + /// + /// Encoding of the body content. + /// + public Encoding ContentEncoding { get; set; } + + public bool KeepAlive { get; set; } + + /// + /// 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. + /// + public int KeepAliveTimeout { get; set; } + + /// + /// Return the output stream feeding the body. + /// + /// + /// On its way out... + /// + public Stream OutputStream { get; private set; } + + public string ProtocolVersion { get; set; } + + /// + /// Return the output stream feeding the body. + /// + public Stream Body { get; private set; } + + /// + /// Set a redirct location. + /// + public string RedirectLocation { private get; set; } + + /// + /// Chunk transfers. + /// + public bool SendChunked { get; set; } + + /// + /// HTTP status code. + /// + public int StatusCode { get; set; } + + /// + /// HTTP status description. + /// + public string StatusDescription { get; set; } + + public bool ReuseContext { get; set; } + + /// + /// Add a header field and content to the response. + /// + /// string containing the header field + /// name + /// string containing the header field + /// value + public void AddHeader(string key, string value) { throw new NotImplementedException(); } + + public void Send() { } } -} +} \ No newline at end of file -- cgit v1.1 From 319507f5215f5705cbe80d0c468da15ffe778829 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 5 Dec 2011 21:04:17 +0000 Subject: Add test for not found response from GetTexture cap handler. Add OpenSim.Region.Capabilities.Handlers.Tests.dll into test suite --- .../GetTexture/Tests/GetTextureHandlerTests.cs | 63 ++++++++ OpenSim/Tests/Common/Mock/TestOSHttpRequest.cs | 179 +++++++++++++++++++++ 2 files changed, 242 insertions(+) create mode 100644 OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs create mode 100644 OpenSim/Tests/Common/Mock/TestOSHttpRequest.cs (limited to 'OpenSim') diff --git a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs new file mode 100644 index 0000000..fd152c3 --- /dev/null +++ b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs @@ -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)); + } + } +} \ No newline at end of file diff --git a/OpenSim/Tests/Common/Mock/TestOSHttpRequest.cs b/OpenSim/Tests/Common/Mock/TestOSHttpRequest.cs new file mode 100644 index 0000000..e769d30 --- /dev/null +++ b/OpenSim/Tests/Common/Mock/TestOSHttpRequest.cs @@ -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(); + } + } +} \ No newline at end of file -- cgit v1.1 From d33d12ba83fae18d720ef24b56cba5c17688d386 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Dec 2011 16:07:24 +0000 Subject: Provide feedback as to which avatars are resending appearance informion on "appearance send" console command --- .../Avatar/Appearance/AppearanceInfoModule.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index 28f04b3..59ad008 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs @@ -48,7 +48,7 @@ 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); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Dictionary m_scenes = new Dictionary(); protected IAvatarFactoryModule m_avatarFactory; @@ -112,7 +112,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance { foreach (Scene scene in m_scenes.Values) { - scene.ForEachRootScenePresence(sp => scene.AvatarFactory.SendAppearance(sp.UUID)); + 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); + } + ); } } } -- cgit v1.1 From 4be85eeaa53029381c9f6e0fec7ab18ab59eef06 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Dec 2011 16:42:28 +0000 Subject: Make it possible to manually send appearance information via the "appearance send" command for a chosen avatar as well as all --- .../Avatar/Appearance/AppearanceInfoModule.cs | 53 +++++++++++++++++----- 1 file changed, 42 insertions(+), 11 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index 59ad008..c6ee36b 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs @@ -97,36 +97,67 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance "appearance show", "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); + HandleShowAppearanceCommand); scene.AddCommand( this, "appearance send", - "appearance send", - "Send appearance data for each avatar in the simulator to viewers.", - SendAppearance); + "appearance send [ ]", + "Send appearance data for each avatar in the simulator to other viewers." + + "\nOptionally, you can specify that only a particular avatar's information 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 [ ]"); + 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 => + 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) { lock (m_scenes) { -- cgit v1.1 From 1b9eb5285033839bdc1b948ec085aa8736473ad6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Dec 2011 18:03:16 +0000 Subject: Allow "appearance show" command to take an optional avatar name --- .../Avatar/Appearance/AppearanceInfoModule.cs | 48 ++++++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index c6ee36b..7f3f365 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs @@ -96,14 +96,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance this, "appearance show", "appearance show", "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.", + "Optionally, you can view just a particular avatar's appearance information" + + "\nAt 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.", HandleShowAppearanceCommand); scene.AddCommand( this, "appearance send", "appearance send [ ]", - "Send appearance data for each avatar in the simulator to other viewers." - + "\nOptionally, you can specify that only a particular avatar's information is sent.", + "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); } @@ -148,7 +149,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance MainConsole.Instance.OutputFormat( "Sending appearance information for {0} to all other avatars in {1}", sp.Name, scene.RegionInfo.RegionName); - + scene.AvatarFactory.SendAppearance(sp.UUID); } ); @@ -158,18 +159,49 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance } protected void HandleShowAppearanceCommand(string module, string[] cmd) - { + { + if (cmd.Length != 2 && cmd.Length < 4) + { + MainConsole.Instance.OutputFormat("Usage: appearance show [ ]"); + 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) { 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"); + } + ); + } } } } -- cgit v1.1 From ec4f217af8bb5ff90978ba068860ed38e75d40f8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Dec 2011 18:06:29 +0000 Subject: Actually send the avatar data if an individual avatar is specified, rather than accidentally doing nothing --- .../Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index 7f3f365..b6dfc5c 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs @@ -139,6 +139,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance 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 -- cgit v1.1 From b9a461c5ad10753e98a17b17858cc3b2eae568ea Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Dec 2011 18:32:27 +0000 Subject: In "appearance show", if a particular avatar is specified, print out texture UUID for each bake type and whether the simulator can find it. --- .../Avatar/Appearance/AppearanceInfoModule.cs | 40 +++++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index b6dfc5c..b949059 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs @@ -49,9 +49,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance public class AppearanceInfoModule : ISharedRegionModule { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected Dictionary m_scenes = new Dictionary(); - protected IAvatarFactoryModule m_avatarFactory; + + public const string SHOW_APPEARANCE_FORMAT = "{0,-9} {1}"; + + private Dictionary m_scenes = new Dictionary(); + private IAvatarFactoryModule m_avatarFactory; public string Name { get { return "Appearance Information Module"; } } @@ -96,8 +98,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance this, "appearance show", "appearance show", "Show appearance information for each avatar in the simulator.", - "Optionally, you can view just a particular avatar's appearance information" - + "\nAt 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.", + "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( @@ -188,6 +192,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance 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 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"); -- cgit v1.1 From 136a6a6e0fe7bcb5d24675dae2c3c538df404d62 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Dec 2011 18:36:11 +0000 Subject: Make "show appearance" a synonym for "appearance show" --- .../OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index b949059..89704d5 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs @@ -92,11 +92,17 @@ 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 [ ]", + "Synonym for 'appearance show'", + HandleShowAppearanceCommand); scene.AddCommand( this, "appearance show", - "appearance show", + "appearance show [ ]", "Show appearance information for each avatar in the simulator.", "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." -- cgit v1.1 From 8721841fc3944ce0cdf5ce76297e73f9ed269751 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Dec 2011 18:37:13 +0000 Subject: Revert "Stop performing the asset save part of baked texture uploading on the UploadBakedTexture cap asynchronously." This is a possible cause of the dramatic upswing in "Unable to upload... No handler registered for LLSD requests..." Needs more investigation. This reverts commit 1854c52ea3c60d0a47f9793a7f5ec405e15489ca. --- .../UploadBakedTexture/UploadBakedTextureHandler.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs index e0ccc3c..e3bf8cf 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs @@ -106,7 +106,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 +132,6 @@ namespace OpenSim.Capabilities.Handlers class BakedTextureUploader { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public event Action OnUpLoad; private string uploaderPath = String.Empty; @@ -158,12 +156,10 @@ namespace OpenSim.Capabilities.Handlers public string uploaderCaps(byte[] data, string path, string param) { Action 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 +171,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; } -- cgit v1.1 From 8e542cfa03f9368368a0f73fbcff0d54622b5588 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Dec 2011 21:42:56 +0000 Subject: Stop accidentally setting up the UploadTexture caps handler with the same url for all users This meant that if a user exited the region, the UploadTexture handler would be effectively removed for everyone, causing subsequent failures. This hopefully resolves the recent UploadTexture LLSD problems This was a regression in 5640f2e (Thu Dec 1 23:24:15 2011 +0000) --- .../Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs | 2 -- OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs index e3bf8cf..b7ca703 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs @@ -77,8 +77,6 @@ namespace OpenSim.Capabilities.Handlers { 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"); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index e61815f..45d6071 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -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)); } -- cgit v1.1