Make the poll service handler call the handler method on incoming requests.

remotes/origin/0.6.7-post-fixes
Melanie 2009-09-21 19:46:29 +01:00
parent 5511c62580
commit 69b76acce1
2 changed files with 38 additions and 12 deletions

View File

@ -260,7 +260,9 @@ namespace OpenSim.Framework.Servers.HttpServer
PollServiceEventArgs psEvArgs; PollServiceEventArgs psEvArgs;
if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs)) if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs))
{ {
OSHttpRequest req = new OSHttpRequest(context, request);
HandleRequest(req, null);
m_PollServiceManager.Enqueue(new PollServiceHttpRequest(psEvArgs, context, request)); m_PollServiceManager.Enqueue(new PollServiceHttpRequest(psEvArgs, context, request));
//DoHTTPGruntWork(psEvArgs.NoEvents(),new OSHttpResponse(new HttpResponse(context, request))); //DoHTTPGruntWork(psEvArgs.NoEvents(),new OSHttpResponse(new HttpResponse(context, request)));
} }
@ -332,6 +334,12 @@ namespace OpenSim.Framework.Servers.HttpServer
// probability event; if a request is matched it is normally expected to be // probability event; if a request is matched it is normally expected to be
// handled // handled
//m_log.Debug("[BASE HTTP SERVER]: Handling Request" + request.RawUrl); //m_log.Debug("[BASE HTTP SERVER]: Handling Request" + request.RawUrl);
// If the response is null, then we're not going to respond here. This case
// triggers when we're at the head of a HTTP poll
//
if (response != null)
{
IHttpAgentHandler agentHandler; IHttpAgentHandler agentHandler;
if (TryGetAgentHandler(request, response, out agentHandler)) if (TryGetAgentHandler(request, response, out agentHandler))
@ -342,9 +350,10 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
} }
IRequestHandler requestHandler;
//response.KeepAlive = true; //response.KeepAlive = true;
response.SendChunked = false; response.SendChunked = false;
}
IRequestHandler requestHandler;
string path = request.RawUrl; string path = request.RawUrl;
string handlerKey = GetHandlerKey(request.HttpMethod, path); string handlerKey = GetHandlerKey(request.HttpMethod, path);
@ -357,8 +366,10 @@ namespace OpenSim.Framework.Servers.HttpServer
// Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler.
byte[] buffer = null; byte[] buffer = null;
if (response != null)
response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
if (requestHandler is IStreamedRequestHandler) if (requestHandler is IStreamedRequestHandler)
{ {
IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler;
@ -411,6 +422,11 @@ namespace OpenSim.Framework.Servers.HttpServer
//m_log.Warn("[HTTP]: " + requestBody); //m_log.Warn("[HTTP]: " + requestBody);
} }
// If we're not responding, we dont' care about the reply
//
if (response == null)
HTTPRequestHandler.Handle(path, keysvals);
else
DoHTTPGruntWork(HTTPRequestHandler.Handle(path, keysvals), response); DoHTTPGruntWork(HTTPRequestHandler.Handle(path, keysvals), response);
return; return;
} }
@ -426,6 +442,11 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
} }
// The handler has run and we're not yet ready to respond, bail
//
if (response == null)
return;
request.InputStream.Close(); request.InputStream.Close();
// HTTP IN support. The script engine taes it from here // HTTP IN support. The script engine taes it from here

View File

@ -316,7 +316,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
// This will persist this beyond the expiry of the caps handlers // This will persist this beyond the expiry of the caps handlers
MainServer.Instance.AddPollServiceHTTPHandler( MainServer.Instance.AddPollServiceHTTPHandler(
capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePath2, new PollServiceEventArgs(HasEvents, GetEvents, NoEvents, agentID)); capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePoll, new PollServiceEventArgs(HasEvents, GetEvents, NoEvents, agentID));
Random rnd = new Random(Environment.TickCount); Random rnd = new Random(Environment.TickCount);
lock (m_ids) lock (m_ids)
@ -491,6 +491,11 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
return responsedata; return responsedata;
} }
public Hashtable EventQueuePoll(Hashtable request)
{
return new Hashtable();
}
public Hashtable EventQueuePath2(Hashtable request) public Hashtable EventQueuePath2(Hashtable request)
{ {
string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/",""); string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/","");