make httpserver HandleXmlRpcRequests public

master
UbitUmarov 2020-05-08 05:26:25 +01:00
parent f70f0b5ffd
commit bf218f2cef
2 changed files with 18 additions and 16 deletions

View File

@ -421,6 +421,16 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
public bool TryGetXmlRPCHandler(string method, out XmlRpcMethod handler)
{
lock (m_rpcHandlers)
{
if(m_rpcHandlers.TryGetValue(method, out handler))
return true;
}
return false;
}
public List<string> GetXmlRpcHandlerKeys()
{
lock (m_rpcHandlers)
@ -764,13 +774,6 @@ namespace OpenSim.Framework.Servers.HttpServer
case "application/xml":
case "application/json":
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))
{
if (DebugLevel >= 3)
@ -1099,7 +1102,7 @@ namespace OpenSim.Framework.Servers.HttpServer
/// </summary>
/// <param name="request"></param>
/// <param name="response"></param>
private void HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response)
public void HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response)
{
String requestBody;
@ -1253,7 +1256,7 @@ namespace OpenSim.Framework.Servers.HttpServer
response.KeepAlive = keepAlive;
response.ContentType = "text/xml";
//string responseString = String.Empty;
string responseString = String.Empty;
using (MemoryStream outs = new MemoryStream())
{
using (XmlTextWriter writer = new XmlTextWriter(outs, UTF8NoBOM))
@ -1261,14 +1264,13 @@ namespace OpenSim.Framework.Servers.HttpServer
writer.Formatting = Formatting.None;
XmlRpcResponseSerializer.Singleton.Serialize(writer, xmlRpcResponse);
writer.Flush();
//outs.Seek(0, SeekOrigin.Begin);
//using (StreamReader sr = new StreamReader(outs))
// responseString = sr.ReadToEnd();
response.RawBuffer = outs.ToArray();
outs.Seek(0, SeekOrigin.Begin);
using (StreamReader sr = new StreamReader(outs))
responseString = sr.ReadToEnd();
}
}
//response.RawBuffer = Encoding.UTF8.GetBytes(responseString);
response.RawBuffer = Util.UTF8NBGetbytes(responseString);
response.StatusCode = (int)HttpStatusCode.OK;
}

View File

@ -180,7 +180,7 @@ namespace OpenSim.Framework.Servers.HttpServer
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id);
req.DoHTTPGruntWork(responsedata);
}
catch (ObjectDisposedException) { }
catch { }
}
else
{
@ -190,7 +190,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
req.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
}
catch (ObjectDisposedException) { }
catch { }
}
else
{