mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 19:36:07 +08:00
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.
This commit is contained in:
@@ -718,7 +718,7 @@ namespace OpenSim
|
||||
public class SimStatusHandler : IStreamedRequestHandler
|
||||
{
|
||||
public byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return Util.UTF8.GetBytes("OK");
|
||||
}
|
||||
@@ -755,7 +755,7 @@ namespace OpenSim
|
||||
}
|
||||
|
||||
public byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||
}
|
||||
@@ -796,7 +796,7 @@ namespace OpenSim
|
||||
}
|
||||
|
||||
public byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
/// <param name="httpResponse">HTTP response header object</param>
|
||||
/// <returns></returns>
|
||||
public string SeedCapRequest(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName);
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
/// <param name="httpResponse">HTTP response header object</param>
|
||||
/// <returns></returns>
|
||||
public string ScriptTaskInventory(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -685,7 +685,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public string NoteCardAgentInventory(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
//m_log.Debug("[CAPS]: NoteCardAgentInventory Request in region: " + m_regionName + "\n" + request);
|
||||
//m_log.Debug("[CAPS]: NoteCardAgentInventory Request is: " + request);
|
||||
|
||||
@@ -54,8 +54,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
m_FriendsModule = fmodule;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
public override byte[] Handle(
|
||||
string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
|
||||
@@ -1421,7 +1421,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
caps.RegisterHandler("RemoteParcelRequest",
|
||||
new RestStreamHandler("POST", capsBase + remoteParcelRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return RemoteParcelRequest(request, path, param, agentID, caps);
|
||||
}));
|
||||
@@ -1429,7 +1429,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
caps.RegisterHandler("ParcelPropertiesUpdate",
|
||||
new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ProcessPropertiesUpdate(request, path, param, agentID, caps);
|
||||
}));
|
||||
|
||||
@@ -293,7 +293,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
|
||||
/// <param name="httpResponse"></param>
|
||||
/// <returns></returns>
|
||||
protected string HandleObjectMediaMessage(
|
||||
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request);
|
||||
|
||||
@@ -474,7 +474,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
|
||||
/// <param name="httpResponse">/param>
|
||||
/// <returns></returns>
|
||||
protected string HandleObjectMediaNavigateMessage(
|
||||
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request);
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
caps.RegisterHandler("MapLayer",
|
||||
new RestStreamHandler("POST", capsBase + m_mapLayerPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return MapLayerRequest(request, path, param,
|
||||
agentID, caps);
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace OpenSim.Region.DataSnapshot
|
||||
}
|
||||
|
||||
public string OnDiscoveryAttempt(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
//Very static for now, flexible enough to add new formats
|
||||
LLSDDiscoveryResponse llsd_response = new LLSDDiscoveryResponse();
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
osXStatsURI = Util.SHA1Hash(regionInfo.osSecret);
|
||||
}
|
||||
|
||||
public byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
public byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return Util.UTF8.GetBytes(Report());
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||
caps.RegisterHandler("ProvisionVoiceAccountRequest",
|
||||
new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ProvisionVoiceAccountRequest(scene, request, path, param,
|
||||
agentID, caps);
|
||||
@@ -317,7 +317,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||
caps.RegisterHandler("ParcelVoiceInfoRequest",
|
||||
new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ParcelVoiceInfoRequest(scene, request, path, param,
|
||||
agentID, caps);
|
||||
@@ -325,7 +325,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||
caps.RegisterHandler("ChatSessionRequest",
|
||||
new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ChatSessionRequest(scene, request, path, param,
|
||||
agentID, caps);
|
||||
|
||||
@@ -421,7 +421,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
|
||||
caps.RegisterHandler("ProvisionVoiceAccountRequest",
|
||||
new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ProvisionVoiceAccountRequest(scene, request, path, param,
|
||||
agentID, caps);
|
||||
@@ -429,7 +429,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
|
||||
caps.RegisterHandler("ParcelVoiceInfoRequest",
|
||||
new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ParcelVoiceInfoRequest(scene, request, path, param,
|
||||
agentID, caps);
|
||||
@@ -437,7 +437,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
|
||||
caps.RegisterHandler("ChatSessionRequest",
|
||||
new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ChatSessionRequest(scene, request, path, param,
|
||||
agentID, caps);
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
httpResponse.ContentType = "image/jpeg";
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ namespace OpenSim.Region.UserStatistics
|
||||
caps.RegisterHandler("ViewerStats",
|
||||
new RestStreamHandler("POST", capsPath,
|
||||
delegate(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return ViewerStatsReport(request, path, param,
|
||||
agentID, caps);
|
||||
|
||||
Reference in New Issue
Block a user