SampleMoneyModule: add private xmlrpc methods

This commit is contained in:
UbitUmarov
2020-05-08 14:50:46 +01:00
parent c2c00c5d84
commit 72c1c923f8
2 changed files with 34 additions and 10 deletions

View File

@@ -1104,7 +1104,7 @@ namespace OpenSim.Framework.Servers.HttpServer
/// <param name="response"></param>
public void HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response)
{
String requestBody;
String requestBody = null;
Stream requestStream = request.InputStream;
Stream innerStream = null;
@@ -1119,6 +1119,10 @@ namespace OpenSim.Framework.Servers.HttpServer
using (StreamReader reader = new StreamReader(requestStream, Encoding.UTF8))
requestBody = reader.ReadToEnd();
}
catch
{
requestBody = null;
}
finally
{
if (innerStream != null && innerStream.CanRead)
@@ -1127,6 +1131,13 @@ namespace OpenSim.Framework.Servers.HttpServer
requestStream.Dispose();
}
if (string.IsNullOrWhiteSpace(requestBody))
{
response.StatusCode = (int)HttpStatusCode.NotFound;
response.KeepAlive = false;
return;
}
//m_log.Debug(requestBody);
requestBody = requestBody.Replace("<base64></base64>", "");
@@ -1274,9 +1285,9 @@ namespace OpenSim.Framework.Servers.HttpServer
response.StatusCode = (int)HttpStatusCode.OK;
}
public void HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response, Dictionary<string, XmlRpcMethod> rpchandlers)
public void HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response, Dictionary<string, XmlRpcMethod> rpcHandlers)
{
String requestBody;
String requestBody = null;
Stream requestStream = request.InputStream;
Stream innerStream = null;
@@ -1291,6 +1302,10 @@ namespace OpenSim.Framework.Servers.HttpServer
using (StreamReader reader = new StreamReader(requestStream, Encoding.UTF8))
requestBody = reader.ReadToEnd();
}
catch
{
requestBody = null;
}
finally
{
if (innerStream != null && innerStream.CanRead)
@@ -1299,6 +1314,13 @@ namespace OpenSim.Framework.Servers.HttpServer
requestStream.Dispose();
}
if (string.IsNullOrWhiteSpace(requestBody))
{
response.StatusCode = (int)HttpStatusCode.NotFound;
response.KeepAlive = false;
return;
}
//m_log.Debug(requestBody);
requestBody = requestBody.Replace("<base64></base64>", "");
@@ -1357,7 +1379,7 @@ namespace OpenSim.Framework.Servers.HttpServer
XmlRpcMethod method;
bool methodWasFound;
methodWasFound = rpchandlers.TryGetValue(methodName, out method);
methodWasFound = rpcHandlers.TryGetValue(methodName, out method);
XmlRpcResponse xmlRpcResponse;
if (methodWasFound)