mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
mantis 8925: avoid log noise due to bad http requests
This commit is contained in:
@@ -355,7 +355,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
public void AddGenericStreamHandler(IRequestHandler handler)
|
||||
{
|
||||
if(String.IsNullOrWhiteSpace(handler.Path))
|
||||
if(string.IsNullOrWhiteSpace(handler.Path))
|
||||
return;
|
||||
|
||||
// m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey);
|
||||
@@ -1193,6 +1193,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
public void HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response)
|
||||
{
|
||||
Stream requestStream = request.InputStream;
|
||||
|
||||
response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
response.KeepAlive = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (!requestStream.CanRead)
|
||||
return;
|
||||
if (requestStream.Length == 0)
|
||||
{
|
||||
requestStream.Dispose();
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Stream innerStream = null;
|
||||
try
|
||||
{
|
||||
@@ -1210,7 +1229,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
innerStream.Dispose();
|
||||
|
||||
response.StatusCode = (int)HttpStatusCode.BadRequest;
|
||||
response.KeepAlive = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1238,19 +1256,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
|
||||
if (xmlRprcRequest == null)
|
||||
{
|
||||
response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
response.KeepAlive = false;
|
||||
return;
|
||||
}
|
||||
|
||||
string methodName = xmlRprcRequest.MethodName;
|
||||
if (string.IsNullOrWhiteSpace(methodName))
|
||||
{
|
||||
response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
response.KeepAlive = false;
|
||||
return;
|
||||
}
|
||||
|
||||
XmlRpcMethod method;
|
||||
bool methodWasFound;
|
||||
@@ -1878,8 +1888,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[BASE HTTP SERVER]: Got query paremeter {0}={1}", queryname, request.QueryString[queryname]);
|
||||
keysvals.Add(queryname, request.QueryString[queryname]);
|
||||
requestVars.Add(queryname, keysvals[queryname]);
|
||||
if(!string.IsNullOrEmpty(queryname))
|
||||
{
|
||||
keysvals.Add(queryname, request.QueryString[queryname]);
|
||||
requestVars.Add(queryname, keysvals[queryname]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string headername in rHeaders)
|
||||
@@ -1947,7 +1960,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(bestMatch))
|
||||
if (string.IsNullOrEmpty(bestMatch))
|
||||
{
|
||||
httpHandler = null;
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user