add SimpleStrem(Request)Handler, for simple uripaths, any method or query

This commit is contained in:
UbitUmarov
2020-04-23 18:23:43 +01:00
parent e818c570bb
commit 0fe51f34c2
5 changed files with 216 additions and 17 deletions

View File

@@ -618,24 +618,35 @@ namespace OpenSim.Framework.Servers.HttpServer
Culture.SetCurrentCulture();
// // This is the REST agent interface. We require an agent to properly identify
// // itself. If the REST handler recognizes the prefix it will attempt to
// // satisfy the request. If it is not recognizable, and no damage has occurred
// // the request can be passed through to the other handlers. This is a low
// // probability event; if a request is matched it is normally expected to be
// // handled
// IHttpAgentHandler agentHandler;
//
// if (TryGetAgentHandler(request, response, out agentHandler))
// {
// if (HandleAgentRequest(agentHandler, request, response))
// {
// requestEndTick = Environment.TickCount;
// return;
// }
// }
// // This is the REST agent interface. We require an agent to properly identify
// // itself. If the REST handler recognizes the prefix it will attempt to
// // satisfy the request. If it is not recognizable, and no damage has occurred
// // the request can be passed through to the other handlers. This is a low
// // probability event; if a request is matched it is normally expected to be
// // handled
// IHttpAgentHandler agentHandler;
//
// if (TryGetAgentHandler(request, response, out agentHandler))
// {
// if (HandleAgentRequest(agentHandler, request, response))
// {
// requestEndTick = Environment.TickCount;
// return;
// }
// }
string path = request.UriPath;
if (!string.IsNullOrWhiteSpace(path) && TryGetSimpleStreamHandler(path, out ISimpleStreamHandler hdr))
{
hdr.Handle(request, response);
if (request.InputStream != null && request.InputStream.CanRead)
request.InputStream.Dispose();
string path = request.RawUrl;
requestEndTick = Environment.TickCount;
response.Send();
return;
}
path = request.RawUrl;
string handlerKey = GetHandlerKey(request.HttpMethod, path);
byte[] buffer = null;