From 4567555c49cb560dd6f109bbfec42086af3de56f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 5 Dec 2011 20:44:20 +0000
Subject: Implement IOSHttpRequest and IOSHttpResponse http interfaces and use
instead of OSHttpRequest/OSHttpResponse.
This is required for the substitution of different HTTP servers or the newer HttpServer.dll without having to commit to a particular implementation.
This is also required to write regression tests that involve the HTTP layer.
If you need to recompile, all you need to do is replace OSHttpRequest/OSHttpResponse references with IOSHttpRequest/IOSHttpResponse.
---
OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs | 2 +-
OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs | 2 +-
OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs | 2 +-
.../Handlers/Authentication/AuthenticationServerPostHandler.cs | 2 +-
OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs | 2 +-
.../Handlers/Authorization/AuthorizationServerPostHandler.cs | 2 +-
OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs | 2 +-
OpenSim/Server/Handlers/Base/Utils.cs | 2 +-
OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs | 2 +-
OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | 2 +-
OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 2 +-
OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | 2 +-
OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs | 2 +-
OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs | 8 ++++----
.../Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs | 2 +-
OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 2 +-
OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 2 +-
OpenSim/Server/Handlers/Map/MapGetServerConnector.cs | 2 +-
OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs | 8 ++++----
OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | 2 +-
OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 4 ++--
.../Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs | 2 +-
22 files changed, 29 insertions(+), 29 deletions(-)
(limited to 'OpenSim/Server')
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
index 8014fb5..0cfe5b1 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Asset
}
public override byte[] Handle(string path, Stream request,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
bool result = false;
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
index 43c1693..8f7412b 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Server.Handlers.Asset
}
public override byte[] Handle(string path, Stream request,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
byte[] result = new byte[0];
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
index 1fcd3ed..87b3d2d 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Server.Handlers.Asset
}
public override byte[] Handle(string path, Stream request,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
AssetBase asset = (AssetBase) xs.Deserialize(request);
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
index 4d1b0ff..a19b599 100644
--- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Server.Handlers.Authentication
}
public override byte[] Handle(string path, Stream request,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
string[] p = SplitParams(path);
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
index e73961b..440b898 100644
--- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
@@ -219,7 +219,7 @@ For more information, see http://openid.net/.
/// Handles all GET and POST requests for OpenID identifier pages and endpoint
/// server communication
///
- public void Handle(string path, Stream request, Stream response, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ public void Handle(string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath));
diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
index d656238..bcf9d47 100644
--- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Server.Handlers.Authorization
}
public override byte[] Handle(string path, Stream request,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest));
AuthorizationRequest Authorization = (AuthorizationRequest) xs.Deserialize(request);
diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
index 49c2e43..3ee405c 100644
--- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Avatar
}
public override byte[] Handle(string path, Stream requestData,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
diff --git a/OpenSim/Server/Handlers/Base/Utils.cs b/OpenSim/Server/Handlers/Base/Utils.cs
index 92372a0..48d923f 100644
--- a/OpenSim/Server/Handlers/Base/Utils.cs
+++ b/OpenSim/Server/Handlers/Base/Utils.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Server.Handlers.Base
}
}
- public static bool GetAuthentication(OSHttpRequest httpRequest, out string authority, out string authKey)
+ public static bool GetAuthentication(IOSHttpRequest httpRequest, out string authority, out string authKey)
{
authority = string.Empty;
authKey = string.Empty;
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
index fc97d8c..59420f5 100644
--- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Server.Handlers.Friends
}
public override byte[] Handle(string path, Stream requestData,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
index afe2f27..645a77f 100644
--- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
+++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
@@ -129,7 +129,7 @@ namespace OpenSim.Server.Handlers.Grid
}
public string RestGetGridInfoMethod(string request, string path, string param,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StringBuilder sb = new StringBuilder();
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index edc0561..bebf482 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Server.Handlers.Grid
}
public override byte[] Handle(string path, Stream requestData,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
index 485bc3e..4c0d52e 100644
--- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.GridUser
}
public override byte[] Handle(string path, Stream requestData,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
index 56f130e..661507e 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
}
public override byte[] Handle(string path, Stream requestData,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
index 4accea1..f306b1c 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
@@ -63,12 +63,12 @@ namespace OpenSim.Server.Handlers.Hypergrid
}
public override byte[] Handle(string path, Stream requestData,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
return OKResponse(httpResponse);
}
- private byte[] OKResponse(OSHttpResponse httpResponse)
+ private byte[] OKResponse(IOSHttpResponse httpResponse)
{
m_log.Debug("[HELO]: hi, GET was called");
httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType);
@@ -92,12 +92,12 @@ namespace OpenSim.Server.Handlers.Hypergrid
}
public override byte[] Handle(string path, Stream requestData,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
return OKResponse(httpResponse);
}
- private byte[] OKResponse(OSHttpResponse httpResponse)
+ private byte[] OKResponse(IOSHttpResponse httpResponse)
{
m_log.Debug("[HELO]: hi, HEAD was called");
httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType);
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
index 850bf14..231e32f 100644
--- a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
+++ b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Inventory
}
public override byte[] Handle(string path, Stream request,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
XmlSerializer xs = new XmlSerializer(typeof (List));
List items = (List)xs.Deserialize(request);
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index 899f9c0..9d6f964 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Server.Handlers.Asset
}
public override byte[] Handle(string path, Stream requestData,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
index 8291107..75dd711 100644
--- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
@@ -77,7 +77,7 @@ namespace OpenSim.Server.Handlers.MapImage
m_MapService = service;
}
- public override byte[] Handle(string path, Stream requestData, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
index 501074d..fb85d1c 100644
--- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Server.Handlers.MapImage
m_MapService = service;
}
- public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
byte[] result = new byte[0];
diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
index 68bb01e..8a1f824 100644
--- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
+++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Server.Handlers.Neighbour
}
public override byte[] Handle(string path, Stream request,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Not implemented yet
Console.WriteLine("--- Get region --- " + path);
@@ -84,7 +84,7 @@ namespace OpenSim.Server.Handlers.Neighbour
}
public override byte[] Handle(string path, Stream request,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
byte[] result = new byte[0];
@@ -177,7 +177,7 @@ namespace OpenSim.Server.Handlers.Neighbour
}
public override byte[] Handle(string path, Stream request,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Not implemented yet
httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented;
@@ -198,7 +198,7 @@ namespace OpenSim.Server.Handlers.Neighbour
}
public override byte[] Handle(string path, Stream request,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Not implemented yet
httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented;
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
index 85bf96e..6b6a552 100644
--- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Presence
}
public override byte[] Handle(string path, Stream requestData,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index fdb4967..1d1f9ef 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -249,7 +249,7 @@ namespace OpenSim.Server.Handlers.Simulation
}
public override byte[] Handle(string path, Stream request,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[SIMULATION]: Stream handler called");
@@ -436,7 +436,7 @@ namespace OpenSim.Server.Handlers.Simulation
}
public override byte[] Handle(string path, Stream request,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[SIMULATION]: Stream handler called");
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
index 5ab4caf..ab383ef 100644
--- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
}
public override byte[] Handle(string path, Stream requestData,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
--
cgit v1.1