return a proper http error

0.9.1.0-post-fixes
UbitUmarov 2018-12-07 04:45:32 +00:00
parent 144f353d50
commit 7b2b29d10d
1 changed files with 11 additions and 13 deletions

View File

@ -1390,7 +1390,6 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
response.KeepAlive = true;
string responseData = string.Empty;
responseData = jsonRpcResponse.Serialize();
@ -1402,6 +1401,8 @@ namespace OpenSim.Framework.Servers.HttpServer
private byte[] HandleLLSDRequests(OSHttpRequest request, OSHttpResponse response)
{
//m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request");
bool notfound = false;
Stream requestStream = request.InputStream;
string requestBody;
@ -1452,13 +1453,20 @@ namespace OpenSim.Framework.Servers.HttpServer
else
{
// Oops, no handler for this.. give em the failed message
llsdResponse = GenerateNoLLSDHandlerResponse();
notfound = true;
}
}
}
else
{
llsdResponse = GenerateNoLLSDHandlerResponse();
notfound = true;
}
if(notfound)
{
response.StatusCode = (int)HttpStatusCode.NotFound;
response.StatusDescription = "Not found";
return null;
}
byte[] buffer = new byte[0];
@ -1479,7 +1487,6 @@ namespace OpenSim.Framework.Servers.HttpServer
response.ContentLength64 = buffer.Length;
response.ContentEncoding = Encoding.UTF8;
response.KeepAlive = true;
return buffer;
}
@ -1684,15 +1691,6 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
private OSDMap GenerateNoLLSDHandlerResponse()
{
OSDMap map = new OSDMap();
map["reason"] = OSD.FromString("LLSDRequest");
map["message"] = OSD.FromString("No handler registered for LLSD Requests");
map["login"] = OSD.FromString("false");
return map;
}
public byte[] HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response)
{
// m_log.DebugFormat(