diff options
author | Justin Clarke Casey | 2009-03-19 18:11:44 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-03-19 18:11:44 +0000 |
commit | bd2180d9af21dd54d4199a9381afa3e43e913823 (patch) | |
tree | 7f82f0dd30e24d8eaa4f8cbb2493cb2f3f1c637f /OpenSim | |
parent | * Lock http handlers dictionary in other places as well to avoid race conditions (diff) | |
download | opensim-SC_OLD-bd2180d9af21dd54d4199a9381afa3e43e913823.zip opensim-SC_OLD-bd2180d9af21dd54d4199a9381afa3e43e913823.tar.gz opensim-SC_OLD-bd2180d9af21dd54d4199a9381afa3e43e913823.tar.bz2 opensim-SC_OLD-bd2180d9af21dd54d4199a9381afa3e43e913823.tar.xz |
* refactor: Create IHttpServer interface instead of accessing BaseHttpServer via CommunicationsManager directly
Diffstat (limited to '')
9 files changed, 159 insertions, 74 deletions
diff --git a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs index 11bb2c4..00407fd 100644 --- a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs +++ b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs | |||
@@ -38,7 +38,7 @@ using OpenSim.Framework; | |||
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
40 | using OpenSim.Framework.Communications.Capabilities; | 40 | using OpenSim.Framework.Communications.Capabilities; |
41 | using OpenSim.Framework.Servers; | 41 | using OpenSim.Framework.Servers.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
43 | using OpenSim.Region.Framework.Interfaces; | 43 | using OpenSim.Region.Framework.Interfaces; |
44 | 44 | ||
@@ -97,9 +97,10 @@ namespace OpenSim.Client.Linden | |||
97 | } | 97 | } |
98 | 98 | ||
99 | //TODO: fix casting. | 99 | //TODO: fix casting. |
100 | LibraryRootFolder rootFolder = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder; | 100 | LibraryRootFolder rootFolder |
101 | = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder; | ||
101 | 102 | ||
102 | BaseHttpServer httpServer = m_firstScene.CommsManager.HttpServer; | 103 | IHttpServer httpServer = m_firstScene.CommsManager.HttpServer; |
103 | 104 | ||
104 | //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference | 105 | //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference |
105 | m_loginService = new LLStandaloneLoginService((UserManagerBase)m_firstScene.CommsManager.UserService, welcomeMessage, m_firstScene.CommsManager.InterServiceInventoryService, m_firstScene.CommsManager.NetworkServersInfo, authenticate, rootFolder, this); | 106 | m_loginService = new LLStandaloneLoginService((UserManagerBase)m_firstScene.CommsManager.UserService, welcomeMessage, m_firstScene.CommsManager.InterServiceInventoryService, m_firstScene.CommsManager.NetworkServersInfo, authenticate, rootFolder, this); |
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 4ab304f..fde44be 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using log4net; | 33 | using log4net; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Framework.Servers.Interfaces; | ||
36 | 37 | ||
37 | // using OpenSim.Region.Framework.Interfaces; | 38 | // using OpenSim.Region.Framework.Interfaces; |
38 | 39 | ||
@@ -95,7 +96,7 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
95 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. | 96 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. |
96 | 97 | ||
97 | //private string eventQueue = "0100/"; | 98 | //private string eventQueue = "0100/"; |
98 | private BaseHttpServer m_httpListener; | 99 | private IHttpServer m_httpListener; |
99 | private UUID m_agentID; | 100 | private UUID m_agentID; |
100 | private IAssetCache m_assetCache; | 101 | private IAssetCache m_assetCache; |
101 | private int m_eventQueueCount = 1; | 102 | private int m_eventQueueCount = 1; |
@@ -120,7 +121,7 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
120 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; | 121 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; |
121 | public GetClientDelegate GetClient = null; | 122 | public GetClientDelegate GetClient = null; |
122 | 123 | ||
123 | public Caps(IAssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, | 124 | public Caps(IAssetCache assetCache, IHttpServer httpServer, string httpListen, uint httpPort, string capsPath, |
124 | UUID agent, bool dumpAssetsToFile, string regionName) | 125 | UUID agent, bool dumpAssetsToFile, string regionName) |
125 | { | 126 | { |
126 | m_assetCache = assetCache; | 127 | m_assetCache = assetCache; |
@@ -808,7 +809,7 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
808 | private UUID newAssetID; | 809 | private UUID newAssetID; |
809 | private UUID inventoryItemID; | 810 | private UUID inventoryItemID; |
810 | private UUID parentFolder; | 811 | private UUID parentFolder; |
811 | private BaseHttpServer httpListener; | 812 | private IHttpServer httpListener; |
812 | private bool m_dumpAssetsToFile; | 813 | private bool m_dumpAssetsToFile; |
813 | private string m_assetName = String.Empty; | 814 | private string m_assetName = String.Empty; |
814 | private string m_assetDes = String.Empty; | 815 | private string m_assetDes = String.Empty; |
@@ -818,7 +819,7 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
818 | 819 | ||
819 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, | 820 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, |
820 | UUID parentFolderID, string invType, string assetType, string path, | 821 | UUID parentFolderID, string invType, string assetType, string path, |
821 | BaseHttpServer httpServer, bool dumpAssetsToFile) | 822 | IHttpServer httpServer, bool dumpAssetsToFile) |
822 | { | 823 | { |
823 | m_assetName = assetName; | 824 | m_assetName = assetName; |
824 | m_assetDes = description; | 825 | m_assetDes = description; |
@@ -907,10 +908,10 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
907 | 908 | ||
908 | private string uploaderPath = String.Empty; | 909 | private string uploaderPath = String.Empty; |
909 | private UUID inventoryItemID; | 910 | private UUID inventoryItemID; |
910 | private BaseHttpServer httpListener; | 911 | private IHttpServer httpListener; |
911 | private bool m_dumpAssetToFile; | 912 | private bool m_dumpAssetToFile; |
912 | 913 | ||
913 | public ItemUpdater(UUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile) | 914 | public ItemUpdater(UUID inventoryItem, string path, IHttpServer httpServer, bool dumpAssetToFile) |
914 | { | 915 | { |
915 | m_dumpAssetToFile = dumpAssetToFile; | 916 | m_dumpAssetToFile = dumpAssetToFile; |
916 | 917 | ||
@@ -991,11 +992,11 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
991 | private UUID inventoryItemID; | 992 | private UUID inventoryItemID; |
992 | private UUID primID; | 993 | private UUID primID; |
993 | private bool isScriptRunning; | 994 | private bool isScriptRunning; |
994 | private BaseHttpServer httpListener; | 995 | private IHttpServer httpListener; |
995 | private bool m_dumpAssetToFile; | 996 | private bool m_dumpAssetToFile; |
996 | 997 | ||
997 | public TaskInventoryScriptUpdater(UUID inventoryItemID, UUID primID, int isScriptRunning, | 998 | public TaskInventoryScriptUpdater(UUID inventoryItemID, UUID primID, int isScriptRunning, |
998 | string path, BaseHttpServer httpServer, bool dumpAssetToFile) | 999 | string path, IHttpServer httpServer, bool dumpAssetToFile) |
999 | { | 1000 | { |
1000 | m_dumpAssetToFile = dumpAssetToFile; | 1001 | m_dumpAssetToFile = dumpAssetToFile; |
1001 | 1002 | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs index ed31c45..b47d014 100644 --- a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs +++ b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System.Collections; | 28 | using System.Collections; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenSim.Framework.Servers; | 30 | using OpenSim.Framework.Servers; |
31 | using OpenSim.Framework.Servers.Interfaces; | ||
31 | 32 | ||
32 | namespace OpenSim.Framework.Communications.Capabilities | 33 | namespace OpenSim.Framework.Communications.Capabilities |
33 | { | 34 | { |
@@ -39,7 +40,7 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
39 | public class CapsHandlers | 40 | public class CapsHandlers |
40 | { | 41 | { |
41 | private Dictionary <string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>(); | 42 | private Dictionary <string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>(); |
42 | private BaseHttpServer m_httpListener; | 43 | private IHttpServer m_httpListener; |
43 | private string m_httpListenerHostName; | 44 | private string m_httpListenerHostName; |
44 | private uint m_httpListenerPort; | 45 | private uint m_httpListenerPort; |
45 | private bool m_useSSL = false; | 46 | private bool m_useSSL = false; |
@@ -67,7 +68,7 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
67 | /// <param name="httpListenerHostname">host name of the HTTP | 68 | /// <param name="httpListenerHostname">host name of the HTTP |
68 | /// server</param> | 69 | /// server</param> |
69 | /// <param name="httpListenerPort">HTTP port</param> | 70 | /// <param name="httpListenerPort">HTTP port</param> |
70 | public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort, bool https) | 71 | public CapsHandlers(IHttpServer httpListener, string httpListenerHostname, uint httpListenerPort, bool https) |
71 | { | 72 | { |
72 | m_httpListener = httpListener; | 73 | m_httpListener = httpListener; |
73 | m_httpListenerHostName = httpListenerHostname; | 74 | m_httpListenerHostName = httpListenerHostname; |
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 3363c24..b4078fd 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -29,7 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenSim.Framework.Communications.Cache; | 31 | using OpenSim.Framework.Communications.Cache; |
32 | using OpenSim.Framework.Servers; | 32 | using OpenSim.Framework.Servers.Interfaces; |
33 | 33 | ||
34 | namespace OpenSim.Framework.Communications | 34 | namespace OpenSim.Framework.Communications |
35 | { | 35 | { |
@@ -106,12 +106,14 @@ namespace OpenSim.Framework.Communications | |||
106 | } | 106 | } |
107 | protected IUserAdminService m_userAdminService; | 107 | protected IUserAdminService m_userAdminService; |
108 | 108 | ||
109 | public BaseHttpServer HttpServer | 109 | /// <value> |
110 | /// OpenSimulator's built in HTTP server | ||
111 | /// </value> | ||
112 | public IHttpServer HttpServer | ||
110 | { | 113 | { |
111 | get { return m_httpServer; } | 114 | get { return m_httpServer; } |
112 | } | 115 | } |
113 | protected BaseHttpServer m_httpServer; | 116 | protected IHttpServer m_httpServer; |
114 | |||
115 | 117 | ||
116 | /// <summary> | 118 | /// <summary> |
117 | /// Constructor | 119 | /// Constructor |
@@ -120,7 +122,7 @@ namespace OpenSim.Framework.Communications | |||
120 | /// <param name="httpServer"></param> | 122 | /// <param name="httpServer"></param> |
121 | /// <param name="assetCache"></param> | 123 | /// <param name="assetCache"></param> |
122 | /// <param name="dumpAssetsToFile"></param> | 124 | /// <param name="dumpAssetsToFile"></param> |
123 | public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, IAssetCache assetCache, | 125 | public CommunicationsManager(NetworkServersInfo serversInfo, IHttpServer httpServer, IAssetCache assetCache, |
124 | bool dumpAssetsToFile, LibraryRootFolder libraryRootFolder) | 126 | bool dumpAssetsToFile, LibraryRootFolder libraryRootFolder) |
125 | { | 127 | { |
126 | m_networkServersInfo = serversInfo; | 128 | m_networkServersInfo = serversInfo; |
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 1b34209..28fb9df 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -41,10 +41,11 @@ using Nwc.XmlRpc; | |||
41 | using OpenMetaverse.StructuredData; | 41 | using OpenMetaverse.StructuredData; |
42 | using CoolHTTPListener = HttpServer.HttpListener; | 42 | using CoolHTTPListener = HttpServer.HttpListener; |
43 | using HttpListener=System.Net.HttpListener; | 43 | using HttpListener=System.Net.HttpListener; |
44 | using OpenSim.Framework.Servers.Interfaces; | ||
44 | 45 | ||
45 | namespace OpenSim.Framework.Servers | 46 | namespace OpenSim.Framework.Servers |
46 | { | 47 | { |
47 | public class BaseHttpServer | 48 | public class BaseHttpServer : IHttpServer |
48 | { | 49 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); | 51 | private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); |
@@ -148,11 +149,6 @@ namespace OpenSim.Framework.Servers | |||
148 | return true; | 149 | return true; |
149 | } | 150 | } |
150 | 151 | ||
151 | /// <summary> | ||
152 | /// Gets the XML RPC handler for given method name | ||
153 | /// </summary> | ||
154 | /// <param name="method">Name of the method</param> | ||
155 | /// <returns>Returns null if not found</returns> | ||
156 | public XmlRpcMethod GetXmlRPCHandler(string method) | 152 | public XmlRpcMethod GetXmlRPCHandler(string method) |
157 | { | 153 | { |
158 | lock (m_rpcHandlers) | 154 | lock (m_rpcHandlers) |
@@ -168,32 +164,6 @@ namespace OpenSim.Framework.Servers | |||
168 | } | 164 | } |
169 | } | 165 | } |
170 | 166 | ||
171 | /// <summary> | ||
172 | /// Add a handler for an HTTP request | ||
173 | /// </summary> | ||
174 | /// | ||
175 | /// This handler can actually be invoked either as | ||
176 | /// | ||
177 | /// http://<hostname>:<port>/?method=<methodName> | ||
178 | /// | ||
179 | /// or | ||
180 | /// | ||
181 | /// http://<hostname>:<port><method> | ||
182 | /// | ||
183 | /// if the method name starts with a slash. For example, AddHTTPHandler("/object/", ...) on a standalone region | ||
184 | /// server will register a handler that can be invoked with either | ||
185 | /// | ||
186 | /// http://localhost:9000/?method=/object/ | ||
187 | /// | ||
188 | /// or | ||
189 | /// | ||
190 | /// http://localhost:9000/object/ | ||
191 | /// | ||
192 | /// <param name="methodName"></param> | ||
193 | /// <param name="handler"></param> | ||
194 | /// <returns> | ||
195 | /// true if the handler was successfully registered, false if a handler with the same name already existed. | ||
196 | /// </returns> | ||
197 | public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) | 167 | public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) |
198 | { | 168 | { |
199 | //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); | 169 | //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); |
@@ -229,12 +199,6 @@ namespace OpenSim.Framework.Servers | |||
229 | return false; | 199 | return false; |
230 | } | 200 | } |
231 | 201 | ||
232 | /// <summary> | ||
233 | /// Adds a LLSD handler, yay. | ||
234 | /// </summary> | ||
235 | /// <param name="path">/resource/ path</param> | ||
236 | /// <param name="handler">handle the LLSD response</param> | ||
237 | /// <returns></returns> | ||
238 | public bool AddLLSDHandler(string path, LLSDMethod handler) | 202 | public bool AddLLSDHandler(string path, LLSDMethod handler) |
239 | { | 203 | { |
240 | lock (m_llsdHandlers) | 204 | lock (m_llsdHandlers) |
@@ -1313,7 +1277,6 @@ namespace OpenSim.Framework.Servers | |||
1313 | response.ContentLength64 = buffer.Length; | 1277 | response.ContentLength64 = buffer.Length; |
1314 | response.ContentEncoding = Encoding.UTF8; | 1278 | response.ContentEncoding = Encoding.UTF8; |
1315 | 1279 | ||
1316 | |||
1317 | try | 1280 | try |
1318 | { | 1281 | { |
1319 | response.OutputStream.Write(buffer, 0, buffer.Length); | 1282 | response.OutputStream.Write(buffer, 0, buffer.Length); |
@@ -1334,8 +1297,7 @@ namespace OpenSim.Framework.Servers | |||
1334 | // This has to be here to prevent a Linux/Mono crash | 1297 | // This has to be here to prevent a Linux/Mono crash |
1335 | m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); | 1298 | m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); |
1336 | } | 1299 | } |
1337 | } | 1300 | } |
1338 | |||
1339 | } | 1301 | } |
1340 | 1302 | ||
1341 | public void SendHTML404(OSHttpResponse response, string host) | 1303 | public void SendHTML404(OSHttpResponse response, string host) |
@@ -1513,11 +1475,6 @@ namespace OpenSim.Framework.Servers | |||
1513 | lock (m_streamHandlers) m_streamHandlers.Remove(handlerKey); | 1475 | lock (m_streamHandlers) m_streamHandlers.Remove(handlerKey); |
1514 | } | 1476 | } |
1515 | 1477 | ||
1516 | /// <summary> | ||
1517 | /// Remove an HTTP handler | ||
1518 | /// </summary> | ||
1519 | /// <param name="httpMethod"></param> | ||
1520 | /// <param name="path"></param> | ||
1521 | public void RemoveHTTPHandler(string httpMethod, string path) | 1478 | public void RemoveHTTPHandler(string httpMethod, string path) |
1522 | { | 1479 | { |
1523 | lock (m_HTTPHandlers) | 1480 | lock (m_HTTPHandlers) |
@@ -1532,12 +1489,6 @@ namespace OpenSim.Framework.Servers | |||
1532 | } | 1489 | } |
1533 | } | 1490 | } |
1534 | 1491 | ||
1535 | /// <summary> | ||
1536 | /// Remove the agent IF it is registered. Intercept the possible exception. | ||
1537 | /// </summary> | ||
1538 | /// <param name="agent"></param> | ||
1539 | /// <param name="handler"></param> | ||
1540 | /// <returns></returns> | ||
1541 | public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) | 1492 | public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) |
1542 | { | 1493 | { |
1543 | try | 1494 | try |
diff --git a/OpenSim/Framework/Servers/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/Interfaces/IHttpServer.cs new file mode 100644 index 0000000..ea2c8f1 --- /dev/null +++ b/OpenSim/Framework/Servers/Interfaces/IHttpServer.cs | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using Nwc.XmlRpc; | ||
29 | using OpenSim.Framework.Servers; | ||
30 | |||
31 | namespace OpenSim.Framework.Servers.Interfaces | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// Interface to OpenSimulator's built in HTTP server. Use this to register handlers (http, llsd, xmlrpc, etc.) | ||
35 | /// for given URLs. | ||
36 | /// </summary> | ||
37 | public interface IHttpServer | ||
38 | { | ||
39 | uint SSLPort { get; } | ||
40 | string SSLCommonName { get; } | ||
41 | |||
42 | uint Port { get; } | ||
43 | bool UseSSL { get; } | ||
44 | |||
45 | // Note that the agent string is provided simply to differentiate | ||
46 | // the handlers - it is NOT required to be an actual agent header | ||
47 | // value. | ||
48 | bool AddAgentHandler(string agent, IHttpAgentHandler handler); | ||
49 | |||
50 | /// <summary> | ||
51 | /// Add a handler for an HTTP request | ||
52 | /// </summary> | ||
53 | /// | ||
54 | /// This handler can actually be invoked either as | ||
55 | /// | ||
56 | /// http://<hostname>:<port>/?method=<methodName> | ||
57 | /// | ||
58 | /// or | ||
59 | /// | ||
60 | /// http://<hostname>:<port><method> | ||
61 | /// | ||
62 | /// if the method name starts with a slash. For example, AddHTTPHandler("/object/", ...) on a standalone region | ||
63 | /// server will register a handler that can be invoked with either | ||
64 | /// | ||
65 | /// http://localhost:9000/?method=/object/ | ||
66 | /// | ||
67 | /// or | ||
68 | /// | ||
69 | /// http://localhost:9000/object/ | ||
70 | /// | ||
71 | /// <param name="methodName"></param> | ||
72 | /// <param name="handler"></param> | ||
73 | /// <returns> | ||
74 | /// true if the handler was successfully registered, false if a handler with the same name already existed. | ||
75 | /// </returns> | ||
76 | bool AddHTTPHandler(string methodName, GenericHTTPMethod handler); | ||
77 | |||
78 | /// <summary> | ||
79 | /// Adds a LLSD handler, yay. | ||
80 | /// </summary> | ||
81 | /// <param name="path">/resource/ path</param> | ||
82 | /// <param name="handler">handle the LLSD response</param> | ||
83 | /// <returns></returns> | ||
84 | bool AddLLSDHandler(string path, LLSDMethod handler); | ||
85 | |||
86 | /// <summary> | ||
87 | /// Add a stream handler to the http server. If the handler already exists, then nothing happens. | ||
88 | /// </summary> | ||
89 | /// <param name="handler"></param> | ||
90 | void AddStreamHandler(IRequestHandler handler); | ||
91 | |||
92 | bool AddXmlRPCHandler(string method, XmlRpcMethod handler); | ||
93 | bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive); | ||
94 | |||
95 | /// <summary> | ||
96 | /// Gets the XML RPC handler for given method name | ||
97 | /// </summary> | ||
98 | /// <param name="method">Name of the method</param> | ||
99 | /// <returns>Returns null if not found</returns> | ||
100 | XmlRpcMethod GetXmlRPCHandler(string method); | ||
101 | |||
102 | bool SetDefaultLLSDHandler(DefaultLLSDMethod handler); | ||
103 | |||
104 | /// <summary> | ||
105 | /// Remove the agent if it is registered. | ||
106 | /// </summary> | ||
107 | /// <param name="agent"></param> | ||
108 | /// <param name="handler"></param> | ||
109 | /// <returns></returns> | ||
110 | bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); | ||
111 | |||
112 | /// <summary> | ||
113 | /// Remove an HTTP handler | ||
114 | /// </summary> | ||
115 | /// <param name="httpMethod"></param> | ||
116 | /// <param name="path"></param> | ||
117 | void RemoveHTTPHandler(string httpMethod, string path); | ||
118 | |||
119 | bool RemoveLLSDHandler(string path, LLSDMethod handler); | ||
120 | |||
121 | void RemoveStreamHandler(string httpMethod, string path); | ||
122 | |||
123 | string GetHTTP404(string host); | ||
124 | |||
125 | string GetHTTP500(); | ||
126 | } | ||
127 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs b/OpenSim/Region/CoreModules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs index 488e55b..a50eb2d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs | |||
@@ -38,7 +38,7 @@ using Nwc.XmlRpc; | |||
38 | using OpenMetaverse; | 38 | using OpenMetaverse; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Communications.Cache; | 40 | using OpenSim.Framework.Communications.Cache; |
41 | using OpenSim.Framework.Servers; | 41 | using OpenSim.Framework.Servers.Interfaces; |
42 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
44 | 44 | ||
@@ -133,7 +133,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Currency.SampleMoney | |||
133 | if (m_enabled) | 133 | if (m_enabled) |
134 | { | 134 | { |
135 | scene.RegisterModuleInterface<IMoneyModule>(this); | 135 | scene.RegisterModuleInterface<IMoneyModule>(this); |
136 | BaseHttpServer httpServer = scene.CommsManager.HttpServer; | 136 | IHttpServer httpServer = scene.CommsManager.HttpServer; |
137 | 137 | ||
138 | lock (m_scenel) | 138 | lock (m_scenel) |
139 | { | 139 | { |
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneAssetService.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneAssetService.cs index f8c7c79..4baefc4 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneAssetService.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneAssetService.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Communications.Cache; | 36 | using OpenSim.Framework.Communications.Cache; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Framework.Servers.Interfaces; | ||
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
40 | 41 | ||
@@ -116,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
116 | IAssetDataPlugin m_assetProvider | 117 | IAssetDataPlugin m_assetProvider |
117 | = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin; | 118 | = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin; |
118 | 119 | ||
119 | BaseHttpServer httpServer = m_scene.CommsManager.HttpServer; | 120 | IHttpServer httpServer = m_scene.CommsManager.HttpServer; |
120 | httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider)); | 121 | httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider)); |
121 | httpServer.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider)); | 122 | httpServer.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider)); |
122 | 123 | ||
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs index 6ad032e..cff3611 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs | |||
@@ -35,6 +35,7 @@ using OpenMetaverse; | |||
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Framework.Servers.Interfaces; | ||
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
40 | 41 | ||
@@ -114,7 +115,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
114 | 115 | ||
115 | protected void AddHttpHandlers(Scene m_scene) | 116 | protected void AddHttpHandlers(Scene m_scene) |
116 | { | 117 | { |
117 | BaseHttpServer httpServer = m_scene.CommsManager.HttpServer; | 118 | IHttpServer httpServer = m_scene.CommsManager.HttpServer; |
118 | 119 | ||
119 | httpServer.AddStreamHandler( | 120 | httpServer.AddStreamHandler( |
120 | new RestDeserialiseSecureHandler<Guid, InventoryCollection>( | 121 | new RestDeserialiseSecureHandler<Guid, InventoryCollection>( |