From bf218f2ceffa82047aded9cf52cd9597233be79c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 8 May 2020 05:26:25 +0100 Subject: [PATCH] make httpserver HandleXmlRpcRequests public --- .../Servers/HttpServer/BaseHttpServer.cs | 30 ++++++++++--------- .../HttpServer/PollServiceRequestManager.cs | 4 +-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 913f307822..c409ae201f 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -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 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 /// /// /// - 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; } diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 48eefe622d..98372211b3 100755 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -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 {