From acfb5051cd328ab21aba5bfc2878ce84d496a7f1 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 4 May 2009 20:15:39 +0000 Subject: Intermediate commit. WILL NOT COMPILE! --- .../CreateCommsManager/CreateCommsManagerPlugin.cs | 1 + .../RemoteController/RemoteAdminPlugin.cs | 1 + .../Rest/Inventory/IRestHandler.cs | 2 +- .../Rest/Inventory/RequestData.cs | 1 + .../Rest/Inventory/RestAppearanceServices.cs | 1 + .../Rest/Inventory/RestAssetServices.cs | 1 + .../Rest/Inventory/RestFileServices.cs | 1 + .../Rest/Inventory/RestHandler.cs | 2 +- .../Rest/Inventory/RestInventoryServices.cs | 1 + .../Rest/Inventory/RestTestServices.cs | 1 + .../ApplicationPlugins/Rest/Regions/GETHandler.cs | 1 + .../Rest/Regions/GETRegionInfoHandler.cs | 1 + .../ApplicationPlugins/Rest/Regions/POSTHandler.cs | 3 +- OpenSim/ApplicationPlugins/Rest/RestPlugin.cs | 4 +- OpenSim/Client/Linden/LLStandaloneLoginModule.cs | 2 +- .../Client/VWoHTTP/ClientStack/VWHClientView.cs | 1 + OpenSim/Client/VWoHTTP/VWoHTTPModule.cs | 2 +- .../Communications/Cache/CryptoGridAssetClient.cs | 2 +- .../Communications/Cache/GridAssetClient.cs | 2 +- .../Framework/Communications/Capabilities/Caps.cs | 2 +- .../Communications/Capabilities/CapsHandlers.cs | 4 +- .../Capabilities/LLSDStreamHandler.cs | 1 + .../Communications/Clients/InventoryClient.cs | 1 + .../Communications/CommunicationsManager.cs | 2 +- .../Communications/Services/GridInfoService.cs | 2 +- .../Communications/Services/HGInventoryService.cs | 2 +- OpenSim/Framework/Console/RemoteConsole.cs | 2 +- OpenSim/Framework/Servers/BaseHTTPHandler.cs | 41 - OpenSim/Framework/Servers/BaseHttpServer.cs | 1626 -------------------- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 496 ------ OpenSim/Framework/Servers/BaseRequestHandler.cs | 71 - OpenSim/Framework/Servers/BaseStreamHandler.cs | 42 - OpenSim/Framework/Servers/BinaryStreamHandler.cs | 73 - .../Servers/CachedGetAssetStreamHandler.cs | 217 --- OpenSim/Framework/Servers/CheckSumServer.cs | 26 - OpenSim/Framework/Servers/GenericHTTPMethod.cs | 33 - OpenSim/Framework/Servers/GetAssetStreamHandler.cs | 216 --- .../Servers/Interfaces/IHttpAgentHandler.cs | 35 - .../Framework/Servers/Interfaces/IHttpServer.cs | 127 -- .../Framework/Servers/Interfaces/IStreamHandler.cs | 61 - OpenSim/Framework/Servers/LLSDMethod.cs | 34 - OpenSim/Framework/Servers/LLSDMethodString.cs | 33 - OpenSim/Framework/Servers/MessageServerInfo.cs | 48 - OpenSim/Framework/Servers/OSHttpHandler.cs | 183 --- OpenSim/Framework/Servers/OSHttpHttpHandler.cs | 145 -- OpenSim/Framework/Servers/OSHttpRequest.cs | 228 --- OpenSim/Framework/Servers/OSHttpRequestPump.cs | 298 ---- OpenSim/Framework/Servers/OSHttpRequestQueue.cs | 68 - OpenSim/Framework/Servers/OSHttpResponse.cs | 302 ---- OpenSim/Framework/Servers/OSHttpServer.cs | 210 --- OpenSim/Framework/Servers/OSHttpStatusCodes.cs | 170 -- OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs | 180 --- .../Framework/Servers/PostAssetStreamHandler.cs | 72 - .../Framework/Servers/RestDeserialiseHandler.cs | 67 - OpenSim/Framework/Servers/RestHTTPHandler.cs | 56 - OpenSim/Framework/Servers/RestMethod.cs | 32 - OpenSim/Framework/Servers/RestObjectPoster.cs | 84 - .../Framework/Servers/RestObjectPosterResponse.cs | 107 -- OpenSim/Framework/Servers/RestSessionService.cs | 292 ---- OpenSim/Framework/Servers/RestStreamHandler.cs | 61 - .../Servers/SynchronousRestObjectPoster.cs | 83 - OpenSim/Framework/Servers/Tests/OSHttpTests.cs | 393 ----- OpenSim/Framework/Servers/VersionInfo.cs | 53 - OpenSim/Framework/Servers/XmlRpcMethod.cs | 33 - .../AssetInventoryServer/AssetInventoryServer.cs | 1 + .../Plugins/BrowseFrontendPlugin.cs | 1 + .../Plugins/InventoryArchivePlugin.cs | 1 + .../Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs | 1 + .../OpenSim/OpenSimInventoryFrontendPlugin.cs | 1 + .../Plugins/ReferenceFrontendPlugin.cs | 2 +- OpenSim/Grid/AssetInventoryServer/Utils.cs | 1 + OpenSim/Grid/AssetServer/Main.cs | 1 + .../OGS1/OGS1InterServiceInventoryService.cs | 2 +- OpenSim/Grid/Framework/IGridServiceCore.cs | 2 +- OpenSim/Grid/Framework/IGridServiceModule.cs | 2 +- OpenSim/Grid/Framework/XMPPHTTPService.cs | 2 +- .../Grid/GridServer.Modules/GridMessagingModule.cs | 1 + OpenSim/Grid/GridServer.Modules/GridRestModule.cs | 2 +- .../Grid/GridServer.Modules/GridXmlRpcModule.cs | 1 + OpenSim/Grid/GridServer/GridServerBase.cs | 1 + OpenSim/Grid/InventoryServer/Main.cs | 1 + OpenSim/Grid/MessagingServer/Main.cs | 1 + .../UserServer.Modules/GridInfoServiceModule.cs | 1 + .../UserServer.Modules/MessageServersConnector.cs | 1 + OpenSim/Grid/UserServer.Modules/OpenIdService.cs | 2 +- .../Grid/UserServer.Modules/UserDataBaseService.cs | 1 + .../UserServer.Modules/UserLoginAuthService.cs | 1 + .../Grid/UserServer.Modules/UserLoginService.cs | 1 + OpenSim/Grid/UserServer.Modules/UserManager.cs | 1 + .../UserServerAvatarAppearanceModule.cs | 1 + .../UserServer.Modules/UserServerFriendsModule.cs | 3 +- OpenSim/Grid/UserServer/Main.cs | 1 + OpenSim/Grid/UserServer/UserServerCommandModule.cs | 1 + .../UserServer/UserServerEventDispatchModule.cs | 1 + OpenSim/Region/Application/OpenSim.cs | 10 + OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../Region/ClientStack/RegionApplicationBase.cs | 1 + .../Hypergrid/HGCommunicationsGridMode.cs | 1 + .../Hypergrid/HGCommunicationsStandalone.cs | 1 + .../Communications/Hypergrid/HGGridServices.cs | 1 + .../Hypergrid/HGGridServicesGridMode.cs | 2 +- .../Hypergrid/HGGridServicesStandalone.cs | 1 + .../Communications/Hypergrid/HGInventoryService.cs | 1 + .../Communications/Local/CommunicationsLocal.cs | 2 +- .../Communications/OGS1/CommunicationsOGS1.cs | 2 +- .../Region/Communications/OGS1/OGS1GridServices.cs | 2 +- .../Communications/OGS1/OGS1InventoryService.cs | 2 +- .../OGS1/OGS1SecureInventoryService.cs | 2 +- .../Currency/SampleMoney/SampleMoneyModule.cs | 2 +- .../Avatar/InstantMessage/OfflineMessageModule.cs | 1 + .../CoreModules/Avatar/ObjectCaps/ObjectAdd.cs | 1 + .../Framework/EventQueue/EventQueueGetModule.cs | 1 + .../Framework/Services/RegionAssetService.cs | 2 +- .../Framework/Services/RegionMapService.cs | 2 +- .../Hypergrid/HGStandaloneInventoryModule.cs | 2 +- .../Hypergrid/HGStandaloneLoginModule.cs | 2 +- .../Scripting/HttpRequest/ScriptsHttpRequests.cs | 1 + .../CoreModules/Scripting/XMLRPC/XMLRPCModule.cs | 1 + .../CoreModules/World/Land/LandManagementModule.cs | 1 + .../CoreModules/World/WorldMap/WorldMapModule.cs | 1 + OpenSim/Region/DataSnapshot/DataRequestHandler.cs | 1 + .../Region/Framework/Scenes/RegionStatsHandler.cs | 2 +- .../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 1 + .../XmlRpcRouterModule/XmlRpcGridRouterModule.cs | 1 + OpenSim/Region/UserStatistics/WebStatsModule.cs | 1 + .../Tests/Common/Mock/TestCommunicationsManager.cs | 1 + prebuild.xml | 124 +- 127 files changed, 195 insertions(+), 6364 deletions(-) delete mode 100644 OpenSim/Framework/Servers/BaseHTTPHandler.cs delete mode 100644 OpenSim/Framework/Servers/BaseHttpServer.cs delete mode 100644 OpenSim/Framework/Servers/BaseOpenSimServer.cs delete mode 100644 OpenSim/Framework/Servers/BaseRequestHandler.cs delete mode 100644 OpenSim/Framework/Servers/BaseStreamHandler.cs delete mode 100644 OpenSim/Framework/Servers/BinaryStreamHandler.cs delete mode 100644 OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs delete mode 100644 OpenSim/Framework/Servers/CheckSumServer.cs delete mode 100644 OpenSim/Framework/Servers/GenericHTTPMethod.cs delete mode 100644 OpenSim/Framework/Servers/GetAssetStreamHandler.cs delete mode 100644 OpenSim/Framework/Servers/Interfaces/IHttpAgentHandler.cs delete mode 100644 OpenSim/Framework/Servers/Interfaces/IHttpServer.cs delete mode 100644 OpenSim/Framework/Servers/Interfaces/IStreamHandler.cs delete mode 100644 OpenSim/Framework/Servers/LLSDMethod.cs delete mode 100644 OpenSim/Framework/Servers/LLSDMethodString.cs delete mode 100644 OpenSim/Framework/Servers/MessageServerInfo.cs delete mode 100644 OpenSim/Framework/Servers/OSHttpHandler.cs delete mode 100644 OpenSim/Framework/Servers/OSHttpHttpHandler.cs delete mode 100644 OpenSim/Framework/Servers/OSHttpRequest.cs delete mode 100644 OpenSim/Framework/Servers/OSHttpRequestPump.cs delete mode 100644 OpenSim/Framework/Servers/OSHttpRequestQueue.cs delete mode 100644 OpenSim/Framework/Servers/OSHttpResponse.cs delete mode 100644 OpenSim/Framework/Servers/OSHttpServer.cs delete mode 100644 OpenSim/Framework/Servers/OSHttpStatusCodes.cs delete mode 100644 OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs delete mode 100644 OpenSim/Framework/Servers/PostAssetStreamHandler.cs delete mode 100644 OpenSim/Framework/Servers/RestDeserialiseHandler.cs delete mode 100644 OpenSim/Framework/Servers/RestHTTPHandler.cs delete mode 100644 OpenSim/Framework/Servers/RestMethod.cs delete mode 100644 OpenSim/Framework/Servers/RestObjectPoster.cs delete mode 100644 OpenSim/Framework/Servers/RestObjectPosterResponse.cs delete mode 100644 OpenSim/Framework/Servers/RestSessionService.cs delete mode 100644 OpenSim/Framework/Servers/RestStreamHandler.cs delete mode 100644 OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs delete mode 100644 OpenSim/Framework/Servers/Tests/OSHttpTests.cs delete mode 100644 OpenSim/Framework/Servers/VersionInfo.cs delete mode 100644 OpenSim/Framework/Servers/XmlRpcMethod.cs diff --git a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs index 84e5db5..39c0066 100644 --- a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs +++ b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs @@ -36,6 +36,7 @@ using OpenSim.Framework.Communications.Services; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Osp; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Communications.Hypergrid; using OpenSim.Region.Communications.Local; using OpenSim.Region.Communications.OGS1; diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index ecdbb52..e14843b 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -41,6 +41,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.CoreModules.World.Terrain; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/IRestHandler.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/IRestHandler.cs index b27f9c5..510eee7 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/IRestHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/IRestHandler.cs @@ -25,7 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.ApplicationPlugins.Rest.Inventory { diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs index 9a8aef0..0c3cf73 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs @@ -34,6 +34,7 @@ using System.Text.RegularExpressions; using System.Xml; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.ApplicationPlugins.Rest.Inventory { diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs index fad0438..7d9d8a5 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs @@ -31,6 +31,7 @@ using System.Xml; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.ApplicationPlugins.Rest.Inventory { diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs index 043fca8..77c14c6 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs @@ -30,6 +30,7 @@ using System.Xml; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.ApplicationPlugins.Rest.Inventory { diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestFileServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestFileServices.cs index 94a786e..a2f5d45 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestFileServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestFileServices.cs @@ -31,6 +31,7 @@ using System.IO; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.ApplicationPlugins.Rest.Inventory { diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs index 180d6f4..7d539e0 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.ApplicationPlugins.Rest.Inventory { diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index f0d9946..ae242bd 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs @@ -38,6 +38,7 @@ using OpenMetaverse.Imaging; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using Timer=System.Timers.Timer; namespace OpenSim.ApplicationPlugins.Rest.Inventory diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs index 1e87996..b2b11af 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs @@ -30,6 +30,7 @@ using System; using System.Collections.Generic; using System.Reflection; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.ApplicationPlugins.Rest.Inventory { diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs index 8b22c16..3fc7c06 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs @@ -30,6 +30,7 @@ using System.IO; using System.Xml.Serialization; using OpenMetaverse; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs index bd0089c..b49c5e9 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs @@ -30,6 +30,7 @@ using System.IO; using System.Xml.Serialization; using OpenMetaverse; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs index c689daa..4b8bb5c 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs @@ -29,6 +29,7 @@ using System; using System.IO; using OpenMetaverse; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -116,4 +117,4 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions #endregion POST methods } -} \ No newline at end of file +} diff --git a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs index 727ccfe..8af1276 100644 --- a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs +++ b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs @@ -35,7 +35,7 @@ using Nini.Config; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.ApplicationPlugins.Rest { @@ -412,4 +412,4 @@ namespace OpenSim.ApplicationPlugins.Rest #endregion methods } -} \ No newline at end of file +} diff --git a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs index 8d4ac37..00a6d05 100644 --- a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs +++ b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs @@ -38,7 +38,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Capabilities; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index ba41e8c..4c54f33 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -37,6 +37,7 @@ using OpenMetaverse.Imaging; using OpenMetaverse.Packets; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Client.VWoHTTP.ClientStack diff --git a/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs b/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs index 8f7fc1b..b1596be 100644 --- a/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs +++ b/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs @@ -32,7 +32,7 @@ using Nini.Config; using OpenMetaverse; using OpenSim.Client.VWoHTTP.ClientStack; using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs index 6e4dd1c..1e2e286 100644 --- a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs @@ -38,7 +38,7 @@ using System.Security.Cryptography; using System.Text; using System.Xml.Serialization; using log4net; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Framework.Communications.Cache { diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs index c7d4c99..aec039f 100644 --- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs @@ -30,7 +30,7 @@ using System.IO; using System.Reflection; using System.Xml.Serialization; using log4net; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Framework.Communications.Cache { diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index a2e8042..73aa819 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -33,7 +33,7 @@ using System.Reflection; using log4net; using OpenMetaverse; using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; // using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs index b47d014..55778d7 100644 --- a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs +++ b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs @@ -28,7 +28,7 @@ using System.Collections; using System.Collections.Generic; using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Framework.Communications.Capabilities { @@ -168,4 +168,4 @@ namespace OpenSim.Framework.Communications.Capabilities } } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs index 906f5d5..4f49fb4 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs @@ -29,6 +29,7 @@ using System.Collections; using System.IO; using System.Text; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Framework.Communications.Capabilities { diff --git a/OpenSim/Framework/Communications/Clients/InventoryClient.cs b/OpenSim/Framework/Communications/Clients/InventoryClient.cs index 8fe4268..e4f5e2a 100644 --- a/OpenSim/Framework/Communications/Clients/InventoryClient.cs +++ b/OpenSim/Framework/Communications/Clients/InventoryClient.cs @@ -28,6 +28,7 @@ using System; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenMetaverse; diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 1df1f48..b49e7bc 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using OpenMetaverse; using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Framework.Communications { diff --git a/OpenSim/Framework/Communications/Services/GridInfoService.cs b/OpenSim/Framework/Communications/Services/GridInfoService.cs index e53400c..f17bb9f 100644 --- a/OpenSim/Framework/Communications/Services/GridInfoService.cs +++ b/OpenSim/Framework/Communications/Services/GridInfoService.cs @@ -33,7 +33,7 @@ using System.Text; using log4net; using Nini.Config; using Nwc.XmlRpc; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Framework.Communications.Services { diff --git a/OpenSim/Framework/Communications/Services/HGInventoryService.cs b/OpenSim/Framework/Communications/Services/HGInventoryService.cs index a3234bf..77a6177 100644 --- a/OpenSim/Framework/Communications/Services/HGInventoryService.cs +++ b/OpenSim/Framework/Communications/Services/HGInventoryService.cs @@ -39,7 +39,7 @@ using OpenSim.Framework.Communications.Cache; using Caps = OpenSim.Framework.Communications.Capabilities.Caps; using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers; using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; using OpenMetaverse.StructuredData; diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 19c3ab1..ea46afd 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -32,7 +32,7 @@ using System.Reflection; using System.Text; using System.Threading; using Nini.Config; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; using log4net; namespace OpenSim.Framework.Console diff --git a/OpenSim/Framework/Servers/BaseHTTPHandler.cs b/OpenSim/Framework/Servers/BaseHTTPHandler.cs deleted file mode 100644 index 2aa37fb..0000000 --- a/OpenSim/Framework/Servers/BaseHTTPHandler.cs +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 OpenSim 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.Collections; - -namespace OpenSim.Framework.Servers -{ - public abstract class BaseHTTPHandler : BaseRequestHandler, IGenericHTTPHandler - { - public abstract Hashtable Handle(string path, Hashtable Request); - - protected BaseHTTPHandler(string httpMethod, string path) - : base(httpMethod, path) - { - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs deleted file mode 100644 index 121b8a8..0000000 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ /dev/null @@ -1,1626 +0,0 @@ -/* - * 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 OpenSim 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.IO; -using System.Net; -using System.Net.Sockets; -using System.Reflection; -using System.Text; -using System.Threading; -using System.Xml; -using HttpServer; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse.StructuredData; -using CoolHTTPListener = HttpServer.HttpListener; -using HttpListener=System.Net.HttpListener; -using OpenSim.Framework.Servers.Interfaces; - -namespace OpenSim.Framework.Servers -{ - public class BaseHttpServer : IHttpServer - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); - - private volatile int NotSocketErrors = 0; - public volatile bool HTTPDRunning = false; - - protected Thread m_workerThread; - // protected HttpListener m_httpListener; - protected CoolHTTPListener m_httpListener2; - protected Dictionary m_rpcHandlers = new Dictionary(); - protected Dictionary m_rpcHandlersKeepAlive = new Dictionary(); - protected DefaultLLSDMethod m_defaultLlsdHandler = null; // <-- Moving away from the monolithic.. and going to /registered/ - protected Dictionary m_llsdHandlers = new Dictionary(); - protected Dictionary m_streamHandlers = new Dictionary(); - protected Dictionary m_HTTPHandlers = new Dictionary(); - protected Dictionary m_agentHandlers = new Dictionary(); - - protected uint m_port; - protected uint m_sslport; - protected bool m_ssl; - protected bool m_firstcaps = true; - protected string m_SSLCommonName = ""; - - public uint SSLPort - { - get { return m_sslport; } - } - - public string SSLCommonName - { - get { return m_SSLCommonName; } - } - - public uint Port - { - get { return m_port; } - } - - public bool UseSSL - { - get { return m_ssl; } - } - - public BaseHttpServer(uint port) - { - m_port = port; - } - - public BaseHttpServer(uint port, bool ssl) : this (port) - { - m_ssl = ssl; - } - - public BaseHttpServer(uint port, bool ssl, uint sslport, string CN) : this (port, ssl) - { - if (m_ssl) - { - m_sslport = sslport; - } - } - - /// - /// Add a stream handler to the http server. If the handler already exists, then nothing happens. - /// - /// - public void AddStreamHandler(IRequestHandler handler) - { - string httpMethod = handler.HttpMethod; - string path = handler.Path; - string handlerKey = GetHandlerKey(httpMethod, path); - - lock (m_streamHandlers) - { - if (!m_streamHandlers.ContainsKey(handlerKey)) - { - // m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey); - m_streamHandlers.Add(handlerKey, handler); - } - } - } - - private static string GetHandlerKey(string httpMethod, string path) - { - return httpMethod + ":" + path; - } - - public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) - { - return AddXmlRPCHandler(method, handler, true); - } - - public bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive) - { - lock (m_rpcHandlers) - { - m_rpcHandlers[method] = handler; - m_rpcHandlersKeepAlive[method] = keepAlive; // default - } - - return true; - } - - public XmlRpcMethod GetXmlRPCHandler(string method) - { - lock (m_rpcHandlers) - { - if (m_rpcHandlers.ContainsKey(method)) - { - return m_rpcHandlers[method]; - } - else - { - return null; - } - } - } - - public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) - { - //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); - - lock (m_HTTPHandlers) - { - if (!m_HTTPHandlers.ContainsKey(methodName)) - { - m_HTTPHandlers.Add(methodName, handler); - return true; - } - } - - //must already have a handler for that path so return false - return false; - } - - // Note that the agent string is provided simply to differentiate - // the handlers - it is NOT required to be an actual agent header - // value. - public bool AddAgentHandler(string agent, IHttpAgentHandler handler) - { - lock (m_agentHandlers) - { - if (!m_agentHandlers.ContainsKey(agent)) - { - m_agentHandlers.Add(agent, handler); - return true; - } - } - - //must already have a handler for that path so return false - return false; - } - - public bool AddLLSDHandler(string path, LLSDMethod handler) - { - lock (m_llsdHandlers) - { - if (!m_llsdHandlers.ContainsKey(path)) - { - m_llsdHandlers.Add(path, handler); - return true; - } - } - return false; - } - - public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler) - { - m_defaultLlsdHandler = handler; - return true; - } - - public void OnHandleRequestIOThread(IHttpClientContext context, IHttpRequest request) - { - OSHttpRequest req = new OSHttpRequest(context, request); - OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request)); - //resp.KeepAlive = req.KeepAlive; - //m_log.Info("[Debug BASE HTTP SERVER]: Got Request"); - //HttpServerContextObj objstate= new HttpServerContextObj(req,resp); - //ThreadPool.QueueUserWorkItem(new WaitCallback(ConvertIHttpClientContextToOSHttp), (object)objstate); - HandleRequest(req, resp); - } - - public void ConvertIHttpClientContextToOSHttp(object stateinfo) - { - HttpServerContextObj objstate = (HttpServerContextObj)stateinfo; - //OSHttpRequest request = new OSHttpRequest(objstate.context,objstate.req); - //OSHttpResponse resp = new OSHttpResponse(new HttpServer.HttpResponse(objstate.context, objstate.req)); - - OSHttpRequest request = objstate.oreq; - OSHttpResponse resp = objstate.oresp; - //OSHttpResponse resp = new OSHttpResponse(new HttpServer.HttpResponse(objstate.context, objstate.req)); - - /* - request.AcceptTypes = objstate.req.AcceptTypes; - request.ContentLength = (long)objstate.req.ContentLength; - request.Headers = objstate.req.Headers; - request.HttpMethod = objstate.req.Method; - request.InputStream = objstate.req.Body; - foreach (string str in request.Headers) - { - if (str.ToLower().Contains("content-type: ")) - { - request.ContentType = str.Substring(13, str.Length - 13); - break; - } - } - //request.KeepAlive = objstate.req. - foreach (HttpServer.HttpInput httpinput in objstate.req.QueryString) - { - request.QueryString.Add(httpinput.Name, httpinput[httpinput.Name]); - } - - //request.Query = objstate.req.//objstate.req.QueryString; - //foreach ( - //request.QueryString = objstate.req.QueryString; - - */ - HandleRequest(request,resp); - } - - public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) - { - try - { - Culture.SetCurrentCulture(); - // This is the REST agent interface. We require an agent to properly identify - // itself. If the REST handler recognizes the prefix it will attempt to - // satisfy the request. If it is not recognizable, and no damage has occurred - // the request can be passed through to the other handlers. This is a low - // probability event; if a request is matched it is normally expected to be - // handled - //m_log.Debug("[BASE HTTP SERVER]: Handling Request" + request.RawUrl); - IHttpAgentHandler agentHandler; - - if (TryGetAgentHandler(request, response, out agentHandler)) - { - if (HandleAgentRequest(agentHandler, request, response)) - { - return; - } - } - - IRequestHandler requestHandler; - //response.KeepAlive = true; - response.SendChunked = false; - - string path = request.RawUrl; - string handlerKey = GetHandlerKey(request.HttpMethod, path); - - //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); - - if (TryGetStreamHandler(handlerKey, out requestHandler)) - { - //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); - // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. - byte[] buffer; - - response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. - - if (requestHandler is IStreamedRequestHandler) - { - IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; - - buffer = streamedRequestHandler.Handle(path, request.InputStream, request, response); - } - else if (requestHandler is IGenericHTTPHandler) - { - //m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); - IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; - Stream requestStream = request.InputStream; - - Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); - - string requestBody = reader.ReadToEnd(); - - reader.Close(); - requestStream.Close(); - - Hashtable keysvals = new Hashtable(); - Hashtable headervals = new Hashtable(); - //string host = String.Empty; - - string[] querystringkeys = request.QueryString.AllKeys; - string[] rHeaders = request.Headers.AllKeys; - - - foreach (string queryname in querystringkeys) - { - keysvals.Add(queryname, request.QueryString[queryname]); - } - - foreach (string headername in rHeaders) - { - //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); - headervals[headername] = request.Headers[headername]; - } - - // if (headervals.Contains("Host")) - // { - // host = (string)headervals["Host"]; - // } - - keysvals.Add("requestbody", requestBody); - if (keysvals.Contains("method")) - { - //m_log.Warn("[HTTP]: Contains Method"); - //string method = (string)keysvals["method"]; - //m_log.Warn("[HTTP]: " + requestBody); - - } - DoHTTPGruntWork(HTTPRequestHandler.Handle(path, keysvals), response); - return; - } - else - { - IStreamHandler streamHandler = (IStreamHandler)requestHandler; - - using (MemoryStream memoryStream = new MemoryStream()) - { - streamHandler.Handle(path, request.InputStream, memoryStream, request, response); - memoryStream.Flush(); - buffer = memoryStream.ToArray(); - } - } - - request.InputStream.Close(); - - if (!response.SendChunked) - response.ContentLength64 = buffer.LongLength; - - try - { - response.OutputStream.Write(buffer, 0, buffer.Length); - //response.OutputStream.Close(); - } - catch (HttpListenerException) - { - m_log.WarnFormat("[BASE HTTP SERVER]: HTTP request abnormally terminated."); - } - //response.OutputStream.Close(); - try - { - response.Send(); - } - catch (SocketException e) - { - // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); - } - return; - } - - if (request.AcceptTypes != null && request.AcceptTypes.Length > 0) - { - foreach (string strAccept in request.AcceptTypes) - { - if (strAccept.Contains("application/llsd+xml")) - { - //m_log.Info("[Debug BASE HTTP SERVER]: Found an application/llsd+xml accept header"); - HandleLLSDRequests(request, response); - return; - } - } - } - - switch (request.ContentType) - { - case null: - case "text/html": - //m_log.Info("[Debug BASE HTTP SERVER]: found a text/html content type"); - HandleHTTPRequest(request, response); - return; - - case "application/llsd+xml": - case "application/xml+llsd": - //m_log.Info("[Debug BASE HTTP SERVER]: found a application/llsd+xml content type"); - HandleLLSDRequests(request, response); - return; - - case "text/xml": - case "application/xml": - default: - //m_log.Info("[Debug BASE HTTP SERVER]: in default handler"); - // Point of note.. the DoWeHaveA methods check for an EXACT path - // if (request.RawUrl.Contains("/CAPS/EQG")) - // { - // int i = 1; - // } - //m_log.Info("[Debug BASE HTTP SERVER]: Checking for LLSD Handler"); - if (DoWeHaveALLSDHandler(request.RawUrl)) - { - //m_log.Info("[Debug BASE HTTP SERVER]: Found LLSD Handler"); - HandleLLSDRequests(request, response); - return; - } - //m_log.Info("[Debug BASE HTTP SERVER]: Checking for HTTP Handler"); - if (DoWeHaveAHTTPHandler(request.RawUrl)) - { - //m_log.Info("[Debug BASE HTTP SERVER]: found HTTP Handler"); - HandleHTTPRequest(request, response); - return; - } - - //m_log.Info("[Debug BASE HTTP SERVER]: Generic XMLRPC"); - // generic login request. - HandleXmlRpcRequests(request, response); - - return; - } - } - catch (SocketException e) - { - // At least on linux, it appears that if the client makes a request without requiring the response, - // an unconnected socket exception is thrown when we close the response output stream. There's no - // obvious way to tell if the client didn't require the response, so instead we'll catch and ignore - // the exception instead. - // - // An alternative may be to turn off all response write exceptions on the HttpListener, but let's go - // with the minimum first - m_log.WarnFormat("[BASE HTTP SERVER]: HandleRequest threw {0}.\nNOTE: this may be spurious on Linux", e); - } - catch (EndOfStreamException e) - { - m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e); - } - catch (InvalidOperationException e) - { - m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e); - SendHTML500(response); - } - } - - private bool TryGetStreamHandler(string handlerKey, out IRequestHandler streamHandler) - { - string bestMatch = null; - - lock (m_streamHandlers) - { - foreach (string pattern in m_streamHandlers.Keys) - { - if (handlerKey.StartsWith(pattern)) - { - if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length) - { - bestMatch = pattern; - } - } - } - - if (String.IsNullOrEmpty(bestMatch)) - { - streamHandler = null; - return false; - } - else - { - streamHandler = m_streamHandlers[bestMatch]; - return true; - } - } - } - - private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler) - { - //m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey); - - string bestMatch = null; - - lock (m_HTTPHandlers) - { - foreach (string pattern in m_HTTPHandlers.Keys) - { - if (handlerKey.StartsWith(pattern)) - { - if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length) - { - bestMatch = pattern; - } - } - } - - if (String.IsNullOrEmpty(bestMatch)) - { - HTTPHandler = null; - return false; - } - else - { - HTTPHandler = m_HTTPHandlers[bestMatch]; - return true; - } - } - } - - private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) - { - agentHandler = null; - try - { - foreach (IHttpAgentHandler handler in m_agentHandlers.Values) - { - if (handler.Match(request, response)) - { - agentHandler = handler; - return true; - } - } - } - catch(KeyNotFoundException) - { - } - - return false; - } - - /// - /// Try all the registered xmlrpc handlers when an xmlrpc request is received. - /// Sends back an XMLRPC unknown request response if no handler is registered for the requested method. - /// - /// - /// - private void HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response) - { - Stream requestStream = request.InputStream; - - Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); - - string requestBody = reader.ReadToEnd(); - reader.Close(); - requestStream.Close(); - - string responseString = String.Empty; - XmlRpcRequest xmlRprcRequest = null; - - try - { - xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody); - } - catch (XmlException) - { - } - - if (xmlRprcRequest != null) - { - string methodName = xmlRprcRequest.MethodName; - if (methodName != null) - { - xmlRprcRequest.Params.Add(request.RemoteIPEndPoint); // Param[1] - XmlRpcResponse xmlRpcResponse; - - XmlRpcMethod method; - bool methodWasFound; - lock (m_rpcHandlers) - { - methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method); - } - - if (methodWasFound) - { - xmlRprcRequest.Params.Add(request.Url); // Param[2] - - try - { - xmlRpcResponse = method(xmlRprcRequest); - } - catch(Exception e) - { - // if the registered XmlRpc method threw an exception, we pass a fault-code along - xmlRpcResponse = new XmlRpcResponse(); - // Code probably set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php - xmlRpcResponse.SetFault(-32603, String.Format("Requested method [{0}] threw exception: {1}", - methodName, e.Message)); - } - // if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here - response.KeepAlive = m_rpcHandlersKeepAlive[methodName]; - } - else - { - xmlRpcResponse = new XmlRpcResponse(); - // Code set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php - xmlRpcResponse.SetFault(-32601, String.Format("Requested method [{0}] not found", methodName)); - } - - responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); - } - else - { - //HandleLLSDRequests(request, response); - response.ContentType = "text/plain"; - response.StatusCode = 404; - response.StatusDescription = "Not Found"; - response.ProtocolVersion = "HTTP/1.0"; - byte[] buf = Encoding.UTF8.GetBytes("Not found"); - response.KeepAlive = false; - - m_log.ErrorFormat("[BASE HTTP SERVER] Handler not found for http request {0}", request.RawUrl); - - response.SendChunked = false; - response.ContentLength64 = buf.Length; - response.ContentEncoding = Encoding.UTF8; - try - { - response.OutputStream.Write(buf, 0, buf.Length); - } - catch (Exception ex) - { - m_log.Warn("[HTTPD]: Error - " + ex.Message); - } - finally - { - try - { - response.Send(); - } - catch (SocketException e) - { - // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); - } - } - return; - //responseString = "Error"; - } - } - - response.ContentType = "text/xml"; - - byte[] buffer = Encoding.UTF8.GetBytes(responseString); - - response.SendChunked = false; - response.ContentLength64 = buffer.Length; - response.ContentEncoding = Encoding.UTF8; - try - { - response.OutputStream.Write(buffer, 0, buffer.Length); - } - catch (Exception ex) - { - m_log.Warn("[HTTPD]: Error - " + ex.Message); - } - finally - { - try - { - response.Send(); - } - catch (SocketException e) - { - // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); - } - } - } - - private void HandleLLSDRequests(OSHttpRequest request, OSHttpResponse response) - { - //m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request"); - Stream requestStream = request.InputStream; - - Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); - - string requestBody = reader.ReadToEnd(); - reader.Close(); - requestStream.Close(); - - //m_log.DebugFormat("[OGP]: {0}:{1}", request.RawUrl, requestBody); - response.KeepAlive = true; - - OSD llsdRequest = null; - OSD llsdResponse = null; - - bool LegacyLLSDLoginLibOMV = (requestBody.Contains("passwd") && requestBody.Contains("mac") && requestBody.Contains("viewer_digest")); - - if (requestBody.Length == 0) - // Get Request - { - requestBody = "requestget"; - } - try - { - llsdRequest = OSDParser.DeserializeLLSDXml(requestBody); - } - catch (Exception ex) - { - m_log.Warn("[HTTPD]: Error - " + ex.Message); - } - - if (llsdRequest != null)// && m_defaultLlsdHandler != null) - { - - LLSDMethod llsdhandler = null; - - if (TryGetLLSDHandler(request.RawUrl, out llsdhandler) && !LegacyLLSDLoginLibOMV) - { - // we found a registered llsd handler to service this request - llsdResponse = llsdhandler(request.RawUrl, llsdRequest, request.RemoteIPEndPoint.ToString()); - } - else - { - // we didn't find a registered llsd handler to service this request - // check if we have a default llsd handler - - if (m_defaultLlsdHandler != null) - { - // LibOMV path - llsdResponse = m_defaultLlsdHandler(llsdRequest); - } - else - { - // Oops, no handler for this.. give em the failed message - llsdResponse = GenerateNoLLSDHandlerResponse(); - } - } - - } - else - { - llsdResponse = GenerateNoLLSDHandlerResponse(); - } - byte[] buffer = new byte[0]; - if (llsdResponse.ToString() == "shutdown404!") - { - response.ContentType = "text/plain"; - response.StatusCode = 404; - response.StatusDescription = "Not Found"; - response.ProtocolVersion = "HTTP/1.0"; - buffer = Encoding.UTF8.GetBytes("Not found"); - } - else - { - response.ContentType = "application/llsd+xml"; - //m_log.Info("[Debug BASE HTTP SERVER]: Response: " + llsdResponse.ToString()); - buffer = OSDParser.SerializeLLSDXmlBytes(llsdResponse); - } - response.SendChunked = false; - response.ContentLength64 = buffer.Length; - response.ContentEncoding = Encoding.UTF8; - response.KeepAlive = true; - - try - { - response.OutputStream.Write(buffer, 0, buffer.Length); - } - catch (Exception ex) - { - m_log.Warn("[HTTPD]: Error - " + ex.Message); - } - finally - { - //response.OutputStream.Close(); - try - { - response.Send(); - response.OutputStream.Flush(); - response.OutputStream.Close(); - } - catch (IOException e) - { - m_log.DebugFormat("[BASE HTTP SERVER] LLSD IOException {0}.", e); - } - catch (SocketException e) - { - // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] LLSD issue {0}.\nNOTE: this may be spurious on Linux.", e); - } - } - } - - /// - /// Checks if we have an Exact path in the LLSD handlers for the path provided - /// - /// URI of the request - /// true if we have one, false if not - private bool DoWeHaveALLSDHandler(string path) - { - - string[] pathbase = path.Split('/'); - string searchquery = "/"; - - if (pathbase.Length < 1) - return false; - - for (int i = 1; i < pathbase.Length; i++) - { - searchquery += pathbase[i]; - if (pathbase.Length - 1 != i) - searchquery += "/"; - } - - string bestMatch = null; - - foreach (string pattern in m_llsdHandlers.Keys) - { - - if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length) - { - - bestMatch = pattern; - - } - } - - // extra kicker to remove the default XMLRPC login case.. just in case.. - if (path != "/" && bestMatch == "/" && searchquery != "/") - return false; - - if (path == "/") - return false; - - if (String.IsNullOrEmpty(bestMatch)) - { - - return false; - } - else - { - - return true; - } - } - - /// - /// Checks if we have an Exact path in the HTTP handlers for the path provided - /// - /// URI of the request - /// true if we have one, false if not - private bool DoWeHaveAHTTPHandler(string path) - { - string[] pathbase = path.Split('/'); - string searchquery = "/"; - - if (pathbase.Length < 1) - return false; - - for (int i = 1; i < pathbase.Length; i++) - { - searchquery += pathbase[i]; - if (pathbase.Length - 1 != i) - searchquery += "/"; - } - - string bestMatch = null; - - //m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery); - - lock (m_HTTPHandlers) - { - foreach (string pattern in m_HTTPHandlers.Keys) - { - if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length) - { - bestMatch = pattern; - } - } - - // extra kicker to remove the default XMLRPC login case.. just in case.. - if (path == "/") - return false; - - if (String.IsNullOrEmpty(bestMatch)) - { - return false; - } - else - { - return true; - } - } - } - - private bool TryGetLLSDHandler(string path, out LLSDMethod llsdHandler) - { - llsdHandler = null; - // Pull out the first part of the path - // splitting the path by '/' means we'll get the following return.. - // {0}/{1}/{2} - // where {0} isn't something we really control 100% - - string[] pathbase = path.Split('/'); - string searchquery = "/"; - - if (pathbase.Length < 1) - return false; - - for (int i=1; i bestMatch.Length) - { - // You have to specifically register for '/' and to get it, you must specificaly request it - // - if (pattern == "/" && searchquery == "/" || pattern != "/") - bestMatch = pattern; - } - } - } - - if (String.IsNullOrEmpty(bestMatch)) - { - llsdHandler = null; - return false; - } - else - { - llsdHandler = m_llsdHandlers[bestMatch]; - return true; - } - } - - private OSDMap GenerateNoLLSDHandlerResponse() - { - OSDMap map = new OSDMap(); - map["reason"] = OSD.FromString("LLSDRequest"); - map["message"] = OSD.FromString("No handler registered for LLSD Requests"); - map["login"] = OSD.FromString("false"); - return map; - } - /// - /// A specific agent handler was provided. Such a handler is expecetd to have an - /// intimate, and highly specific relationship with the client. Consequently, - /// nothing is done here. - /// - /// - /// - /// - - private bool HandleAgentRequest(IHttpAgentHandler handler, OSHttpRequest request, OSHttpResponse response) - { - // In the case of REST, then handler is responsible for ALL aspects of - // the request/response handling. Nothing is done here, not even encoding. - - try - { - return handler.Handle(request, response); - } - catch (Exception e) - { - // If the handler did in fact close the stream, then this will blow - // chunks. So that that doesn't disturb anybody we throw away any - // and all exceptions raised. We've done our best to release the - // client. - try - { - m_log.Warn("[HTTP-AGENT]: Error - " + e.Message); - response.SendChunked = false; - response.KeepAlive = true; - response.StatusCode = (int)OSHttpStatusCode.ServerErrorInternalError; - //response.OutputStream.Close(); - try - { - response.Send(); - } - catch (SocketException f) - { - // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat( - "[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", f); - } - } - catch(Exception) - { - } - } - - // Indicate that the request has been "handled" - - return true; - - } - - public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) - { - switch (request.HttpMethod) - { - case "OPTIONS": - response.StatusCode = (int)OSHttpStatusCode.SuccessOk; - return; - - default: - HandleContentVerbs(request, response); - return; - } - } - - private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response) - { - // This is a test. There's a workable alternative.. as this way sucks. - // We'd like to put this into a text file parhaps that's easily editable. - // - // For this test to work, I used the following secondlife.exe parameters - // "C:\Program Files\SecondLifeWindLight\SecondLifeWindLight.exe" -settings settings_windlight.xml -channel "Second Life WindLight" -set SystemLanguage en-us -loginpage http://10.1.1.2:8002/?show_login_form=TRUE -loginuri http://10.1.1.2:8002 -user 10.1.1.2 - // - // Even after all that, there's still an error, but it's a start. - // - // I depend on show_login_form being in the secondlife.exe parameters to figure out - // to display the form, or process it. - // a better way would be nifty. - - Stream requestStream = request.InputStream; - - Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); - - string requestBody = reader.ReadToEnd(); - // avoid warning for now - reader.ReadToEnd(); - reader.Close(); - requestStream.Close(); - - Hashtable keysvals = new Hashtable(); - Hashtable headervals = new Hashtable(); - - Hashtable requestVars = new Hashtable(); - - string host = String.Empty; - - string[] querystringkeys = request.QueryString.AllKeys; - string[] rHeaders = request.Headers.AllKeys; - - keysvals.Add("body", requestBody); - keysvals.Add("uri", request.RawUrl); - keysvals.Add("content-type", request.ContentType); - keysvals.Add("http-method", request.HttpMethod); - - foreach (string queryname in querystringkeys) - { - keysvals.Add(queryname, request.QueryString[queryname]); - requestVars.Add(queryname, keysvals[queryname]); - } - - foreach (string headername in rHeaders) - { - //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); - headervals[headername] = request.Headers[headername]; - } - - if (headervals.Contains("Host")) - { - host = (string)headervals["Host"]; - } - - keysvals.Add("headers",headervals); - keysvals.Add("querystringkeys", querystringkeys); - keysvals.Add("requestvars", requestVars); - - if (keysvals.Contains("method")) - { - //m_log.Warn("[HTTP]: Contains Method"); - string method = (string) keysvals["method"]; - //m_log.Warn("[HTTP]: " + requestBody); - GenericHTTPMethod requestprocessor; - bool foundHandler = TryGetHTTPHandler(method, out requestprocessor); - if (foundHandler) - { - Hashtable responsedata1 = requestprocessor(keysvals); - DoHTTPGruntWork(responsedata1,response); - - //SendHTML500(response); - } - else - { - //m_log.Warn("[HTTP]: Handler Not Found"); - SendHTML404(response, host); - } - } - else - { - - GenericHTTPMethod requestprocessor; - bool foundHandler = TryGetHTTPHandlerPathBased(request.RawUrl, out requestprocessor); - if (foundHandler) - { - Hashtable responsedata2 = requestprocessor(keysvals); - DoHTTPGruntWork(responsedata2, response); - - //SendHTML500(response); - } - else - { - //m_log.Warn("[HTTP]: Handler Not Found"); - SendHTML404(response, host); - } - } - } - - private bool TryGetHTTPHandlerPathBased(string path, out GenericHTTPMethod httpHandler) - { - httpHandler = null; - // Pull out the first part of the path - // splitting the path by '/' means we'll get the following return.. - // {0}/{1}/{2} - // where {0} isn't something we really control 100% - - string[] pathbase = path.Split('/'); - string searchquery = "/"; - - if (pathbase.Length < 1) - return false; - - for (int i = 1; i < pathbase.Length; i++) - { - searchquery += pathbase[i]; - if (pathbase.Length - 1 != i) - searchquery += "/"; - } - - // while the matching algorithm below doesn't require it, we're expecting a query in the form - // - // [] = optional - // /resource/UUID/action[/action] - // - // now try to get the closest match to the reigstered path - // at least for OGP, registered path would probably only consist of the /resource/ - - string bestMatch = null; - -// m_log.DebugFormat( -// "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery); - - lock (m_HTTPHandlers) - { - foreach (string pattern in m_HTTPHandlers.Keys) - { - if (searchquery.ToLower().StartsWith(pattern.ToLower())) - { - if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length) - { - // You have to specifically register for '/' and to get it, you must specificaly request it - // - if (pattern == "/" && searchquery == "/" || pattern != "/") - bestMatch = pattern; - } - } - } - - if (String.IsNullOrEmpty(bestMatch)) - { - httpHandler = null; - return false; - } - else - { - if (bestMatch == "/" && searchquery != "/") - return false; - - httpHandler = m_HTTPHandlers[bestMatch]; - return true; - } - } - } - - private static void DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) - { - //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); - int responsecode = (int)responsedata["int_response_code"]; - string responseString = (string)responsedata["str_response_string"]; - string contentType = (string)responsedata["content_type"]; - - if (responsedata.ContainsKey("error_status_text")) - { - response.StatusDescription = (string)responsedata["error_status_text"]; - } - if (responsedata.ContainsKey("http_protocol_version")) - { - response.ProtocolVersion = (string)responsedata["http_protocol_version"]; - } - - if (responsedata.ContainsKey("keepalive")) - { - bool keepalive = (bool)responsedata["keepalive"]; - response.KeepAlive = keepalive; - - } - //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this - //and should check for NullReferenceExceptions - - if (string.IsNullOrEmpty(contentType)) - { - contentType = "text/html"; - } - - // The client ignores anything but 200 here for web login, so ensure that this is 200 for that - - response.StatusCode = responsecode; - - if (responsecode == (int)OSHttpStatusCode.RedirectMovedPermanently) - { - response.RedirectLocation = (string)responsedata["str_redirect_location"]; - response.StatusCode = responsecode; - } - - response.AddHeader("Content-Type", contentType); - - byte[] buffer; - - if (!(contentType.Contains("image") - || contentType.Contains("x-shockwave-flash") - || contentType.Contains("application/x-oar"))) - { - // Text - buffer = Encoding.UTF8.GetBytes(responseString); - } - else - { - // Binary! - buffer = Convert.FromBase64String(responseString); - } - - response.SendChunked = false; - response.ContentLength64 = buffer.Length; - response.ContentEncoding = Encoding.UTF8; - - try - { - response.OutputStream.Write(buffer, 0, buffer.Length); - } - catch (Exception ex) - { - m_log.Warn("[HTTPD]: Error - " + ex.Message); - } - finally - { - //response.OutputStream.Close(); - try - { - response.Send(); - } - catch (SocketException e) - { - // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); - } - } - } - - public void SendHTML404(OSHttpResponse response, string host) - { - // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s - response.StatusCode = 404; - response.AddHeader("Content-type", "text/html"); - - string responseString = GetHTTP404(host); - byte[] buffer = Encoding.UTF8.GetBytes(responseString); - - response.SendChunked = false; - response.ContentLength64 = buffer.Length; - response.ContentEncoding = Encoding.UTF8; - - try - { - response.OutputStream.Write(buffer, 0, buffer.Length); - } - catch (Exception ex) - { - m_log.Warn("[HTTPD]: Error - " + ex.Message); - } - finally - { - //response.OutputStream.Close(); - try - { - response.Send(); - } - catch (SocketException e) - { - // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); - } - } - } - - public void SendHTML500(OSHttpResponse response) - { - // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s - response.StatusCode = (int)OSHttpStatusCode.SuccessOk; - response.AddHeader("Content-type", "text/html"); - - string responseString = GetHTTP500(); - byte[] buffer = Encoding.UTF8.GetBytes(responseString); - - response.SendChunked = false; - response.ContentLength64 = buffer.Length; - response.ContentEncoding = Encoding.UTF8; - try - { - response.OutputStream.Write(buffer, 0, buffer.Length); - } - catch (Exception ex) - { - m_log.Warn("[HTTPD]: Error - " + ex.Message); - } - finally - { - //response.OutputStream.Close(); - try - { - response.Send(); - } - catch (SocketException e) - { - // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); - } - } - } - - public void Start() - { - m_log.Info("[HTTPD]: Starting up HTTP Server"); - - //m_workerThread = new Thread(new ThreadStart(StartHTTP)); - //m_workerThread.Name = "HttpThread"; - //m_workerThread.IsBackground = true; - //m_workerThread.Start(); - //ThreadTracker.Add(m_workerThread); - StartHTTP(); - } - - private void StartHTTP() - { - try - { - m_log.Info("[HTTPD]: Spawned main thread OK"); - //m_httpListener = new HttpListener(); - NotSocketErrors = 0; - if (!m_ssl) - { - //m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); - //m_httpListener.Prefixes.Add("http://10.1.1.5:" + m_port + "/"); - m_httpListener2 = new CoolHTTPListener(IPAddress.Any, (int)m_port); - m_httpListener2.ExceptionThrown += httpServerException; - m_httpListener2.LogWriter = httpserverlog; - - // Uncomment this line in addition to those in HttpServerLogWriter - // if you want more detailed trace information from the HttpServer - //m_httpListener2.UseTraceLogs = true; - - m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor; - } - else - { - //m_httpListener.Prefixes.Add("https://+:" + (m_sslport) + "/"); - //m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); - } - - m_httpListener2.RequestHandler += OnHandleRequestIOThread; - //m_httpListener.Start(); - m_httpListener2.Start(64); - HTTPDRunning = true; - - //HttpListenerContext context; - //while (true) - //{ - // context = m_httpListener.GetContext(); - // ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); - // } - } - catch (Exception e) - { - m_log.Error("[HTTPD]: Error - " + e.Message); - m_log.Error("[HTTPD]: Tip: Do you have permission to listen on port " + m_port + ", " + m_sslport + "?"); - - // We want this exception to halt the entire server since in current configurations we aren't too - // useful without inbound HTTP. - throw e; - } - } - - public void httpServerDisconnectMonitor(IHttpClientContext source, SocketError err) - { - switch (err) - { - case SocketError.NotSocket: - NotSocketErrors++; - - break; - } - } - - public void httpServerException(object source, Exception exception) - { - m_log.ErrorFormat("[HTTPSERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); - /* - if (HTTPDRunning)// && NotSocketErrors > 5) - { - Stop(); - Thread.Sleep(200); - StartHTTP(); - m_log.Warn("[HTTPSERVER]: Died. Trying to kick....."); - } - */ - } - - public void Stop() - { - HTTPDRunning = false; - m_httpListener2.ExceptionThrown -= httpServerException; - m_httpListener2.DisconnectHandler = null; - - m_httpListener2.LogWriter = null; - m_httpListener2.RequestHandler -= OnHandleRequestIOThread; - - m_httpListener2.Stop(); - } - - public void RemoveStreamHandler(string httpMethod, string path) - { - string handlerKey = GetHandlerKey(httpMethod, path); - - //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey); - - lock (m_streamHandlers) m_streamHandlers.Remove(handlerKey); - } - - public void RemoveHTTPHandler(string httpMethod, string path) - { - lock (m_HTTPHandlers) - { - if (httpMethod != null && httpMethod.Length == 0) - { - m_HTTPHandlers.Remove(path); - return; - } - - m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path)); - } - } - - public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) - { - try - { - if (handler == m_agentHandlers[agent]) - { - m_agentHandlers.Remove(agent); - return true; - } - } - catch(KeyNotFoundException) - { - } - - return false; - } - - public bool RemoveLLSDHandler(string path, LLSDMethod handler) - { - try - { - if (handler == m_llsdHandlers[path]) - { - m_llsdHandlers.Remove(path); - return true; - } - } - catch (KeyNotFoundException) - { - // This is an exception to prevent crashing because of invalid code - } - - return false; - } - - public string GetHTTP404(string host) - { - string file = Path.Combine(Util.configDir(), "http_404.html"); - if (!File.Exists(file)) - return getDefaultHTTP404(host); - - StreamReader sr = File.OpenText(file); - string result = sr.ReadToEnd(); - sr.Close(); - return result; - } - - public string GetHTTP500() - { - string file = Path.Combine(Util.configDir(), "http_500.html"); - if (!File.Exists(file)) - return getDefaultHTTP500(); - - StreamReader sr = File.OpenText(file); - string result = sr.ReadToEnd(); - sr.Close(); - return result; - } - - // Fallback HTTP responses in case the HTTP error response files don't exist - private static string getDefaultHTTP404(string host) - { - return "404 Page not found

Ooops!

The page you requested has been obsconded with by knomes. Find hippos quick!

If you are trying to log-in, your link parameters should have: "-loginpage http://" + host + "/?method=login -loginuri http://" + host + "/" in your link

"; - } - - private static string getDefaultHTTP500() - { - return "500 Internal Server Error

Ooops!

The server you requested is overun by knomes! Find hippos quick!

"; - } - } - - public class HttpServerContextObj - { - public IHttpClientContext context = null; - public IHttpRequest req = null; - public OSHttpRequest oreq = null; - public OSHttpResponse oresp = null; - - public HttpServerContextObj(IHttpClientContext contxt, IHttpRequest reqs) - { - context = contxt; - req = reqs; - } - - public HttpServerContextObj(OSHttpRequest osreq, OSHttpResponse osresp) - { - oreq = osreq; - oresp = osresp; - } - } - - /// - /// Relays HttpServer log messages to our own logging mechanism. - /// - /// There is also a UseTraceLogs line in this file that can be uncommented for more detailed log information - public class HttpServerLogWriter : ILogWriter - { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public void Write(object source, LogPrio priority, string message) - { - /* - switch (priority) - { - case HttpServer.LogPrio.Debug: - m_log.DebugFormat("[{0}]: {1}", source.ToString(), message); - break; - case HttpServer.LogPrio.Error: - m_log.ErrorFormat("[{0}]: {1}", source.ToString(), message); - break; - case HttpServer.LogPrio.Info: - m_log.InfoFormat("[{0}]: {1}", source.ToString(), message); - break; - case HttpServer.LogPrio.Warning: - m_log.WarnFormat("[{0}]: {1}", source.ToString(), message); - break; - case HttpServer.LogPrio.Fatal: - m_log.ErrorFormat("[{0}]: FATAL! - {1}", source.ToString(), message); - break; - default: - break; - } - */ - - return; - } - } -} diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs deleted file mode 100644 index 0261146..0000000 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ /dev/null @@ -1,496 +0,0 @@ -/* - * 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 OpenSim 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.IO; -using System.Reflection; -using System.Text; -using System.Threading; -using System.Timers; -using log4net; -using log4net.Appender; -using log4net.Core; -using log4net.Repository; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Statistics; -using Timer=System.Timers.Timer; - -using OpenMetaverse; -using OpenMetaverse.StructuredData; - - -namespace OpenSim.Framework.Servers -{ - /// - /// Common base for the main OpenSimServers (user, grid, inventory, region, etc) - /// - public abstract class BaseOpenSimServer - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - /// - /// This will control a periodic log printout of the current 'show stats' (if they are active) for this - /// server. - /// - private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); - - protected CommandConsole m_console; - protected OpenSimAppender m_consoleAppender; - - /// - /// Time at which this server was started - /// - protected DateTime m_startuptime; - - /// - /// Record the initial startup directory for info purposes - /// - protected string m_startupDirectory = Environment.CurrentDirectory; - - /// - /// Server version information. Usually VersionInfo + information about svn revision, operating system, etc. - /// - protected string m_version; - - protected string m_pidFile = String.Empty; - - /// - /// Random uuid for private data - /// - protected string m_osSecret = String.Empty; - - protected BaseHttpServer m_httpServer; - public BaseHttpServer HttpServer - { - get { return m_httpServer; } - } - - /// - /// Holds the non-viewer statistics collection object for this service/server - /// - protected IStatsCollector m_stats; - - public BaseOpenSimServer() - { - m_startuptime = DateTime.Now; - m_version = VersionInfo.Version; - - // Random uuid for private data - m_osSecret = UUID.Random().ToString(); - - m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); - m_periodicDiagnosticsTimer.Enabled = true; - - // Add ourselves to thread monitoring. This thread will go on to become the console listening thread - Thread.CurrentThread.Name = "ConsoleThread"; - ThreadTracker.Add(Thread.CurrentThread); - } - - /// - /// Must be overriden by child classes for their own server specific startup behaviour. - /// - protected virtual void StartupSpecific() - { - if (m_console != null) - { - ILoggerRepository repository = LogManager.GetRepository(); - IAppender[] appenders = repository.GetAppenders(); - - foreach (IAppender appender in appenders) - { - if (appender.Name == "Console") - { - m_consoleAppender = (OpenSimAppender)appender; - break; - } - } - - if (null == m_consoleAppender) - { - Notice("No appender named Console found (see the log4net config file for this executable)!"); - } - else - { - m_consoleAppender.Console = m_console; - - // If there is no threshold set then the threshold is effectively everything. - if (null == m_consoleAppender.Threshold) - m_consoleAppender.Threshold = Level.All; - - Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); - } - - m_console.Commands.AddCommand("base", false, "quit", - "quit", - "Quit the application", HandleQuit); - - m_console.Commands.AddCommand("base", false, "shutdown", - "shutdown", - "Quit the application", HandleQuit); - - m_console.Commands.AddCommand("base", false, "set log level", - "set log level ", - "Set the console logging level", HandleLogLevel); - - m_console.Commands.AddCommand("base", false, "show info", - "show info", - "Show general information", HandleShow); - - m_console.Commands.AddCommand("base", false, "show stats", - "show stats", - "Show statistics", HandleShow); - - m_console.Commands.AddCommand("base", false, "show threads", - "show threads", - "Show thread status", HandleShow); - - m_console.Commands.AddCommand("base", false, "show uptime", - "show uptime", - "Show server uptime", HandleShow); - - m_console.Commands.AddCommand("base", false, "show version", - "show version", - "Show server version", HandleShow); - } - } - - /// - /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing - /// - public virtual void ShutdownSpecific() {} - - /// - /// Provides a list of help topics that are available. Overriding classes should append their topics to the - /// information returned when the base method is called. - /// - /// - /// - /// A list of strings that represent different help topics on which more information is available - /// - protected virtual List GetHelpTopics() { return new List(); } - - /// - /// Print statistics to the logfile, if they are active - /// - protected void LogDiagnostics(object source, ElapsedEventArgs e) - { - StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n"); - sb.Append(GetUptimeReport()); - - if (m_stats != null) - { - sb.Append(m_stats.Report()); - } - - sb.Append(Environment.NewLine); - sb.Append(GetThreadsReport()); - - m_log.Debug(sb); - } - - /// - /// Get a report about the registered threads in this server. - /// - protected string GetThreadsReport() - { - StringBuilder sb = new StringBuilder(); - - List threads = ThreadTracker.GetThreads(); - if (threads == null) - { - sb.Append("Thread tracking is only enabled in DEBUG mode."); - } - else - { - sb.Append(threads.Count + " threads are being tracked:" + Environment.NewLine); - foreach (Thread t in threads) - { - if (t.IsAlive) - { - sb.Append( - "ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", Alive: " + t.IsAlive - + ", Pri: " + t.Priority + ", State: " + t.ThreadState + Environment.NewLine); - } - else - { - try - { - sb.Append("ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", DEAD" + Environment.NewLine); - } - catch - { - sb.Append("THREAD ERROR" + Environment.NewLine); - } - } - } - } - - return sb.ToString(); - } - - /// - /// Return a report about the uptime of this server - /// - /// - protected string GetUptimeReport() - { - StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now)); - sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime)); - sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime)); - - return sb.ToString(); - } - - /// - /// Performs initialisation of the scene, such as loading configuration from disk. - /// - public virtual void Startup() - { - m_log.Info("[STARTUP]: Beginning startup processing"); - - EnhanceVersionInformation(); - - m_log.Info("[STARTUP]: Version: " + m_version + "\n"); - - StartupSpecific(); - - TimeSpan timeTaken = DateTime.Now - m_startuptime; - - m_log.InfoFormat("[STARTUP]: Startup took {0}m {1}s", timeTaken.Minutes, timeTaken.Seconds); - } - - /// - /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing - /// - public virtual void Shutdown() - { - ShutdownSpecific(); - - m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); - RemovePIDFile(); - - Environment.Exit(0); - } - - private void HandleQuit(string module, string[] args) - { - Shutdown(); - } - - private void HandleLogLevel(string module, string[] cmd) - { - if (null == m_consoleAppender) - { - Notice("No appender named Console found (see the log4net config file for this executable)!"); - return; - } - - string rawLevel = cmd[3]; - - ILoggerRepository repository = LogManager.GetRepository(); - Level consoleLevel = repository.LevelMap[rawLevel]; - - if (consoleLevel != null) - m_consoleAppender.Threshold = consoleLevel; - else - Notice( - String.Format( - "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", - rawLevel)); - - Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); - } - - /// - /// Show help information - /// - /// - protected virtual void ShowHelp(string[] helpArgs) - { - Notice(""); - - if (helpArgs.Length == 0) - { - Notice("set log level [level] - change the console logging level only. For example, off or debug."); - Notice("show info - show server information (e.g. startup path)."); - - if (m_stats != null) - Notice("show stats - show statistical information for this server"); - - Notice("show threads - list tracked threads"); - Notice("show uptime - show server startup time and uptime."); - Notice("show version - show server version."); - Notice(""); - - return; - } - } - - public virtual void HandleShow(string module, string[] cmd) - { - List args = new List(cmd); - - args.RemoveAt(0); - - string[] showParams = args.ToArray(); - - switch (showParams[0]) - { - case "info": - Notice("Version: " + m_version); - Notice("Startup directory: " + m_startupDirectory); - break; - - case "stats": - if (m_stats != null) - Notice(m_stats.Report()); - break; - - case "threads": - Notice(GetThreadsReport()); - break; - - case "uptime": - Notice(GetUptimeReport()); - break; - - case "version": - Notice( - String.Format( - "Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion)); - break; - } - } - - /// - /// Console output is only possible if a console has been established. - /// That is something that cannot be determined within this class. So - /// all attempts to use the console MUST be verified. - /// - protected void Notice(string msg) - { - if (m_console != null) - { - m_console.Notice(msg); - } - } - - /// - /// Enhance the version string with extra information if it's available. - /// - protected void EnhanceVersionInformation() - { - string buildVersion = string.Empty; - - // Add subversion revision information if available - // Try file "svn_revision" in the current directory first, then the .svn info. - // This allows to make the revision available in simulators not running from the source tree. - // FIXME: Making an assumption about the directory we're currently in - we do this all over the place - // elsewhere as well - string svnRevisionFileName = "svn_revision"; - string svnFileName = ".svn/entries"; - string inputLine; - int strcmp; - - if (File.Exists(svnRevisionFileName)) - { - StreamReader RevisionFile = File.OpenText(svnRevisionFileName); - buildVersion = RevisionFile.ReadLine(); - buildVersion.Trim(); - RevisionFile.Close(); - } - - if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName)) - { - StreamReader EntriesFile = File.OpenText(svnFileName); - inputLine = EntriesFile.ReadLine(); - while (inputLine != null) - { - // using the dir svn revision at the top of entries file - strcmp = String.Compare(inputLine, "dir"); - if (strcmp == 0) - { - buildVersion = EntriesFile.ReadLine(); - break; - } - else - { - inputLine = EntriesFile.ReadLine(); - } - } - EntriesFile.Close(); - } - - m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6); - } - - protected void CreatePIDFile(string path) - { - try - { - string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); - FileStream fs = File.Create(path); - System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); - Byte[] buf = enc.GetBytes(pidstring); - fs.Write(buf, 0, buf.Length); - fs.Close(); - m_pidFile = path; - } - catch (Exception) - { - } - } - - public string osSecret { - // Secret uuid for the simulator - get { return m_osSecret; } - - } - - public string StatReport(OSHttpRequest httpRequest) - { - return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version ); - } - - protected void RemovePIDFile() - { - if (m_pidFile != String.Empty) - { - try - { - File.Delete(m_pidFile); - m_pidFile = String.Empty; - } - catch (Exception) - { - } - } - } - } -} diff --git a/OpenSim/Framework/Servers/BaseRequestHandler.cs b/OpenSim/Framework/Servers/BaseRequestHandler.cs deleted file mode 100644 index ddc8e92..0000000 --- a/OpenSim/Framework/Servers/BaseRequestHandler.cs +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 OpenSim 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; - -namespace OpenSim.Framework.Servers -{ - public class BaseRequestHandler - { - public virtual string ContentType - { - get { return "application/xml"; } - } - - private readonly string m_httpMethod; - - public virtual string HttpMethod - { - get { return m_httpMethod; } - } - - private readonly string m_path; - - protected BaseRequestHandler(string httpMethod, string path) - { - m_httpMethod = httpMethod; - m_path = path; - } - - public virtual string Path - { - get { return m_path; } - } - - protected string GetParam(string path) - { - try - { - return path.Substring(m_path.Length); - } - catch (Exception) - { - return String.Empty; - } - } - } -} diff --git a/OpenSim/Framework/Servers/BaseStreamHandler.cs b/OpenSim/Framework/Servers/BaseStreamHandler.cs deleted file mode 100644 index 836872c..0000000 --- a/OpenSim/Framework/Servers/BaseStreamHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.IO; -using OpenSim.Framework.Servers.Interfaces; - -namespace OpenSim.Framework.Servers -{ - public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler - { - public abstract byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse); - - protected BaseStreamHandler(string httpMethod, string path) : base(httpMethod, path) - { - } - } -} diff --git a/OpenSim/Framework/Servers/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/BinaryStreamHandler.cs deleted file mode 100644 index 6540798..0000000 --- a/OpenSim/Framework/Servers/BinaryStreamHandler.cs +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.IO; -using System.Text; - -namespace OpenSim.Framework.Servers -{ - public delegate string BinaryMethod(byte[] data, string path, string param); - - public class BinaryStreamHandler : BaseStreamHandler - { - private BinaryMethod m_method; - - public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - byte[] data = ReadFully(request); - string param = GetParam(path); - string responseString = m_method(data, path, param); - - return Encoding.UTF8.GetBytes(responseString); - } - - public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod) - : base(httpMethod, path) - { - m_method = binaryMethod; - } - - private static byte[] ReadFully(Stream stream) - { - byte[] buffer = new byte[32768]; - using (MemoryStream ms = new MemoryStream()) - { - while (true) - { - int read = stream.Read(buffer, 0, buffer.Length); - - if (read <= 0) - { - return ms.ToArray(); - } - - ms.Write(buffer, 0, read); - } - } - } - } -} diff --git a/OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs b/OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs deleted file mode 100644 index d7150e0..0000000 --- a/OpenSim/Framework/Servers/CachedGetAssetStreamHandler.cs +++ /dev/null @@ -1,217 +0,0 @@ -/* - * 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.IO; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Serialization; -using log4net; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Statistics; -using System.Net; - -namespace OpenSim.Framework.Servers -{ - public class CachedGetAssetStreamHandler : BaseStreamHandler - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - // private OpenAsset_Main m_assetManager; - private IAssetCache m_assetProvider; - - /// - /// Constructor. - /// - /// - /// - public CachedGetAssetStreamHandler(IAssetCache assetProvider) - : base("GET", "/assets") - { - m_log.Info("[REST]: In Get Request"); - // m_assetManager = assetManager; - m_assetProvider = assetProvider; - } - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - string param = GetParam(path); - byte[] result = new byte[] { }; - - string[] p = param.Split(new char[] { '/', '?', '&' }, StringSplitOptions.RemoveEmptyEntries); - - if (p.Length > 0) - { - UUID assetID = UUID.Zero; - - if (!UUID.TryParse(p[0], out assetID)) - { - m_log.InfoFormat( - "[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]); - return result; - } - - if (StatsManager.AssetStats != null) - StatsManager.AssetStats.AddRequest(); - - AssetBase asset = m_assetProvider.GetAsset(assetID,true); // TODO IsTexture should be deduced from loaded asset. It is not used in this case. - - if (asset != null) - { -// if (asset.ContainsReferences) -// { -// asset.Data = ProcessOutgoingAssetData(asset.Data); -// } - if (p.Length > 1 && p[1] == "data") - { - httpResponse.StatusCode = (int)HttpStatusCode.OK; - httpResponse.ContentType = SLAssetTypeToContentType(asset.Type); - result = asset.Data; - } - else - { - XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); - xw.Formatting = Formatting.Indented; - xs.Serialize(xw, asset); - xw.Flush(); - - ms.Seek(0, SeekOrigin.Begin); - //StreamReader sr = new StreamReader(ms); - - result = ms.GetBuffer(); - - Array.Resize(ref result, (int)ms.Length); - } - } - else - { - if (StatsManager.AssetStats != null) - StatsManager.AssetStats.AddNotFoundRequest(); - - m_log.InfoFormat("[REST]: GET:/asset failed to find {0}", assetID); - } - } - - return result; - } - - // private byte[] ProcessOutgoingAssetData(byte[] assetData) - // { - // string data = Encoding.ASCII.GetString(assetData); - - // data = ProcessAssetDataString(data); - - // return Encoding.ASCII.GetBytes(data); - // } - - public string ProcessAssetDataString(string data) - { - Regex regex = new Regex("(creator_id|owner_id)\\s+(\\S+)"); - - // IUserService userService = null; - - data = regex.Replace(data, delegate(Match m) - { - string result = String.Empty; - -// string key = m.Groups[1].Captures[0].Value; -// -// string value = m.Groups[2].Captures[0].Value; -// -// Guid userUri; -// -// switch (key) -// { -// case "creator_id": -// userUri = new Guid(value); -// // result = "creator_url " + userService(userService, userUri); -// break; -// -// case "owner_id": -// userUri = new Guid(value); -// // result = "owner_url " + ResolveUserUri(userService, userUri); -// break; -// } - - return result; - }); - - return data; - } - - private string SLAssetTypeToContentType(int assetType) - { - switch (assetType) - { - case 0: - return "image/jp2"; - case 1: - return "application/ogg"; - case 2: - return "application/x-metaverse-callingcard"; - case 3: - return "application/x-metaverse-landmark"; - case 5: - return "application/x-metaverse-clothing"; - case 6: - return "application/x-metaverse-primitive"; - case 7: - return "application/x-metaverse-notecard"; - case 8: - return "application/x-metaverse-folder"; - case 10: - return "application/x-metaverse-lsl"; - case 11: - return "application/x-metaverse-lso"; - case 12: - return "image/tga"; - case 13: - return "application/x-metaverse-bodypart"; - case 17: - return "audio/x-wav"; - case 19: - return "image/jpeg"; - case 20: - return "application/x-metaverse-animation"; - case 21: - return "application/x-metaverse-gesture"; - case 22: - return "application/x-metaverse-simstate"; - default: - return "application/octet-stream"; - } - } - } -} diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs deleted file mode 100644 index 63059f0..0000000 --- a/OpenSim/Framework/Servers/CheckSumServer.cs +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 OpenSim 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. - */ diff --git a/OpenSim/Framework/Servers/GenericHTTPMethod.cs b/OpenSim/Framework/Servers/GenericHTTPMethod.cs deleted file mode 100644 index 1358a00..0000000 --- a/OpenSim/Framework/Servers/GenericHTTPMethod.cs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 OpenSim 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.Collections; - -namespace OpenSim.Framework.Servers -{ - public delegate Hashtable GenericHTTPMethod(Hashtable request); -} diff --git a/OpenSim/Framework/Servers/GetAssetStreamHandler.cs b/OpenSim/Framework/Servers/GetAssetStreamHandler.cs deleted file mode 100644 index 628ee4e..0000000 --- a/OpenSim/Framework/Servers/GetAssetStreamHandler.cs +++ /dev/null @@ -1,216 +0,0 @@ -/* - * 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.IO; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Serialization; -using log4net; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Statistics; -using System.Net; - -namespace OpenSim.Framework.Servers -{ - public class GetAssetStreamHandler : BaseStreamHandler - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - // private OpenAsset_Main m_assetManager; - private IAssetDataPlugin m_assetProvider; - - /// - /// Constructor. - /// - /// - /// - public GetAssetStreamHandler(IAssetDataPlugin assetProvider) - : base("GET", "/assets") - { - m_log.Info("[REST]: In Get Request"); - // m_assetManager = assetManager; - m_assetProvider = assetProvider; - } - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - string param = GetParam(path); - byte[] result = new byte[] { }; - - string[] p = param.Split(new char[] { '/', '?', '&' }, StringSplitOptions.RemoveEmptyEntries); - - if (p.Length > 0) - { - UUID assetID = UUID.Zero; - - if (!UUID.TryParse(p[0], out assetID)) - { - m_log.InfoFormat( - "[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]); - return result; - } - - if (StatsManager.AssetStats != null) - StatsManager.AssetStats.AddRequest(); - - AssetBase asset = m_assetProvider.FetchAsset(assetID); - if (asset != null) - { -// if (asset.ContainsReferences) -// { -// asset.Data = ProcessOutgoingAssetData(asset.Data); -// } - if (p.Length > 1 && p[1] == "data") - { - httpResponse.StatusCode = (int)HttpStatusCode.OK; - httpResponse.ContentType = SLAssetTypeToContentType(asset.Type); - result = asset.Data; - } - else - { - XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); - xw.Formatting = Formatting.Indented; - xs.Serialize(xw, asset); - xw.Flush(); - - ms.Seek(0, SeekOrigin.Begin); - //StreamReader sr = new StreamReader(ms); - - result = ms.GetBuffer(); - - Array.Resize(ref result, (int)ms.Length); - } - } - else - { - if (StatsManager.AssetStats != null) - StatsManager.AssetStats.AddNotFoundRequest(); - - m_log.InfoFormat("[REST]: GET:/asset failed to find {0}", assetID); - } - } - - return result; - } - - // private byte[] ProcessOutgoingAssetData(byte[] assetData) - // { - // string data = Encoding.ASCII.GetString(assetData); - - // data = ProcessAssetDataString(data); - - // return Encoding.ASCII.GetBytes(data); - // } - - public string ProcessAssetDataString(string data) - { - Regex regex = new Regex("(creator_id|owner_id)\\s+(\\S+)"); - - // IUserService userService = null; - - data = regex.Replace(data, delegate(Match m) - { - string result = String.Empty; - -// string key = m.Groups[1].Captures[0].Value; -// -// string value = m.Groups[2].Captures[0].Value; -// -// Guid userUri; -// -// switch (key) -// { -// case "creator_id": -// userUri = new Guid(value); -// // result = "creator_url " + userService(userService, userUri); -// break; -// -// case "owner_id": -// userUri = new Guid(value); -// // result = "owner_url " + ResolveUserUri(userService, userUri); -// break; -// } - - return result; - }); - - return data; - } - - private string SLAssetTypeToContentType(int assetType) - { - switch (assetType) - { - case 0: - return "image/jp2"; - case 1: - return "application/ogg"; - case 2: - return "application/x-metaverse-callingcard"; - case 3: - return "application/x-metaverse-landmark"; - case 5: - return "application/x-metaverse-clothing"; - case 6: - return "application/x-metaverse-primitive"; - case 7: - return "application/x-metaverse-notecard"; - case 8: - return "application/x-metaverse-folder"; - case 10: - return "application/x-metaverse-lsl"; - case 11: - return "application/x-metaverse-lso"; - case 12: - return "image/tga"; - case 13: - return "application/x-metaverse-bodypart"; - case 17: - return "audio/x-wav"; - case 19: - return "image/jpeg"; - case 20: - return "application/x-metaverse-animation"; - case 21: - return "application/x-metaverse-gesture"; - case 22: - return "application/x-metaverse-simstate"; - default: - return "application/octet-stream"; - } - } - } -} diff --git a/OpenSim/Framework/Servers/Interfaces/IHttpAgentHandler.cs b/OpenSim/Framework/Servers/Interfaces/IHttpAgentHandler.cs deleted file mode 100644 index e6ad57e..0000000 --- a/OpenSim/Framework/Servers/Interfaces/IHttpAgentHandler.cs +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 OpenSim 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. - */ - -namespace OpenSim.Framework.Servers -{ - public interface IHttpAgentHandler - { - bool Handle(OSHttpRequest req, OSHttpResponse resp); - bool Match(OSHttpRequest req, OSHttpResponse resp); - } -} diff --git a/OpenSim/Framework/Servers/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/Interfaces/IHttpServer.cs deleted file mode 100644 index ea2c8f1..0000000 --- a/OpenSim/Framework/Servers/Interfaces/IHttpServer.cs +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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 OpenSim 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 Nwc.XmlRpc; -using OpenSim.Framework.Servers; - -namespace OpenSim.Framework.Servers.Interfaces -{ - /// - /// Interface to OpenSimulator's built in HTTP server. Use this to register handlers (http, llsd, xmlrpc, etc.) - /// for given URLs. - /// - public interface IHttpServer - { - uint SSLPort { get; } - string SSLCommonName { get; } - - uint Port { get; } - bool UseSSL { get; } - - // Note that the agent string is provided simply to differentiate - // the handlers - it is NOT required to be an actual agent header - // value. - bool AddAgentHandler(string agent, IHttpAgentHandler handler); - - /// - /// Add a handler for an HTTP request - /// - /// - /// This handler can actually be invoked either as - /// - /// http://:/?method= - /// - /// or - /// - /// http://: - /// - /// if the method name starts with a slash. For example, AddHTTPHandler("/object/", ...) on a standalone region - /// server will register a handler that can be invoked with either - /// - /// http://localhost:9000/?method=/object/ - /// - /// or - /// - /// http://localhost:9000/object/ - /// - /// - /// - /// - /// true if the handler was successfully registered, false if a handler with the same name already existed. - /// - bool AddHTTPHandler(string methodName, GenericHTTPMethod handler); - - /// - /// Adds a LLSD handler, yay. - /// - /// /resource/ path - /// handle the LLSD response - /// - bool AddLLSDHandler(string path, LLSDMethod handler); - - /// - /// Add a stream handler to the http server. If the handler already exists, then nothing happens. - /// - /// - void AddStreamHandler(IRequestHandler handler); - - bool AddXmlRPCHandler(string method, XmlRpcMethod handler); - bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive); - - /// - /// Gets the XML RPC handler for given method name - /// - /// Name of the method - /// Returns null if not found - XmlRpcMethod GetXmlRPCHandler(string method); - - bool SetDefaultLLSDHandler(DefaultLLSDMethod handler); - - /// - /// Remove the agent if it is registered. - /// - /// - /// - /// - bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); - - /// - /// Remove an HTTP handler - /// - /// - /// - void RemoveHTTPHandler(string httpMethod, string path); - - bool RemoveLLSDHandler(string path, LLSDMethod handler); - - void RemoveStreamHandler(string httpMethod, string path); - - string GetHTTP404(string host); - - string GetHTTP500(); - } -} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/Interfaces/IStreamHandler.cs b/OpenSim/Framework/Servers/Interfaces/IStreamHandler.cs deleted file mode 100644 index 0783dfa..0000000 --- a/OpenSim/Framework/Servers/Interfaces/IStreamHandler.cs +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 OpenSim 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.Collections; -using System.IO; - -namespace OpenSim.Framework.Servers -{ - public interface IRequestHandler - { - // Return response content type - string ContentType { get; } - - // Return required http method - string HttpMethod { get; } - - // Return path - string Path { get; } - } - - public interface IStreamedRequestHandler : IRequestHandler - { - // Handle request stream, return byte array - byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse); - } - - public interface IStreamHandler : IRequestHandler - { - // Handle request stream, return byte array - void Handle(string path, Stream request, Stream response, OSHttpRequest httpReqbuest, OSHttpResponse httpResponse); - } - - public interface IGenericHTTPHandler : IRequestHandler - { - Hashtable Handle(string path, Hashtable request); - } -} diff --git a/OpenSim/Framework/Servers/LLSDMethod.cs b/OpenSim/Framework/Servers/LLSDMethod.cs deleted file mode 100644 index 693d298..0000000 --- a/OpenSim/Framework/Servers/LLSDMethod.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 OpenSim 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 OpenMetaverse.StructuredData; - -namespace OpenSim.Framework.Servers -{ - public delegate OSD LLSDMethod( string path, OSD request, string endpoint ); - public delegate OSD DefaultLLSDMethod(OSD request); -} diff --git a/OpenSim/Framework/Servers/LLSDMethodString.cs b/OpenSim/Framework/Servers/LLSDMethodString.cs deleted file mode 100644 index 77fc290..0000000 --- a/OpenSim/Framework/Servers/LLSDMethodString.cs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 OpenSim 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 OpenMetaverse.StructuredData; - -namespace OpenSim.Framework.Servers -{ - public delegate OSD LLSDMethodString(OSD request, string thePath); -} diff --git a/OpenSim/Framework/Servers/MessageServerInfo.cs b/OpenSim/Framework/Servers/MessageServerInfo.cs deleted file mode 100644 index 17b5f10..0000000 --- a/OpenSim/Framework/Servers/MessageServerInfo.cs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 OpenSim 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.Collections.Generic; - -namespace OpenSim.Framework.Servers -{ - public class MessageServerInfo - { - public string URI; - public string sendkey; - public string recvkey; - public List responsibleForRegions; - - public MessageServerInfo() - { - } - - public override string ToString() - { - return URI; - } - } -} diff --git a/OpenSim/Framework/Servers/OSHttpHandler.cs b/OpenSim/Framework/Servers/OSHttpHandler.cs deleted file mode 100644 index 838f29a..0000000 --- a/OpenSim/Framework/Servers/OSHttpHandler.cs +++ /dev/null @@ -1,183 +0,0 @@ -/* - * 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 OpenSim 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.IO; -using System.Text.RegularExpressions; - -namespace OpenSim.Framework.Servers -{ - /// - /// Any OSHttpHandler must return one of the following results: - /// - /// - /// result code - /// meaning - /// - /// - /// Pass - /// handler did not process the request - /// - /// - /// Done - /// handler did process the request, OSHttpServer - /// can clean up and close the request - /// - /// - /// - public enum OSHttpHandlerResult - { - Unprocessed, - Pass, - Done, - } - - /// - /// An OSHttpHandler that matches on the "content-type" header can - /// supply an OSHttpContentTypeChecker delegate which will be - /// invoked by the request matcher in OSHttpRequestPump. - /// - /// true if the handler is interested in the content; - /// false otherwise - public delegate bool OSHttpContentTypeChecker(OSHttpRequest req); - - public abstract class OSHttpHandler - { - /// - /// Regular expression used to match against method of - /// the incoming HTTP request. If you want to match any string - /// either use '.*' or null. To match on the empty string use - /// '^$'. - /// - public virtual Regex Method - { - get { return _method; } - } - protected Regex _method; - - /// - /// Regular expression used to match against path of the - /// incoming HTTP request. If you want to match any string - /// either use '.*' or null. To match on the emtpy string use - /// '^$'. - /// - public virtual Regex Path - { - get { return _path; } - } - protected Regex _path; - - /// - /// Dictionary of (query name, regular expression) tuples, - /// allowing us to match on URI query fields. - /// - public virtual Dictionary Query - { - get { return _query; } - } - protected Dictionary _query; - - /// - /// Dictionary of (header name, regular expression) tuples, - /// allowing us to match on HTTP header fields. - /// - public virtual Dictionary Headers - { - get { return _headers; } - } - protected Dictionary _headers; - - /// - /// Dictionary of (header name, regular expression) tuples, - /// allowing us to match on HTTP header fields. - /// - /// - /// This feature is currently not implemented as it requires - /// (trivial) changes to HttpServer.HttpListener that have not - /// been implemented. - /// - public virtual Regex IPEndPointWhitelist - { - get { return _ipEndPointRegex; } - } - protected Regex _ipEndPointRegex; - - - /// - /// Base class constructor. - /// - /// null or path regex - /// null or dictionary of header - /// regexs - /// null or content type - /// regex - /// null or IP address regex - public OSHttpHandler(Regex method, Regex path, Dictionary query, - Dictionary headers, Regex contentType, Regex whitelist) - { - _method = method; - _path = path; - _query = query; - _ipEndPointRegex = whitelist; - - if (null == _headers && null != contentType) - { - _headers = new Dictionary(); - _headers.Add("content-type", contentType); - } - } - - - /// - /// Process an incoming OSHttpRequest that matched our - /// requirements. - /// - /// - /// OSHttpHandlerResult.Pass if we are after all not - /// interested in the request; OSHttpHandlerResult.Done if we - /// did process the request. - /// - public abstract OSHttpHandlerResult Process(OSHttpRequest request); - - public override string ToString() - { - StringWriter sw = new StringWriter(); - sw.WriteLine("{0}", base.ToString()); - sw.WriteLine(" method regex {0}", null == Method ? "null" : Method.ToString()); - sw.WriteLine(" path regex {0}", null == Path ? "null": Path.ToString()); - foreach (string tag in Headers.Keys) - { - sw.WriteLine(" header {0} : {1}", tag, Headers[tag].ToString()); - } - sw.WriteLine(" IP whitelist {0}", null == IPEndPointWhitelist ? "null" : IPEndPointWhitelist.ToString()); - sw.WriteLine(); - sw.Close(); - return sw.ToString(); - } - } -} diff --git a/OpenSim/Framework/Servers/OSHttpHttpHandler.cs b/OpenSim/Framework/Servers/OSHttpHttpHandler.cs deleted file mode 100644 index e08df85..0000000 --- a/OpenSim/Framework/Servers/OSHttpHttpHandler.cs +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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 OpenSim 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.IO; -using System.Net; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using log4net; -using Nwc.XmlRpc; - -namespace OpenSim.Framework.Servers -{ - public delegate XmlRpcResponse OSHttpHttpProcessor(XmlRpcRequest request); - - public class OSHttpHttpHandler: OSHttpHandler - { - private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - // contains handler for processing HTTP Request - private GenericHTTPMethod _handler; - - /// - /// Instantiate an HTTP handler. - /// - /// a GenericHTTPMethod - /// null or HTTP method regex - /// null or path regex - /// null or dictionary with query regexs - /// null or dictionary with header - /// regexs - /// null or IP address whitelist - public OSHttpHttpHandler(GenericHTTPMethod handler, Regex method, Regex path, - Dictionary query, - Dictionary headers, Regex whitelist) - : base(method, path, query, headers, new Regex(@"^text/html", RegexOptions.IgnoreCase | RegexOptions.Compiled), - whitelist) - { - _handler = handler; - } - - /// - /// Instantiate an HTTP handler. - /// - /// a GenericHTTPMethod - public OSHttpHttpHandler(GenericHTTPMethod handler) - : this(handler, new Regex(@"^GET$", RegexOptions.IgnoreCase | RegexOptions.Compiled), null, null, null, null) - { - } - - /// - /// Invoked by OSHttpRequestPump. - /// - public override OSHttpHandlerResult Process(OSHttpRequest request) - { - // call handler method - Hashtable responseData = _handler(request.Query); - - int responseCode = (int)responseData["int_response_code"]; - string responseString = (string)responseData["str_response_string"]; - string contentType = (string)responseData["content_type"]; - - //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this - //and should check for NullReferenceExceptions - - if (string.IsNullOrEmpty(contentType)) - { - contentType = "text/html"; - } - - OSHttpResponse response = new OSHttpResponse(request); - - // We're forgoing the usual error status codes here because the client - // ignores anything but 200 and 301 - - response.StatusCode = (int)OSHttpStatusCode.SuccessOk; - - if (responseCode == (int)OSHttpStatusCode.RedirectMovedPermanently) - { - response.RedirectLocation = (string)responseData["str_redirect_location"]; - response.StatusCode = responseCode; - } - - response.AddHeader("Content-type", contentType); - - byte[] buffer; - - if (!contentType.Contains("image")) - { - buffer = Encoding.UTF8.GetBytes(responseString); - } - else - { - buffer = Convert.FromBase64String(responseString); - } - - response.SendChunked = false; - response.ContentLength64 = buffer.Length; - response.ContentEncoding = Encoding.UTF8; - - try - { - response.Body.Write(buffer, 0, buffer.Length); - } - catch (Exception ex) - { - _log.ErrorFormat("[OSHttpHttpHandler]: Error: {0}", ex.Message); - } - finally - { - response.Send(); - } - - return OSHttpHandlerResult.Done; - } - } -} diff --git a/OpenSim/Framework/Servers/OSHttpRequest.cs b/OpenSim/Framework/Servers/OSHttpRequest.cs deleted file mode 100644 index 8e0cb38..0000000 --- a/OpenSim/Framework/Servers/OSHttpRequest.cs +++ /dev/null @@ -1,228 +0,0 @@ -/* - * 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 OpenSim 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.Reflection; -using System.Text; -using HttpServer; -using log4net; - -namespace OpenSim.Framework.Servers -{ - public class OSHttpRequest - { - private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected IHttpRequest _request = null; - protected IHttpClientContext _context = null; - - public string[] AcceptTypes - { - get { return _request.AcceptTypes; } - } - - public Encoding ContentEncoding - { - get { return _contentEncoding; } - } - private Encoding _contentEncoding; - - public long ContentLength - { - get { return _request.ContentLength; } - } - - public long ContentLength64 - { - get { return ContentLength; } - } - - public string ContentType - { - get { return _contentType; } - } - private string _contentType; - - public bool HasEntityBody - { - get { return _request.ContentLength != 0; } - } - - public NameValueCollection Headers - { - get { return _request.Headers; } - } - - public string HttpMethod - { - get { return _request.Method; } - } - - public Stream InputStream - { - get { return _request.Body; } - } - - public bool IsSecured - { - get { return _context.Secured; } - } - - public bool KeepAlive - { - get { return ConnectionType.KeepAlive == _request.Connection; } - } - - public NameValueCollection QueryString - { - get { return _queryString; } - } - private NameValueCollection _queryString; - - public Hashtable Query - { - get { return _query; } - } - private Hashtable _query; - - public string RawUrl - { - get { return _request.Uri.AbsolutePath; } - } - - public IPEndPoint RemoteIPEndPoint - { - get { return _remoteIPEndPoint; } - } - private IPEndPoint _remoteIPEndPoint; - - public Uri Url - { - get { return _request.Uri; } - } - - public string UserAgent - { - get { return _userAgent; } - } - private string _userAgent; - - internal IHttpRequest IHttpRequest - { - get { return _request; } - } - - internal IHttpClientContext IHttpClientContext - { - get { return _context; } - } - - /// - /// Internal whiteboard for handlers to store temporary stuff - /// into. - /// - internal Dictionary Whiteboard - { - get { return _whiteboard; } - } - private Dictionary _whiteboard = new Dictionary(); - - - public OSHttpRequest() {} - - public OSHttpRequest(IHttpClientContext context, IHttpRequest req) - { - _request = req; - _context = context; - - if (null != req.Headers["content-encoding"]) - _contentEncoding = Encoding.GetEncoding(_request.Headers["content-encoding"]); - if (null != req.Headers["content-type"]) - _contentType = _request.Headers["content-type"]; - if (null != req.Headers["user-agent"]) - _userAgent = req.Headers["user-agent"]; - if (null != req.Headers["remote_addr"]) - { - try - { - IPAddress addr = IPAddress.Parse(req.Headers["remote_addr"]); - int port = Int32.Parse(req.Headers["remote_port"]); - _remoteIPEndPoint = new IPEndPoint(addr, port); - } - catch (FormatException) - { - _log.ErrorFormat("[OSHttpRequest]: format exception on addr/port {0}:{1}, ignoring", - req.Headers["remote_addr"], req.Headers["remote_port"]); - } - } - - _queryString = new NameValueCollection(); - _query = new Hashtable(); - try - { - foreach (HttpInputItem item in req.QueryString) - { - try - { - _queryString.Add(item.Name, item.Value); - _query[item.Name] = item.Value; - } - catch (InvalidCastException) - { - _log.DebugFormat("[OSHttpRequest]: error parsing {0} query item, skipping it", item.Name); - continue; - } - } - } - catch (Exception) - { - _log.ErrorFormat("[OSHttpRequest]: Error parsing querystring"); - } - } - - public override string ToString() - { - StringBuilder me = new StringBuilder(); - me.Append(String.Format("OSHttpRequest: {0} {1}\n", HttpMethod, RawUrl)); - foreach (string k in Headers.AllKeys) - { - me.Append(String.Format(" {0}: {1}\n", k, Headers[k])); - } - if (null != RemoteIPEndPoint) - { - me.Append(String.Format(" IP: {0}\n", RemoteIPEndPoint)); - } - - return me.ToString(); - } - } -} diff --git a/OpenSim/Framework/Servers/OSHttpRequestPump.cs b/OpenSim/Framework/Servers/OSHttpRequestPump.cs deleted file mode 100644 index b4270b3..0000000 --- a/OpenSim/Framework/Servers/OSHttpRequestPump.cs +++ /dev/null @@ -1,298 +0,0 @@ -/* - * 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 OpenSim 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. - */ - -// #define DEBUGGING - -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Diagnostics; -using System.IO; -using System.Net; -using System.Reflection; -using System.Text.RegularExpressions; -using System.Threading; -using log4net; -using HttpServer; - -namespace OpenSim.Framework.Servers -{ - /// - /// An OSHttpRequestPump fetches incoming OSHttpRequest objects - /// from the OSHttpRequestQueue and feeds them to all subscribed - /// parties. Each OSHttpRequestPump encapsulates one thread to do - /// the work and there is a fixed number of pumps for each - /// OSHttpServer object. - /// - public class OSHttpRequestPump - { - private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected OSHttpServer _server; - protected OSHttpRequestQueue _queue; - protected Thread _engine; - - private int _id; - - public string EngineID - { - get { return String.Format("{0} pump {1}", _server.EngineID, _id); } - } - - public OSHttpRequestPump(OSHttpServer server, OSHttpRequestQueue queue, int id) - { - _server = server; - _queue = queue; - _id = id; - - _engine = new Thread(new ThreadStart(Engine)); - _engine.Name = EngineID; - _engine.IsBackground = true; - _engine.Start(); - - ThreadTracker.Add(_engine); - } - - public static OSHttpRequestPump[] Pumps(OSHttpServer server, OSHttpRequestQueue queue, int poolSize) - { - OSHttpRequestPump[] pumps = new OSHttpRequestPump[poolSize]; - for (int i = 0; i < pumps.Length; i++) - { - pumps[i] = new OSHttpRequestPump(server, queue, i); - } - - return pumps; - } - - public void Start() - { - _engine = new Thread(new ThreadStart(Engine)); - _engine.Name = EngineID; - _engine.IsBackground = true; - _engine.Start(); - - ThreadTracker.Add(_engine); - } - - public void Engine() - { - OSHttpRequest req = null; - - while (true) - { - try - { - // dequeue an OSHttpRequest from OSHttpServer's - // request queue - req = _queue.Dequeue(); - - // get a copy of the list of registered handlers - List handlers = _server.OSHttpHandlers; - - // prune list and have it sorted from most - // specific to least specific - handlers = MatchHandlers(req, handlers); - - // process req: we try each handler in turn until - // we are either out of handlers or get back a - // Pass or Done - OSHttpHandlerResult rc = OSHttpHandlerResult.Unprocessed; - foreach (OSHttpHandler h in handlers) - { - rc = h.Process(req); - - // Pass: handler did not process the request, - // try next handler - if (OSHttpHandlerResult.Pass == rc) continue; - - // Handled: handler has processed the request - if (OSHttpHandlerResult.Done == rc) break; - - // hmm, something went wrong - throw new Exception(String.Format("[{0}] got unexpected OSHttpHandlerResult {1}", EngineID, rc)); - } - - if (OSHttpHandlerResult.Unprocessed == rc) - { - _log.InfoFormat("[{0}] OSHttpHandler: no handler registered for {1}", EngineID, req); - - // set up response header - OSHttpResponse resp = new OSHttpResponse(req); - resp.StatusCode = (int)OSHttpStatusCode.ClientErrorNotFound; - resp.StatusDescription = String.Format("no handler on call for {0}", req); - resp.ContentType = "text/html"; - - // add explanatory message - StreamWriter body = new StreamWriter(resp.Body); - body.WriteLine(""); - body.WriteLine("
Ooops...
"); - body.WriteLine(String.Format("

{0}

", resp.StatusDescription)); - body.WriteLine(""); - body.Flush(); - - // and ship it back - resp.Send(); - } - } - catch (Exception e) - { - _log.DebugFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.ToString()); - _log.ErrorFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.Message); - } - } - } - - protected List MatchHandlers(OSHttpRequest req, List handlers) - { - Dictionary scoredHandlers = new Dictionary(); - - _log.DebugFormat("[{0}] MatchHandlers for {1}", EngineID, req); - foreach (OSHttpHandler h in handlers) - { - // initial anchor - scoredHandlers[h] = 0; - - // first, check whether IPEndPointWhitelist applies - // and, if it does, whether client is on that white - // list. - if (null != h.IPEndPointWhitelist) - { - // TODO: following code requires code changes to - // HttpServer.HttpRequest to become functional - - IPEndPoint remote = req.RemoteIPEndPoint; - if (null != remote) - { - Match epm = h.IPEndPointWhitelist.Match(remote.ToString()); - if (!epm.Success) - { - scoredHandlers.Remove(h); - continue; - } - } - } - - if (null != h.Method) - { - Match m = h.Method.Match(req.HttpMethod); - if (!m.Success) - { - scoredHandlers.Remove(h); - continue; - } - scoredHandlers[h]++; - } - - // whitelist ok, now check path - if (null != h.Path) - { - Match m = h.Path.Match(req.RawUrl); - if (!m.Success) - { - scoredHandlers.Remove(h); - continue; - } - scoredHandlers[h] += m.ToString().Length; - } - - // whitelist & path ok, now check query string - if (null != h.Query) - { - int queriesMatch = MatchOnNameValueCollection(req.QueryString, h.Query); - if (0 == queriesMatch) - { - _log.DebugFormat("[{0}] request {1}", EngineID, req); - _log.DebugFormat("[{0}] dropping handler {1}", EngineID, h); - - scoredHandlers.Remove(h); - continue; - } - scoredHandlers[h] += queriesMatch; - } - - // whitelist, path, query string ok, now check headers - if (null != h.Headers) - { - int headersMatch = MatchOnNameValueCollection(req.Headers, h.Headers); - if (0 == headersMatch) - { - _log.DebugFormat("[{0}] request {1}", EngineID, req); - _log.DebugFormat("[{0}] dropping handler {1}", EngineID, h); - - scoredHandlers.Remove(h); - continue; - } - scoredHandlers[h] += headersMatch; - } - } - - List matchingHandlers = new List(scoredHandlers.Keys); - matchingHandlers.Sort(delegate(OSHttpHandler x, OSHttpHandler y) - { - return scoredHandlers[x] - scoredHandlers[y]; - }); - LogDumpHandlerList(matchingHandlers); - return matchingHandlers; - } - - protected int MatchOnNameValueCollection(NameValueCollection collection, Dictionary regexs) - { - int matched = 0; - - foreach (string tag in regexs.Keys) - { - // do we have a header "tag"? - if (null == collection[tag]) - { - return 0; - } - - // does the content of collection[tag] match - // the supplied regex? - Match cm = regexs[tag].Match(collection[tag]); - if (!cm.Success) - { - return 0; - } - - // ok: matches - matched++; - continue; - } - - return matched; - } - - [ConditionalAttribute("DEBUGGING")] - private void LogDumpHandlerList(List l) - { - _log.DebugFormat("[{0}] OSHttpHandlerList dump:", EngineID); - foreach (OSHttpHandler h in l) - _log.DebugFormat(" ", h.ToString()); - } - } -} diff --git a/OpenSim/Framework/Servers/OSHttpRequestQueue.cs b/OpenSim/Framework/Servers/OSHttpRequestQueue.cs deleted file mode 100644 index 94f7b32..0000000 --- a/OpenSim/Framework/Servers/OSHttpRequestQueue.cs +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 OpenSim 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.Threading; -using HttpServer; - -namespace OpenSim.Framework.Servers -{ - /// - /// OSHttpRequestQueues are used to hand over incoming HTTP - /// requests to OSHttpRequestPump objects. - /// - public class OSHttpRequestQueue : Queue - { - private object _syncObject = new object(); - - new public void Enqueue(OSHttpRequest req) - { - lock (_syncObject) - { - base.Enqueue(req); - Monitor.Pulse(_syncObject); - } - } - - new public OSHttpRequest Dequeue() - { - OSHttpRequest req = null; - - lock (_syncObject) - { - while (null == req) - { - Monitor.Wait(_syncObject); - if (0 != this.Count) req = base.Dequeue(); - } - } - - return req; - } - } -} diff --git a/OpenSim/Framework/Servers/OSHttpResponse.cs b/OpenSim/Framework/Servers/OSHttpResponse.cs deleted file mode 100644 index e46d605..0000000 --- a/OpenSim/Framework/Servers/OSHttpResponse.cs +++ /dev/null @@ -1,302 +0,0 @@ -/* - * 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 OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.IO; -using System.Net; -using System.Text; -using HttpServer; - -namespace OpenSim.Framework.Servers -{ - /// - /// OSHttpResponse is the OpenSim representation of an HTTP - /// response. - /// - public class OSHttpResponse - { - /// - /// Content type property. - /// - /// - /// Setting this property will also set IsContentTypeSet to - /// true. - /// - public string ContentType - { - get - { - return _httpResponse.ContentType; - } - - set - { - _httpResponse.ContentType = value; - } - } - - /// - /// 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 - { - return _httpResponse.ContentLength; - } - - set - { - _httpResponse.ContentLength = value; - } - } - - /// - /// Alias for ContentLength. - /// - public long ContentLength64 - { - get { return ContentLength; } - set { ContentLength = value; } - } - - /// - /// Encoding of the body content. - /// - public Encoding ContentEncoding - { - get - { - return _httpResponse.Encoding; - } - - set - { - _httpResponse.Encoding = value; - } - } - - public bool KeepAlive - { - get - { - return _httpResponse.Connection == ConnectionType.KeepAlive; - } - - set - { - if (value) - _httpResponse.Connection = ConnectionType.KeepAlive; - else - _httpResponse.Connection = ConnectionType.Close; - } - } - - /// - /// 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 - { - return _httpResponse.KeepAlive; - } - - set - { - if (value == 0) - { - _httpResponse.Connection = ConnectionType.Close; - _httpResponse.KeepAlive = 0; - } - else - { - _httpResponse.Connection = ConnectionType.KeepAlive; - _httpResponse.KeepAlive = value; - } - } - } - - /// - /// Return the output stream feeding the body. - /// - /// - /// On its way out... - /// - public Stream OutputStream - { - get - { - return _httpResponse.Body; - } - } - - public string ProtocolVersion - { - get - { - return _httpResponse.ProtocolVersion; - } - - set - { - _httpResponse.ProtocolVersion = value; - } - } - - /// - /// Return the output stream feeding the body. - /// - public Stream Body - { - get - { - return _httpResponse.Body; - } - } - - /// - /// Set a redirct location. - /// - public string RedirectLocation - { - // get { return _redirectLocation; } - set - { - _httpResponse.Redirect(value); - } - } - - - /// - /// Chunk transfers. - /// - public bool SendChunked - { - get - { - return _httpResponse.Chunked; - } - - set - { - _httpResponse.Chunked = value; - } - } - - /// - /// HTTP status code. - /// - public int StatusCode - { - get - { - return (int)_httpResponse.Status; - } - - set - { - _httpResponse.Status = (HttpStatusCode)value; - } - } - - - /// - /// HTTP status description. - /// - public string StatusDescription - { - get - { - return _httpResponse.Reason; - } - - set - { - _httpResponse.Reason = value; - } - } - - - protected IHttpResponse _httpResponse; - - public OSHttpResponse() {} - - public OSHttpResponse(IHttpResponse resp) - { - _httpResponse = resp; - } - - /// - /// Instantiate an OSHttpResponse object from an OSHttpRequest - /// object. - /// Incoming OSHttpRequest to which we are - /// replying - public OSHttpResponse(OSHttpRequest req) - { - _httpResponse = new HttpResponse(req.IHttpClientContext, req.IHttpRequest); - } - - /// - /// 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) - { - _httpResponse.AddHeader(key, value); - } - - /// - /// Send the response back to the remote client - /// - public void Send() - { - _httpResponse.Body.Flush(); - _httpResponse.Send(); - - } - } -} diff --git a/OpenSim/Framework/Servers/OSHttpServer.cs b/OpenSim/Framework/Servers/OSHttpServer.cs deleted file mode 100644 index 40f4229..0000000 --- a/OpenSim/Framework/Servers/OSHttpServer.cs +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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 OpenSim 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 System.Net.Sockets; -using System.Reflection; -using System.Text.RegularExpressions; -using System.Threading; -using System.Security.Cryptography.X509Certificates; -using log4net; -using HttpServer; - -using HttpListener = HttpServer.HttpListener; - -namespace OpenSim.Framework.Servers -{ - /// - /// OSHttpServer provides an HTTP server bound to a specific - /// port. When instantiated with just address and port it uses - /// normal HTTP, when instantiated with address, port, and X509 - /// certificate, it uses HTTPS. - /// - public class OSHttpServer - { - private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private object _syncObject = new object(); - - // underlying HttpServer.HttpListener - protected HttpListener _listener; - // underlying core/engine thread - protected Thread _engine; - - // Queue containing (OS)HttpRequests - protected OSHttpRequestQueue _queue; - - // OSHttpRequestPumps "pumping" incoming OSHttpRequests - // upwards - protected OSHttpRequestPump[] _pumps; - - // thread identifier - protected string _engineId; - public string EngineID - { - get { return _engineId; } - } - - /// - /// True if this is an HTTPS connection; false otherwise. - /// - protected bool _isSecure; - public bool IsSecure - { - get { return _isSecure; } - } - - public int QueueSize - { - get { return _pumps.Length; } - } - - /// - /// List of registered OSHttpHandlers for this OSHttpServer instance. - /// - protected List _httpHandlers = new List(); - public List OSHttpHandlers - { - get - { - lock (_httpHandlers) - { - return new List(_httpHandlers); - } - } - } - - - /// - /// Instantiate an HTTP server. - /// - public OSHttpServer(IPAddress address, int port, int poolSize) - { - _engineId = String.Format("OSHttpServer (HTTP:{0})", port); - _isSecure = false; - _log.DebugFormat("[{0}] HTTP server instantiated", EngineID); - - _listener = new HttpListener(address, port); - _queue = new OSHttpRequestQueue(); - _pumps = OSHttpRequestPump.Pumps(this, _queue, poolSize); - } - - /// - /// Instantiate an HTTPS server. - /// - public OSHttpServer(IPAddress address, int port, X509Certificate certificate, int poolSize) - { - _engineId = String.Format("OSHttpServer [HTTPS:{0}/ps:{1}]", port, poolSize); - _isSecure = true; - _log.DebugFormat("[{0}] HTTPS server instantiated", EngineID); - - _listener = new HttpListener(address, port, certificate); - _queue = new OSHttpRequestQueue(); - _pumps = OSHttpRequestPump.Pumps(this, _queue, poolSize); - } - - /// - /// Turn an HttpRequest into an OSHttpRequestItem and place it - /// in the queue. The OSHttpRequestQueue object will pulse the - /// next available idle pump. - /// - protected void OnHttpRequest(HttpClientContext client, HttpRequest request) - { - // turn request into OSHttpRequest - OSHttpRequest req = new OSHttpRequest(client, request); - - // place OSHttpRequest into _httpRequestQueue, will - // trigger Pulse to idle waiting pumps - _queue.Enqueue(req); - } - - /// - /// Start the HTTP server engine. - /// - public void Start() - { - _engine = new Thread(new ThreadStart(Engine)); - _engine.Name = _engineId; - _engine.IsBackground = true; - _engine.Start(); - - ThreadTracker.Add(_engine); - - // start the pumps... - for (int i = 0; i < _pumps.Length; i++) - _pumps[i].Start(); - } - - public void Stop() - { - lock (_syncObject) Monitor.Pulse(_syncObject); - } - - /// - /// Engine keeps the HTTP server running. - /// - private void Engine() - { - try { - _listener.RequestHandler += OnHttpRequest; - _listener.Start(QueueSize); - _log.InfoFormat("[{0}] HTTP server started", EngineID); - - lock (_syncObject) Monitor.Wait(_syncObject); - } - catch (Exception ex) - { - _log.DebugFormat("[{0}] HTTP server startup failed: {1}", EngineID, ex.ToString()); - } - - _log.InfoFormat("[{0}] HTTP server terminated", EngineID); - } - - - /// - /// Add an HTTP request handler. - /// - /// OSHttpHandler delegate - /// regex object for path matching - /// dictionary containing header names - /// and regular expressions to match against header values - public void AddHandler(OSHttpHandler handler) - { - lock (_httpHandlers) - { - if (_httpHandlers.Contains(handler)) - { - _log.DebugFormat("[OSHttpServer] attempt to add already existing handler ignored"); - return; - } - _httpHandlers.Add(handler); - } - } - } -} diff --git a/OpenSim/Framework/Servers/OSHttpStatusCodes.cs b/OpenSim/Framework/Servers/OSHttpStatusCodes.cs deleted file mode 100644 index 42f172b..0000000 --- a/OpenSim/Framework/Servers/OSHttpStatusCodes.cs +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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 OpenSim 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. - */ - -namespace OpenSim.Framework.Servers -{ - /// - /// HTTP status codes (almost) as defined by W3C in - /// http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html - /// - public enum OSHttpStatusCode: int - { - // 1xx Informational status codes providing a provisional - // response. - // 100 Tells client that to keep on going sending its request - InfoContinue = 100, - // 101 Server understands request, proposes to switch to different - // application level protocol - InfoSwitchingProtocols = 101, - - - // 2xx Success codes - // 200 Request successful - SuccessOk = 200, - // 201 Request successful, new resource created - SuccessOkCreated = 201, - // 202 Request accepted, processing still on-going - SuccessOkAccepted = 202, - // 203 Request successful, meta information not authoritative - SuccessOkNonAuthoritativeInformation = 203, - // 204 Request successful, nothing to return in the body - SuccessOkNoContent = 204, - // 205 Request successful, reset displayed content - SuccessOkResetContent = 205, - // 206 Request successful, partial content returned - SuccessOkPartialContent = 206, - - // 3xx Redirect code: user agent needs to go somewhere else - // 300 Redirect: different presentation forms available, take - // a pick - RedirectMultipleChoices = 300, - // 301 Redirect: requested resource has moved and now lives - // somewhere else - RedirectMovedPermanently = 301, - // 302 Redirect: Resource temporarily somewhere else, location - // might change - RedirectFound = 302, - // 303 Redirect: See other as result of a POST - RedirectSeeOther = 303, - // 304 Redirect: Resource still the same as before - RedirectNotModified = 304, - // 305 Redirect: Resource must be accessed via proxy provided - // in location field - RedirectUseProxy = 305, - // 307 Redirect: Resource temporarily somewhere else, location - // might change - RedirectMovedTemporarily = 307, - - // 4xx Client error: the client borked the request - // 400 Client error: bad request, server does not grok what - // the client wants - ClientErrorBadRequest = 400, - // 401 Client error: the client is not authorized, response - // provides WWW-Authenticate header field with a challenge - ClientErrorUnauthorized = 401, - // 402 Client error: Payment required (reserved for future use) - ClientErrorPaymentRequired = 402, - // 403 Client error: Server understood request, will not - // deliver, do not try again. - ClientErrorForbidden = 403, - // 404 Client error: Server cannot find anything matching the - // client request. - ClientErrorNotFound = 404, - // 405 Client error: The method specified by the client in the - // request is not allowed for the resource requested - ClientErrorMethodNotAllowed = 405, - // 406 Client error: Server cannot generate suitable response - // for the resource and content characteristics requested by - // the client - ClientErrorNotAcceptable = 406, - // 407 Client error: Similar to 401, Server requests that - // client authenticate itself with the proxy first - ClientErrorProxyAuthRequired = 407, - // 408 Client error: Server got impatient with client and - // decided to give up waiting for the client's request to - // arrive - ClientErrorRequestTimeout = 408, - // 409 Client error: Server could not fulfill the request for - // a resource as there is a conflict with the current state of - // the resource but thinks client can do something about this - ClientErrorConflict = 409, - // 410 Client error: The resource has moved somewhere else, - // but server has no clue where. - ClientErrorGone = 410, - // 411 Client error: The server is picky again and insists on - // having a content-length header field in the request - ClientErrorLengthRequired = 411, - // 412 Client error: one or more preconditions supplied in the - // client's request is false - ClientErrorPreconditionFailed = 412, - // 413 Client error: For fear of reflux, the server refuses to - // swallow that much data. - ClientErrorRequestEntityToLarge = 413, - // 414 Client error: The server considers the Request-URI to - // be indecently long and refuses to even look at it. - ClientErrorRequestURITooLong = 414, - // 415 Client error: The server has no clue about the media - // type requested by the client (contrary to popular belief it - // is not a warez server) - ClientErrorUnsupportedMediaType = 415, - // 416 Client error: The requested range cannot be delivered - // by the server. - ClientErrorRequestRangeNotSatisfiable = 416, - // 417 Client error: The expectations of the client as - // expressed in one or more Expect header fields cannot be met - // by the server, the server is awfully sorry about this. - ClientErrorExpectationFailed = 417, - // 499 Client error: Wildcard error. - ClientErrorJoker = 499, - - // 5xx Server errors (rare) - // 500 Server error: something really strange and unexpected - // happened - ServerErrorInternalError = 500, - // 501 Server error: The server does not do the functionality - // required to carry out the client request. not at - // all. certainly not before breakfast. but also not after - // breakfast. - ServerErrorNotImplemented = 501, - // 502 Server error: While acting as a proxy or a gateway, the - // server got ditched by the upstream server and as a - // consequence regretfully cannot fulfill the client's request - ServerErrorBadGateway = 502, - // 503 Server error: Due to unforseen circumstances the server - // cannot currently deliver the service requested. Retry-After - // header might indicate when to try again. - ServerErrorServiceUnavailable = 503, - // 504 Server error: The server blames the upstream server - // for not being able to deliver the service requested and - // claims that the upstream server is too slow delivering the - // goods. - ServerErrorGatewayTimeout = 504, - // 505 Server error: The server does not support the HTTP - // version conveyed in the client's request. - ServerErrorHttpVersionNotSupported = 505, - } -} diff --git a/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs b/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs deleted file mode 100644 index 5a3d485..0000000 --- a/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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 OpenSim 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.IO; -using System.Net; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using log4net; -using Nwc.XmlRpc; - -namespace OpenSim.Framework.Servers -{ - public delegate XmlRpcResponse OSHttpXmlRpcProcessor(XmlRpcRequest request); - - public class OSHttpXmlRpcHandler: OSHttpHandler - { - private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - /// - /// XmlRpcMethodMatch tries to reify (deserialize) an incoming - /// XmlRpc request (and posts it to the "whiteboard") and - /// checks whether the method name is one we are interested - /// in. - /// - /// true if the handler is interested in the content; - /// false otherwise - protected bool XmlRpcMethodMatch(OSHttpRequest req) - { - XmlRpcRequest xmlRpcRequest = null; - - // check whether req is already reified - // if not: reify (and post to whiteboard) - try - { - if (req.Whiteboard.ContainsKey("xmlrequest")) - { - xmlRpcRequest = req.Whiteboard["xmlrequest"] as XmlRpcRequest; - } - else - { - StreamReader body = new StreamReader(req.InputStream); - string requestBody = body.ReadToEnd(); - xmlRpcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); - req.Whiteboard["xmlrequest"] = xmlRpcRequest; - } - } - catch (XmlException) - { - _log.ErrorFormat("[OSHttpXmlRpcHandler] failed to deserialize XmlRpcRequest from {0}", req.ToString()); - return false; - } - - // check against methodName - if ((null != xmlRpcRequest) - && !String.IsNullOrEmpty(xmlRpcRequest.MethodName) - && xmlRpcRequest.MethodName == _methodName) - { - _log.DebugFormat("[OSHttpXmlRpcHandler] located handler {0} for {1}", _methodName, req.ToString()); - return true; - } - - return false; - } - - // contains handler for processing XmlRpc Request - private XmlRpcMethod _handler; - - // contains XmlRpc method name - private string _methodName; - - - /// - /// Instantiate an XmlRpc handler. - /// - /// XmlRpcMethod - /// delegate - /// XmlRpc method name - /// XmlRpc path prefix (regular expression) - /// Dictionary with header names and - /// regular expressions to match content of headers - /// IP whitelist of remote end points - /// to accept (regular expression) - /// - /// Except for handler and methodName, all other parameters - /// can be null, in which case they are not taken into account - /// when the handler is being looked up. - /// - public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName, Regex path, - Dictionary headers, Regex whitelist) - : base(new Regex(@"^POST$", RegexOptions.IgnoreCase | RegexOptions.Compiled), path, null, headers, - new Regex(@"^(text|application)/xml", RegexOptions.IgnoreCase | RegexOptions.Compiled), - whitelist) - { - _handler = handler; - _methodName = methodName; - } - - - /// - /// Instantiate an XmlRpc handler. - /// - /// XmlRpcMethod - /// delegate - /// XmlRpc method name - public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName) - : this(handler, methodName, null, null, null) - { - } - - - /// - /// Invoked by OSHttpRequestPump. - /// - public override OSHttpHandlerResult Process(OSHttpRequest request) - { - XmlRpcResponse xmlRpcResponse; - string responseString; - - // check whether we are interested in this request - if (!XmlRpcMethodMatch(request)) return OSHttpHandlerResult.Pass; - - - OSHttpResponse resp = new OSHttpResponse(request); - try - { - // reified XmlRpcRequest must still be on the whiteboard - XmlRpcRequest xmlRpcRequest = request.Whiteboard["xmlrequest"] as XmlRpcRequest; - xmlRpcResponse = _handler(xmlRpcRequest); - responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); - - resp.ContentType = "text/xml"; - byte[] buffer = Encoding.UTF8.GetBytes(responseString); - - resp.SendChunked = false; - resp.ContentLength = buffer.Length; - resp.ContentEncoding = Encoding.UTF8; - - resp.Body.Write(buffer, 0, buffer.Length); - resp.Body.Flush(); - - resp.Send(); - - } - catch (Exception ex) - { - _log.WarnFormat("[OSHttpXmlRpcHandler]: Error: {0}", ex.Message); - return OSHttpHandlerResult.Pass; - } - return OSHttpHandlerResult.Done; - } - } -} diff --git a/OpenSim/Framework/Servers/PostAssetStreamHandler.cs b/OpenSim/Framework/Servers/PostAssetStreamHandler.cs deleted file mode 100644 index 8bd3149..0000000 --- a/OpenSim/Framework/Servers/PostAssetStreamHandler.cs +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.IO; -using System.Reflection; -using System.Xml.Serialization; -using log4net; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Servers; - -namespace OpenSim.Framework.Servers -{ - public class PostAssetStreamHandler : BaseStreamHandler - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - // private OpenAsset_Main m_assetManager; - private IAssetDataPlugin m_assetProvider; - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - string param = GetParam(path); - - UUID assetId; - if (param.Length > 0) - UUID.TryParse(param, out assetId); - // byte[] txBuffer = new byte[4096]; - - XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); - AssetBase asset = (AssetBase) xs.Deserialize(request); - - m_log.InfoFormat("[REST]: Creating asset {0}", asset.FullID); - m_assetProvider.CreateAsset(asset); - - return new byte[] {}; - } - - public PostAssetStreamHandler(IAssetDataPlugin assetProvider) - : base("POST", "/assets") - { - // m_assetManager = assetManager; - m_assetProvider = assetProvider; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/RestDeserialiseHandler.cs b/OpenSim/Framework/Servers/RestDeserialiseHandler.cs deleted file mode 100644 index 1fba785..0000000 --- a/OpenSim/Framework/Servers/RestDeserialiseHandler.cs +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.IO; -using System.Xml; -using System.Xml.Serialization; -using OpenSim.Framework.Servers.Interfaces; - -namespace OpenSim.Framework.Servers -{ - public delegate TResponse RestDeserialiseMethod(TRequest request); - - public class RestDeserialiseHandler : BaseRequestHandler, IStreamHandler - where TRequest : new() - { - private RestDeserialiseMethod m_method; - - public RestDeserialiseHandler(string httpMethod, string path, RestDeserialiseMethod method) - : base(httpMethod, path) - { - m_method = method; - } - - public void Handle(string path, Stream request, Stream responseStream, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - TRequest deserial; - using (XmlTextReader xmlReader = new XmlTextReader(request)) - { - XmlSerializer deserializer = new XmlSerializer(typeof (TRequest)); - deserial = (TRequest) deserializer.Deserialize(xmlReader); - } - - TResponse response = m_method(deserial); - - using (XmlWriter xmlWriter = XmlTextWriter.Create(responseStream)) - { - XmlSerializer serializer = new XmlSerializer(typeof (TResponse)); - serializer.Serialize(xmlWriter, response); - } - } - } -} diff --git a/OpenSim/Framework/Servers/RestHTTPHandler.cs b/OpenSim/Framework/Servers/RestHTTPHandler.cs deleted file mode 100644 index 5722885..0000000 --- a/OpenSim/Framework/Servers/RestHTTPHandler.cs +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 OpenSim 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.Collections; - -namespace OpenSim.Framework.Servers -{ - public class RestHTTPHandler : BaseHTTPHandler - { - private GenericHTTPMethod m_dhttpMethod; - - public GenericHTTPMethod Method - { - get { return m_dhttpMethod; } - } - - public override Hashtable Handle(string path, Hashtable request) - { - - string param = GetParam(path); - request.Add("param", param); - request.Add("path", path); - return m_dhttpMethod(request); - } - - public RestHTTPHandler(string httpMethod, string path, GenericHTTPMethod dhttpMethod) - : base(httpMethod, path) - { - m_dhttpMethod = dhttpMethod; - } - } -} diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs deleted file mode 100644 index e58e270..0000000 --- a/OpenSim/Framework/Servers/RestMethod.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 OpenSim 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. - */ - -namespace OpenSim.Framework.Servers -{ - public delegate string RestMethod(string request, string path, string param, - OSHttpRequest httpRequest, OSHttpResponse httpResponse); -} diff --git a/OpenSim/Framework/Servers/RestObjectPoster.cs b/OpenSim/Framework/Servers/RestObjectPoster.cs deleted file mode 100644 index c449d01..0000000 --- a/OpenSim/Framework/Servers/RestObjectPoster.cs +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 OpenSim 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.IO; -using System.Net; -using System.Text; -using System.Xml; -using System.Xml.Serialization; - -namespace OpenSim.Framework.Servers -{ - /// - /// Makes an asynchronous REST request which doesn't require us to do anything with the response. - /// - public class RestObjectPoster - { - public static void BeginPostObject(string requestUrl, TRequest obj) - { - BeginPostObject("POST", requestUrl, obj); - } - - public static void BeginPostObject(string verb, string requestUrl, TRequest obj) - { - Type type = typeof (TRequest); - - WebRequest request = WebRequest.Create(requestUrl); - request.Method = verb; - request.ContentType = "text/xml"; - - MemoryStream buffer = new MemoryStream(); - - XmlWriterSettings settings = new XmlWriterSettings(); - settings.Encoding = Encoding.UTF8; - - using (XmlWriter writer = XmlWriter.Create(buffer, settings)) - { - XmlSerializer serializer = new XmlSerializer(type); - serializer.Serialize(writer, obj); - writer.Flush(); - } - - int length = (int) buffer.Length; - request.ContentLength = length; - - Stream requestStream = request.GetRequestStream(); - requestStream.Write(buffer.ToArray(), 0, length); - // IAsyncResult result = request.BeginGetResponse(AsyncCallback, request); - request.BeginGetResponse(AsyncCallback, request); - } - - private static void AsyncCallback(IAsyncResult result) - { - WebRequest request = (WebRequest) result.AsyncState; - using (WebResponse resp = request.EndGetResponse(result)) - { - } - } - } -} diff --git a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs deleted file mode 100644 index 0d07f15..0000000 --- a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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 OpenSim 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.IO; -using System.Net; -using System.Text; -using System.Xml; -using System.Xml.Serialization; - -namespace OpenSim.Framework.Servers -{ - public delegate void ReturnResponse(T reponse); - - /// - /// Makes an asynchronous REST request with a callback to invoke with the response. - /// - public class RestObjectPosterResponse - { -// private static readonly log4net.ILog m_log -// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - public ReturnResponse ResponseCallback; - - public void BeginPostObject(string requestUrl, TRequest obj) - { - BeginPostObject("POST", requestUrl, obj); - } - - public void BeginPostObject(string verb, string requestUrl, TRequest obj) - { - Type type = typeof (TRequest); - - WebRequest request = WebRequest.Create(requestUrl); - request.Method = verb; - request.ContentType = "text/xml"; - request.Timeout = 10000; - - MemoryStream buffer = new MemoryStream(); - - XmlWriterSettings settings = new XmlWriterSettings(); - settings.Encoding = Encoding.UTF8; - - using (XmlWriter writer = XmlWriter.Create(buffer, settings)) - { - XmlSerializer serializer = new XmlSerializer(type); - serializer.Serialize(writer, obj); - writer.Flush(); - } - - int length = (int) buffer.Length; - request.ContentLength = length; - - Stream requestStream = request.GetRequestStream(); - requestStream.Write(buffer.ToArray(), 0, length); - requestStream.Close(); - // IAsyncResult result = request.BeginGetResponse(AsyncCallback, request); - request.BeginGetResponse(AsyncCallback, request); - } - - private void AsyncCallback(IAsyncResult result) - { - WebRequest request = (WebRequest) result.AsyncState; - using (WebResponse resp = request.EndGetResponse(result)) - { - TResponse deserial; - XmlSerializer deserializer = new XmlSerializer(typeof (TResponse)); - Stream stream = resp.GetResponseStream(); - - // This is currently a bad debug stanza since it gobbles us the response... -// StreamReader reader = new StreamReader(stream); -// m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd()); - - deserial = (TResponse) deserializer.Deserialize(stream); - - if (deserial != null && ResponseCallback != null) - { - ResponseCallback(deserial); - } - } - } - } -} diff --git a/OpenSim/Framework/Servers/RestSessionService.cs b/OpenSim/Framework/Servers/RestSessionService.cs deleted file mode 100644 index 6a8b614..0000000 --- a/OpenSim/Framework/Servers/RestSessionService.cs +++ /dev/null @@ -1,292 +0,0 @@ -/* - * 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.IO; -using System.Net; -using System.Reflection; -using System.Text; -using System.Xml; -using System.Xml.Serialization; -using log4net; -using OpenSim.Framework.Servers.Interfaces; - -namespace OpenSim.Framework.Servers -{ - public class RestSessionObject - { - private string sid; - private string aid; - private TRequest request_body; - - public string SessionID - { - get { return sid; } - set { sid = value; } - } - - public string AvatarID - { - get { return aid; } - set { aid = value; } - } - - public TRequest Body - { - get { return request_body; } - set { request_body = value; } - } - } - - public class SynchronousRestSessionObjectPoster - { - public static TResponse BeginPostObject(string verb, string requestUrl, TRequest obj, string sid, string aid) - { - RestSessionObject sobj = new RestSessionObject(); - sobj.SessionID = sid; - sobj.AvatarID = aid; - sobj.Body = obj; - - Type type = typeof(RestSessionObject); - - WebRequest request = WebRequest.Create(requestUrl); - request.Method = verb; - request.ContentType = "text/xml"; - - MemoryStream buffer = new MemoryStream(); - - XmlWriterSettings settings = new XmlWriterSettings(); - settings.Encoding = Encoding.UTF8; - - using (XmlWriter writer = XmlWriter.Create(buffer, settings)) - { - XmlSerializer serializer = new XmlSerializer(type); - serializer.Serialize(writer, sobj); - writer.Flush(); - } - - int length = (int)buffer.Length; - request.ContentLength = length; - - Stream requestStream = request.GetRequestStream(); - requestStream.Write(buffer.ToArray(), 0, length); - TResponse deserial = default(TResponse); - using (WebResponse resp = request.GetResponse()) - { - XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); - deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); - } - return deserial; - } - } - - public class RestSessionObjectPosterResponse - { - public ReturnResponse ResponseCallback; - - public void BeginPostObject(string requestUrl, TRequest obj, string sid, string aid) - { - BeginPostObject("POST", requestUrl, obj, sid, aid); - } - - public void BeginPostObject(string verb, string requestUrl, TRequest obj, string sid, string aid) - { - RestSessionObject sobj = new RestSessionObject(); - sobj.SessionID = sid; - sobj.AvatarID = aid; - sobj.Body = obj; - - Type type = typeof(RestSessionObject); - - WebRequest request = WebRequest.Create(requestUrl); - request.Method = verb; - request.ContentType = "text/xml"; - request.Timeout = 10000; - - MemoryStream buffer = new MemoryStream(); - - XmlWriterSettings settings = new XmlWriterSettings(); - settings.Encoding = Encoding.UTF8; - - using (XmlWriter writer = XmlWriter.Create(buffer, settings)) - { - XmlSerializer serializer = new XmlSerializer(type); - serializer.Serialize(writer, sobj); - writer.Flush(); - } - - int length = (int)buffer.Length; - request.ContentLength = length; - - Stream requestStream = request.GetRequestStream(); - requestStream.Write(buffer.ToArray(), 0, length); - requestStream.Close(); - // IAsyncResult result = request.BeginGetResponse(AsyncCallback, request); - request.BeginGetResponse(AsyncCallback, request); - } - - private void AsyncCallback(IAsyncResult result) - { - WebRequest request = (WebRequest)result.AsyncState; - using (WebResponse resp = request.EndGetResponse(result)) - { - TResponse deserial; - XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); - Stream stream = resp.GetResponseStream(); - - // This is currently a bad debug stanza since it gobbles us the response... - // StreamReader reader = new StreamReader(stream); - // m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd()); - - deserial = (TResponse)deserializer.Deserialize(stream); - - if (deserial != null && ResponseCallback != null) - { - ResponseCallback(deserial); - } - } - } - } - - public delegate bool CheckIdentityMethod(string sid, string aid); - - public class RestDeserialiseSecureHandler : BaseRequestHandler, IStreamHandler - where TRequest : new() - { - private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private RestDeserialiseMethod m_method; - private CheckIdentityMethod m_smethod; - - public RestDeserialiseSecureHandler( - string httpMethod, string path, - RestDeserialiseMethod method, CheckIdentityMethod smethod) - : base(httpMethod, path) - { - m_smethod = smethod; - m_method = method; - } - - public void Handle(string path, Stream request, Stream responseStream, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - RestSessionObject deserial = default(RestSessionObject); - bool fail = false; - - using (XmlTextReader xmlReader = new XmlTextReader(request)) - { - try - { - XmlSerializer deserializer = new XmlSerializer(typeof(RestSessionObject)); - deserial = (RestSessionObject)deserializer.Deserialize(xmlReader); - } - catch (Exception e) - { - m_log.Error("[REST]: Deserialization problem. Ignoring request. " + e); - fail = true; - } - } - - TResponse response = default(TResponse); - if (!fail && m_smethod(deserial.SessionID, deserial.AvatarID)) - { - response = m_method(deserial.Body); - } - - using (XmlWriter xmlWriter = XmlTextWriter.Create(responseStream)) - { - XmlSerializer serializer = new XmlSerializer(typeof(TResponse)); - serializer.Serialize(xmlWriter, response); - } - } - } - - public delegate bool CheckTrustedSourceMethod(IPEndPoint peer); - - public class RestDeserialiseTrustedHandler : BaseRequestHandler, IStreamHandler - where TRequest : new() - { - private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - /// - /// The operation to perform once trust has been established. - /// - /// - /// - /// - /// - private RestDeserialiseMethod m_method; - - /// - /// The method used to check whether a request is trusted. - /// - private CheckTrustedSourceMethod m_tmethod; - - public RestDeserialiseTrustedHandler(string httpMethod, string path, RestDeserialiseMethod method, CheckTrustedSourceMethod tmethod) - : base(httpMethod, path) - { - m_tmethod = tmethod; - m_method = method; - } - - public void Handle(string path, Stream request, Stream responseStream, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - TRequest deserial = default(TRequest); - bool fail = false; - - using (XmlTextReader xmlReader = new XmlTextReader(request)) - { - try - { - XmlSerializer deserializer = new XmlSerializer(typeof(TRequest)); - deserial = (TRequest)deserializer.Deserialize(xmlReader); - } - catch (Exception e) - { - m_log.Error("[REST]: Deserialization problem. Ignoring request. " + e); - fail = true; - } - } - - TResponse response = default(TResponse); - if (!fail && m_tmethod(httpRequest.RemoteIPEndPoint)) - { - response = m_method(deserial); - } - - using (XmlWriter xmlWriter = XmlTextWriter.Create(responseStream)) - { - XmlSerializer serializer = new XmlSerializer(typeof(TResponse)); - serializer.Serialize(xmlWriter, response); - } - } - } - -} diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs deleted file mode 100644 index afd7fe5..0000000 --- a/OpenSim/Framework/Servers/RestStreamHandler.cs +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.IO; -using System.Text; - -namespace OpenSim.Framework.Servers -{ - public class RestStreamHandler : BaseStreamHandler - { - private RestMethod m_restMethod; - - public RestMethod Method - { - get { return m_restMethod; } - } - - public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - Encoding encoding = Encoding.UTF8; - StreamReader streamReader = new StreamReader(request, encoding); - - string requestBody = streamReader.ReadToEnd(); - streamReader.Close(); - - string param = GetParam(path); - string responseString = m_restMethod(requestBody, path, param, httpRequest, httpResponse); - - return Encoding.UTF8.GetBytes(responseString); - } - - public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base(httpMethod, path) - { - m_restMethod = restMethod; - } - } -} diff --git a/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs b/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs deleted file mode 100644 index 1b8e4ea..0000000 --- a/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 OpenSim 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.IO; -using System.Net; -using System.Text; -using System.Xml; -using System.Xml.Serialization; - -namespace OpenSim.Framework.Servers -{ - public class SynchronousRestObjectPoster - { - /// - /// Perform a synchronous REST request. - /// - /// - /// - /// - /// - /// - /// Thrown if we encounter a network issue while posting - /// the request. You'll want to make sure you deal with this as they're not uncommon - public static TResponse BeginPostObject(string verb, string requestUrl, TRequest obj) - { - Type type = typeof (TRequest); - - WebRequest request = WebRequest.Create(requestUrl); - request.Method = verb; - request.ContentType = "text/xml"; - - MemoryStream buffer = new MemoryStream(); - - XmlWriterSettings settings = new XmlWriterSettings(); - settings.Encoding = Encoding.UTF8; - - using (XmlWriter writer = XmlWriter.Create(buffer, settings)) - { - XmlSerializer serializer = new XmlSerializer(type); - serializer.Serialize(writer, obj); - writer.Flush(); - } - - int length = (int) buffer.Length; - request.ContentLength = length; - - Stream requestStream = request.GetRequestStream(); - requestStream.Write(buffer.ToArray(), 0, length); - TResponse deserial = default(TResponse); - using (WebResponse resp = request.GetResponse()) - { - XmlSerializer deserializer = new XmlSerializer(typeof (TResponse)); - deserial = (TResponse) deserializer.Deserialize(resp.GetResponseStream()); - } - return deserial; - } - } -} diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs deleted file mode 100644 index f3872a6..0000000 --- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs +++ /dev/null @@ -1,393 +0,0 @@ -/* - * 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 OpenSim 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.Specialized; -using System.IO; -using System.Net; -using System.Net.Sockets; -using System.Text; -using HttpServer; -using HttpServer.FormDecoders; -using NUnit.Framework; -using NUnit.Framework.SyntaxHelpers; - -namespace OpenSim.Framework.Servers.Tests -{ - [TestFixture] - public class OSHttpTests - { - // we need an IHttpClientContext for our tests - public class TestHttpClientContext: IHttpClientContext - { - private bool _secured; - public bool Secured - { - get { return _secured; } - } - - public TestHttpClientContext(bool secured) - { - _secured = secured; - } - - public void Disconnect(SocketError error) {} - public void Respond(string httpVersion, HttpStatusCode statusCode, string reason, string body) {} - public void Respond(string httpVersion, HttpStatusCode statusCode, string reason) {} - public void Respond(string body) {} - public void Send(byte[] buffer) {} - public void Send(byte[] buffer, int offset, int size) {} - } - - public class TestHttpRequest: IHttpRequest - { - public bool BodyIsComplete - { - get { return true; } - } - public string[] AcceptTypes - { - get {return _acceptTypes; } - } - private string[] _acceptTypes; - public Stream Body - { - get { return _body; } - set { _body = value;} - } - private Stream _body; - public ConnectionType Connection - { - get { return _connection; } - set { _connection = value; } - } - private ConnectionType _connection; - public int ContentLength - { - get { return _contentLength; } - set { _contentLength = value; } - } - private int _contentLength; - public NameValueCollection Headers - { - get { return _headers; } - } - private NameValueCollection _headers = new NameValueCollection(); - public string HttpVersion - { - get { return _httpVersion; } - set { _httpVersion = value; } - } - private string _httpVersion = null; - public string Method - { - get { return _method; } - set { _method = value; } - } - private string _method = null; - public HttpInput QueryString - { - get { return _queryString; } - } - private HttpInput _queryString = null; - public Uri Uri - { - get { return _uri; } - set { _uri = value; } - } - private Uri _uri = null; - public string[] UriParts - { - get { return _uri.Segments; } - } - public HttpParam Param - { - get { return null; } - } - public HttpForm Form - { - get { return null; } - } - public bool IsAjax - { - get { return false; } - } - public RequestCookies Cookies - { - get { return null; } - } - - public TestHttpRequest() {} - - public TestHttpRequest(string contentEncoding, string contentType, string userAgent, - string remoteAddr, string remotePort, string[] acceptTypes, - ConnectionType connectionType, int contentLength, Uri uri) - { - _headers["content-encoding"] = contentEncoding; - _headers["content-type"] = contentType; - _headers["user-agent"] = userAgent; - _headers["remote_addr"] = remoteAddr; - _headers["remote_port"] = remotePort; - - _acceptTypes = acceptTypes; - _connection = connectionType; - _contentLength = contentLength; - _uri = uri; - } - - public void DecodeBody(FormDecoderProvider providers) {} - public void SetCookies(RequestCookies cookies) {} - public void AddHeader(string name, string value) - { - _headers.Add(name, value); - } - public int AddToBody(byte[] bytes, int offset, int length) - { - return 0; - } - public void Clear() {} - - public object Clone() - { - TestHttpRequest clone = new TestHttpRequest(); - clone._acceptTypes = _acceptTypes; - clone._connection = _connection; - clone._contentLength = _contentLength; - clone._uri = _uri; - clone._headers = new NameValueCollection(_headers); - - return clone; - } - } - - public class TestHttpResponse: IHttpResponse - { - public Stream Body - { - get { return _body; } - - set { _body = value; } - } - private Stream _body; - - public string ProtocolVersion - { - get { return _protocolVersion; } - set { _protocolVersion = value; } - } - private string _protocolVersion; - - public bool Chunked - { - get { return _chunked; } - - set { _chunked = value; } - } - private bool _chunked; - - public ConnectionType Connection - { - get { return _connection; } - - set { _connection = value; } - } - private ConnectionType _connection; - - public Encoding Encoding - { - get { return _encoding; } - - set { _encoding = value; } - } - private Encoding _encoding; - - public int KeepAlive - { - get { return _keepAlive; } - - set { _keepAlive = value; } - } - private int _keepAlive; - - public HttpStatusCode Status - { - get { return _status; } - - set { _status = value; } - } - private HttpStatusCode _status; - - public string Reason - { - get { return _reason; } - - set { _reason = value; } - } - private string _reason; - - public long ContentLength - { - get { return _contentLength; } - - set { _contentLength = value; } - } - private long _contentLength; - - public string ContentType - { - get { return _contentType; } - - set { _contentType = value; } - } - private string _contentType; - - public bool HeadersSent - { - get { return _headersSent; } - } - private bool _headersSent; - - public bool Sent - { - get { return _sent; } - } - private bool _sent; - - public ResponseCookies Cookies - { - get { return _cookies; } - } - private ResponseCookies _cookies = null; - - public TestHttpResponse() - { - _headersSent = false; - _sent = false; - } - - public void AddHeader(string name, string value) {} - public void Send() - { - if (!_headersSent) SendHeaders(); - if (_sent) throw new InvalidOperationException("stuff already sent"); - _sent = true; - } - - public void SendBody(byte[] buffer, int offset, int count) - { - if (!_headersSent) SendHeaders(); - _sent = true; - } - public void SendBody(byte[] buffer) - { - if (!_headersSent) SendHeaders(); - _sent = true; - } - - public void SendHeaders() - { - if (_headersSent) throw new InvalidOperationException("headers already sent"); - _headersSent = true; - } - - public void Redirect(Uri uri) {} - public void Redirect(string url) {} - } - - - public OSHttpRequest req0; - public OSHttpRequest req1; - - public OSHttpResponse rsp0; - - public IPEndPoint ipEP0; - - [TestFixtureSetUp] - public void Init() - { - TestHttpRequest threq0 = new TestHttpRequest("utf-8", "text/xml", "OpenSim Test Agent", "192.168.0.1", "4711", - new string[] {"text/xml"}, - ConnectionType.KeepAlive, 4711, - new Uri("http://127.0.0.1/admin/inventory/Dr+Who/Tardis")); - threq0.Method = "GET"; - threq0.HttpVersion = HttpHelper.HTTP10; - - TestHttpRequest threq1 = new TestHttpRequest("utf-8", "text/xml", "OpenSim Test Agent", "192.168.0.1", "4711", - new string[] {"text/xml"}, - ConnectionType.KeepAlive, 4711, - new Uri("http://127.0.0.1/admin/inventory/Dr+Who/Tardis?a=0&b=1&c=2")); - threq1.Method = "POST"; - threq1.HttpVersion = HttpHelper.HTTP11; - threq1.Headers["x-wuff"] = "wuffwuff"; - threq1.Headers["www-authenticate"] = "go away"; - - req0 = new OSHttpRequest(new TestHttpClientContext(false), threq0); - req1 = new OSHttpRequest(new TestHttpClientContext(false), threq1); - - rsp0 = new OSHttpResponse(new TestHttpResponse()); - - ipEP0 = new IPEndPoint(IPAddress.Parse("192.168.0.1"), 4711); - - } - - [Test] - public void T000_OSHttpRequest() - { - Assert.That(req0.HttpMethod, Is.EqualTo("GET")); - Assert.That(req0.ContentType, Is.EqualTo("text/xml")); - Assert.That(req0.ContentLength, Is.EqualTo(4711)); - - Assert.That(req1.HttpMethod, Is.EqualTo("POST")); - } - - [Test] - public void T001_OSHttpRequestHeaderAccess() - { - Assert.That(req1.Headers["x-wuff"], Is.EqualTo("wuffwuff")); - Assert.That(req1.Headers.Get("x-wuff"), Is.EqualTo("wuffwuff")); - - Assert.That(req1.Headers["www-authenticate"], Is.EqualTo("go away")); - Assert.That(req1.Headers.Get("www-authenticate"), Is.EqualTo("go away")); - - Assert.That(req0.RemoteIPEndPoint, Is.EqualTo(ipEP0)); - } - - [Test] - public void T002_OSHttpRequestUriParsing() - { - Assert.That(req0.RawUrl, Is.EqualTo("/admin/inventory/Dr+Who/Tardis")); - Assert.That(req1.Url.ToString(), Is.EqualTo("http://127.0.0.1/admin/inventory/Dr+Who/Tardis?a=0&b=1&c=2")); - } - - [Test] - public void T100_OSHttpResponse() - { - rsp0.ContentType = "text/xml"; - Assert.That(rsp0.ContentType, Is.EqualTo("text/xml")); - } - } -} diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs deleted file mode 100644 index bdf9354..0000000 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 OpenSim 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. - */ - -namespace OpenSim -{ - public class VersionInfo - { - /// - /// This is the OpenSim version string. Change this if you are releasing a new OpenSim version. - /// - public readonly static string Version = "OpenSimulator Server 0.6.4"; // stay with 27 chars (used in regioninfo) - - /// - /// This is the external interface version. It is separate from the OpenSimulator project version. - /// - /// This version number should be - /// increased by 1 every time a code change makes the previous OpenSimulator revision incompatible - /// with the new revision. This will usually be due to interregion or grid facing interface changes. - /// - /// Changes which are compatible with an older revision (e.g. older revisions experience degraded functionality - /// but not outright failure) do not need a version number increment. - /// - /// Having this version number allows the grid service to reject connections from regions running a version - /// of the code that is too old. - /// - /// - public readonly static int MajorInterfaceVersion = 3; - } -} diff --git a/OpenSim/Framework/Servers/XmlRpcMethod.cs b/OpenSim/Framework/Servers/XmlRpcMethod.cs deleted file mode 100644 index 6cb7d5b..0000000 --- a/OpenSim/Framework/Servers/XmlRpcMethod.cs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 OpenSim 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 Nwc.XmlRpc; - -namespace OpenSim.Framework.Servers -{ - public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request); -} diff --git a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs index 8f4b9a0..0b58825 100644 --- a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs +++ b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Reflection; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Console; using OpenSim.Framework.AssetLoader.Filesystem; using Nini.Config; diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs index 34b0565..90ea2e0 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs @@ -35,6 +35,7 @@ using System.Web; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using log4net; namespace OpenSim.Grid.AssetInventoryServer.Plugins diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs index 7f41de5..8323450 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs @@ -36,6 +36,7 @@ using OpenSim.Framework; using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization.External; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using log4net; namespace OpenSim.Grid.AssetInventoryServer.Plugins diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs index bacfe57..e4be55e 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs @@ -35,6 +35,7 @@ using System.Xml.Serialization; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using log4net; namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs index a905473..4253668 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs @@ -34,6 +34,7 @@ using System.Xml; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using log4net; namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs index c823359..b5ad1a1 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs @@ -33,7 +33,7 @@ using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; using log4net; namespace OpenSim.Grid.AssetInventoryServer.Plugins diff --git a/OpenSim/Grid/AssetInventoryServer/Utils.cs b/OpenSim/Grid/AssetInventoryServer/Utils.cs index c79a426..9bbc0bc 100644 --- a/OpenSim/Grid/AssetInventoryServer/Utils.cs +++ b/OpenSim/Grid/AssetInventoryServer/Utils.cs @@ -32,6 +32,7 @@ using System.Xml.Serialization; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Grid.AssetInventoryServer { diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index 82a6078..4a4910d 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs @@ -36,6 +36,7 @@ using OpenSim.Framework; using OpenSim.Framework.AssetLoader.Filesystem; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Statistics; namespace OpenSim.Grid.AssetServer diff --git a/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs b/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs index ee76d74..fbe12d4 100644 --- a/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs +++ b/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Grid.Communications.OGS1 { diff --git a/OpenSim/Grid/Framework/IGridServiceCore.cs b/OpenSim/Grid/Framework/IGridServiceCore.cs index 8843e83..da83ade 100644 --- a/OpenSim/Grid/Framework/IGridServiceCore.cs +++ b/OpenSim/Grid/Framework/IGridServiceCore.cs @@ -26,7 +26,7 @@ */ using System; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Grid.Framework { diff --git a/OpenSim/Grid/Framework/IGridServiceModule.cs b/OpenSim/Grid/Framework/IGridServiceModule.cs index 2d13e2a..2fdf1e4 100644 --- a/OpenSim/Grid/Framework/IGridServiceModule.cs +++ b/OpenSim/Grid/Framework/IGridServiceModule.cs @@ -26,7 +26,7 @@ */ using System; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Grid.Framework { diff --git a/OpenSim/Grid/Framework/XMPPHTTPService.cs b/OpenSim/Grid/Framework/XMPPHTTPService.cs index e87c2be..8d8defb 100644 --- a/OpenSim/Grid/Framework/XMPPHTTPService.cs +++ b/OpenSim/Grid/Framework/XMPPHTTPService.cs @@ -30,7 +30,7 @@ using System.IO; using System.Reflection; using log4net; using OpenMetaverse; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Grid.Framework { diff --git a/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs b/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs index 71e17dc..2f08756 100644 --- a/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs +++ b/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs @@ -34,6 +34,7 @@ using Nwc.XmlRpc; using log4net; using OpenSim.Data; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework; using OpenSim.Grid.Framework; diff --git a/OpenSim/Grid/GridServer.Modules/GridRestModule.cs b/OpenSim/Grid/GridServer.Modules/GridRestModule.cs index 7df6514..f0bf16a 100644 --- a/OpenSim/Grid/GridServer.Modules/GridRestModule.cs +++ b/OpenSim/Grid/GridServer.Modules/GridRestModule.cs @@ -36,7 +36,7 @@ using OpenMetaverse; using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Grid.Framework; namespace OpenSim.Grid.GridServer.Modules diff --git a/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs b/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs index ed5252e..87dafa4 100644 --- a/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs +++ b/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs @@ -38,6 +38,7 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Grid.Framework; namespace OpenSim.Grid.GridServer.Modules diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index a281a37..67bef2e 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -34,6 +34,7 @@ using log4net; using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Grid.Framework; namespace OpenSim.Grid.GridServer diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index b2ed6d3..e9a597b 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs @@ -36,6 +36,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications.Services; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Grid.InventoryServer { diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index 6fe0c8f..2b809f9 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs @@ -34,6 +34,7 @@ using log4net.Config; using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Grid.Framework; using OpenSim.Grid.MessagingServer.Modules; diff --git a/OpenSim/Grid/UserServer.Modules/GridInfoServiceModule.cs b/OpenSim/Grid/UserServer.Modules/GridInfoServiceModule.cs index 902dccd..b45d091 100644 --- a/OpenSim/Grid/UserServer.Modules/GridInfoServiceModule.cs +++ b/OpenSim/Grid/UserServer.Modules/GridInfoServiceModule.cs @@ -37,6 +37,7 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Services; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Grid.Communications.OGS1; using OpenSim.Grid.Framework; diff --git a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs index 5080405..330ced2 100644 --- a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs +++ b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs @@ -35,6 +35,7 @@ using Nwc.XmlRpc; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Grid.Framework; namespace OpenSim.Grid.UserServer.Modules diff --git a/OpenSim/Grid/UserServer.Modules/OpenIdService.cs b/OpenSim/Grid/UserServer.Modules/OpenIdService.cs index 0dd4f22..718bcdf 100644 --- a/OpenSim/Grid/UserServer.Modules/OpenIdService.cs +++ b/OpenSim/Grid/UserServer.Modules/OpenIdService.cs @@ -35,7 +35,7 @@ using DotNetOpenId; using DotNetOpenId.Provider; using OpenSim.Framework; using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Grid.UserServer.Modules { diff --git a/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs b/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs index 51f9708..039470b 100644 --- a/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs @@ -35,6 +35,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Grid.Framework; namespace OpenSim.Grid.UserServer.Modules diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs index 4811434..cbfcd78 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs @@ -40,6 +40,7 @@ using OpenSim.Framework.Communications.Services; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Capabilities; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Grid.UserServer.Modules { diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs index 13cf3dd..9eb8743 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs @@ -40,6 +40,7 @@ using OpenSim.Framework.Communications.Services; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Capabilities; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Grid.UserServer.Modules { diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs index 33b43e4..6f2720a 100644 --- a/OpenSim/Grid/UserServer.Modules/UserManager.cs +++ b/OpenSim/Grid/UserServer.Modules/UserManager.cs @@ -35,6 +35,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Grid.Framework; namespace OpenSim.Grid.UserServer.Modules diff --git a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs index a53dee7..4ed8597 100644 --- a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs +++ b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs @@ -35,6 +35,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Grid.Framework; namespace OpenSim.Grid.UserServer.Modules diff --git a/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs b/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs index 8fc474f..1684eb7 100644 --- a/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs +++ b/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs @@ -35,6 +35,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Grid.Framework; namespace OpenSim.Grid.UserServer.Modules @@ -171,4 +172,4 @@ namespace OpenSim.Grid.UserServer.Modules return FriendListItemListtoXmlRPCResponse(returndata); } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index d9185cb..b1f1787 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -38,6 +38,7 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Statistics; using OpenSim.Grid.Communications.OGS1; using OpenSim.Grid.Framework; diff --git a/OpenSim/Grid/UserServer/UserServerCommandModule.cs b/OpenSim/Grid/UserServer/UserServerCommandModule.cs index 1d74c80..93af2c3 100644 --- a/OpenSim/Grid/UserServer/UserServerCommandModule.cs +++ b/OpenSim/Grid/UserServer/UserServerCommandModule.cs @@ -38,6 +38,7 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Statistics; using OpenSim.Grid.Communications.OGS1; using OpenSim.Grid.Framework; diff --git a/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs b/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs index 9ff9cfc..118b9a8 100644 --- a/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs +++ b/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs @@ -38,6 +38,7 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Statistics; using OpenSim.Grid.Communications.OGS1; using OpenSim.Grid.Framework; diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 5ba377b..8f4eba8 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -74,6 +74,16 @@ namespace OpenSim m_gui = startupConfig.GetBoolean("gui", false); m_timedScript = startupConfig.GetString("timer_Script", "disabled"); + if (m_logFileAppender != null) + { + if (m_logFileAppender is log4net.Appender.FileAppender) + { + log4net.Appender.FileAppender appender = + (log4net.Appender.FileAppender)m_logFileAppender; + appender.File = startupConfig.GetString("LogFile", "OpenSim.log"); + m_log.InfoFormat("[LOGGING] Logging started to file {0}", appender.File); + } + } } } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index af7b707..21fd5dd 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -40,7 +40,7 @@ using OpenSim.Framework.Communications.Services; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Statistics; using OpenSim.Region.ClientStack; using OpenSim.Region.Framework; diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index c1a2dd3..cd6fbd5 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -34,6 +34,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Physics.Manager; diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs index 799ec2a..f20300e 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs @@ -32,6 +32,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Communications.OGS1; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs index 43cc16a..f5789b7 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs @@ -29,6 +29,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Communications.Local; using OpenSim.Region.Communications.OGS1; diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs index fc3a134..8adc599 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs @@ -43,6 +43,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Communications.OGS1; using OpenSim.Region.Framework.Scenes; // using OpenSim.Region.Environment.Modules.Framework; diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs index 149f381..d7d793f 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs @@ -32,7 +32,7 @@ using log4net; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Communications.OGS1; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs index 4fa5b23..4dcfb2a 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs @@ -40,6 +40,7 @@ using Nwc.XmlRpc; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Communications.Local; using OpenSim.Region.Communications.OGS1; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs index 98f5f68..e0eea71 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs @@ -35,6 +35,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Statistics; using OpenSim.Region.Communications.Local; diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 1861d52..acb7496 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -28,7 +28,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Region.Communications.Local { diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index de6bd61..d1a8749 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -28,7 +28,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Region.Communications.OGS1 { diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 46eebd5..3153435 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -37,7 +37,7 @@ using Nwc.XmlRpc; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Communications.Local; namespace OpenSim.Region.Communications.OGS1 diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 26e4a55..c9602c5 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -34,7 +34,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Statistics; namespace OpenSim.Region.Communications.OGS1 diff --git a/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs index e24f820..1486bb7 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs @@ -34,7 +34,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Statistics; namespace OpenSim.Region.Communications.OGS1 diff --git a/OpenSim/Region/CoreModules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs b/OpenSim/Region/CoreModules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs index a50eb2d..ea4a785 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; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 6e4a5e3..10bf814 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -33,6 +33,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs index a74c491..107a7f2 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs @@ -34,6 +34,7 @@ using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using Caps=OpenSim.Framework.Communications.Capabilities.Caps; diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs index 32a4e6f..2d0ed47 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs @@ -38,6 +38,7 @@ using OpenMetaverse.Packets; using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using BlockingLLSDQueue = OpenSim.Framework.BlockingQueue; diff --git a/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs b/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs index dd0223a..e738560 100644 --- a/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs +++ b/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs @@ -34,7 +34,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs b/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs index fb33dea..5266e0a 100644 --- a/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs +++ b/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs @@ -36,7 +36,7 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs index f0563da..f9a7303 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs @@ -40,7 +40,7 @@ using OpenSim.Framework.Communications.Services; using Caps = OpenSim.Framework.Communications.Capabilities.Caps; using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers; using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.CoreModules.ServiceConnectors.Interregion; diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs index 3b589f8..f21ce0f 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs @@ -39,7 +39,7 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Services; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Capabilities; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index bdaecc5..169993b 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -35,6 +35,7 @@ using Nini.Config; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index c52848d..8f1ec22 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs @@ -36,6 +36,7 @@ using Nwc.XmlRpc; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d7bd78b..ce54261 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -35,6 +35,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications.Capabilities; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Physics.Manager; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index d4e7bb6..30f35d0 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -42,6 +42,7 @@ using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Communications.Capabilities; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using Caps=OpenSim.Framework.Communications.Capabilities.Caps; diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs index 82b3826..6b22ec9 100644 --- a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs +++ b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs @@ -33,6 +33,7 @@ using log4net; using OpenMetaverse; using OpenSim.Framework.Communications.Capabilities; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Scenes; using Caps=OpenSim.Framework.Communications.Capabilities.Caps; diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs index 4ef5221..f9076ab 100644 --- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs +++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs @@ -40,7 +40,7 @@ using OpenSim.Framework.Communications.Services; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.Interfaces; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Statistics; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index ddd0c12..4723a93 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -44,6 +44,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Capabilities; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using Caps = OpenSim.Framework.Communications.Capabilities.Caps; diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs index 6e23f65..d3132d7 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs @@ -36,6 +36,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index d427401..715d295 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -39,6 +39,7 @@ using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using Mono.Data.SqliteClient; diff --git a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs index 9d28fc7..44efb8c 100644 --- a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs +++ b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs @@ -29,6 +29,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Communications.Local; using OpenSim.Data; diff --git a/prebuild.xml b/prebuild.xml index b2f695a..a852e45 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -55,6 +55,63 @@ --> + + + + ../../../../bin/ + + + + + ../../../../bin/ + + + + ../../../../bin/ + + + + + + + + + + + + + + + + + + + + + + + + + + ../../../bin/ + + + + + ../../../bin/ + + + + ../../../bin/ + + + + + + + + + @@ -308,6 +365,7 @@ + @@ -317,41 +375,11 @@ - - - - - - - - - + - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - @@ -585,6 +613,7 @@ + @@ -630,6 +659,7 @@ + @@ -671,6 +701,7 @@ + @@ -703,6 +734,7 @@ + @@ -734,6 +766,7 @@ + @@ -763,6 +796,7 @@ + @@ -794,6 +828,7 @@ + @@ -827,6 +862,7 @@ + @@ -863,6 +899,7 @@ + @@ -893,6 +930,7 @@ + @@ -924,6 +962,7 @@ + @@ -952,6 +991,7 @@ + @@ -983,6 +1023,7 @@ + @@ -1014,6 +1055,7 @@ + @@ -1051,6 +1093,7 @@ + @@ -1087,6 +1130,7 @@ + @@ -1117,6 +1161,7 @@ + @@ -1150,6 +1195,7 @@ + @@ -1190,6 +1236,7 @@ + @@ -1268,6 +1315,7 @@ + @@ -1310,6 +1358,7 @@ + @@ -1344,6 +1393,7 @@ + @@ -1451,6 +1501,7 @@ + @@ -1562,6 +1613,7 @@ + @@ -1603,6 +1655,7 @@ + @@ -1640,6 +1693,7 @@ + @@ -1675,6 +1729,7 @@ + @@ -1714,6 +1769,7 @@ + @@ -1748,6 +1804,7 @@ + @@ -1838,6 +1895,7 @@ + @@ -1870,6 +1928,7 @@ + @@ -2724,6 +2783,7 @@ + @@ -2824,6 +2884,7 @@ + @@ -3023,6 +3084,7 @@ + -- cgit v1.1