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() public List<string> GetXmlRpcHandlerKeys()
{ {
lock (m_rpcHandlers) lock (m_rpcHandlers)
@ -764,13 +774,6 @@ namespace OpenSim.Framework.Servers.HttpServer
case "application/xml": case "application/xml":
case "application/json": case "application/json":
default: 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 (DoWeHaveALLSDHandler(request.RawUrl))
{ {
if (DebugLevel >= 3) if (DebugLevel >= 3)
@ -1099,7 +1102,7 @@ namespace OpenSim.Framework.Servers.HttpServer
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="response"></param> /// <param name="response"></param>
private void HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response) public void HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response)
{ {
String requestBody; String requestBody;
@ -1253,7 +1256,7 @@ namespace OpenSim.Framework.Servers.HttpServer
response.KeepAlive = keepAlive; response.KeepAlive = keepAlive;
response.ContentType = "text/xml"; response.ContentType = "text/xml";
//string responseString = String.Empty; string responseString = String.Empty;
using (MemoryStream outs = new MemoryStream()) using (MemoryStream outs = new MemoryStream())
{ {
using (XmlTextWriter writer = new XmlTextWriter(outs, UTF8NoBOM)) using (XmlTextWriter writer = new XmlTextWriter(outs, UTF8NoBOM))
@ -1261,14 +1264,13 @@ namespace OpenSim.Framework.Servers.HttpServer
writer.Formatting = Formatting.None; writer.Formatting = Formatting.None;
XmlRpcResponseSerializer.Singleton.Serialize(writer, xmlRpcResponse); XmlRpcResponseSerializer.Singleton.Serialize(writer, xmlRpcResponse);
writer.Flush(); writer.Flush();
//outs.Seek(0, SeekOrigin.Begin); outs.Seek(0, SeekOrigin.Begin);
//using (StreamReader sr = new StreamReader(outs)) using (StreamReader sr = new StreamReader(outs))
// responseString = sr.ReadToEnd(); responseString = sr.ReadToEnd();
response.RawBuffer = outs.ToArray();
} }
} }
//response.RawBuffer = Encoding.UTF8.GetBytes(responseString); response.RawBuffer = Util.UTF8NBGetbytes(responseString);
response.StatusCode = (int)HttpStatusCode.OK; 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); Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id);
req.DoHTTPGruntWork(responsedata); req.DoHTTPGruntWork(responsedata);
} }
catch (ObjectDisposedException) { } catch { }
} }
else else
{ {
@ -190,7 +190,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
req.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); req.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
} }
catch (ObjectDisposedException) { } catch { }
} }
else else
{ {