aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2009-09-21 19:46:29 +0100
committerMelanie2009-09-21 19:46:29 +0100
commit69b76acce1abc87dbeafa6d0773637682ce4e1d4 (patch)
tree426bcb1431a851e880acd07a34dac0080b036741
parentMerge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-69b76acce1abc87dbeafa6d0773637682ce4e1d4.zip
opensim-SC-69b76acce1abc87dbeafa6d0773637682ce4e1d4.tar.gz
opensim-SC-69b76acce1abc87dbeafa6d0773637682ce4e1d4.tar.bz2
opensim-SC-69b76acce1abc87dbeafa6d0773637682ce4e1d4.tar.xz
Make the poll service handler call the handler method on incoming requests.
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs39
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs7
2 files changed, 36 insertions, 10 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 771ae05..b73557f 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -260,7 +260,9 @@ namespace OpenSim.Framework.Servers.HttpServer
260 PollServiceEventArgs psEvArgs; 260 PollServiceEventArgs psEvArgs;
261 if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs)) 261 if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs))
262 { 262 {
263 OSHttpRequest req = new OSHttpRequest(context, request);
263 264
265 HandleRequest(req, null);
264 m_PollServiceManager.Enqueue(new PollServiceHttpRequest(psEvArgs, context, request)); 266 m_PollServiceManager.Enqueue(new PollServiceHttpRequest(psEvArgs, context, request));
265 //DoHTTPGruntWork(psEvArgs.NoEvents(),new OSHttpResponse(new HttpResponse(context, request))); 267 //DoHTTPGruntWork(psEvArgs.NoEvents(),new OSHttpResponse(new HttpResponse(context, request)));
266 } 268 }
@@ -332,19 +334,26 @@ namespace OpenSim.Framework.Servers.HttpServer
332 // probability event; if a request is matched it is normally expected to be 334 // probability event; if a request is matched it is normally expected to be
333 // handled 335 // handled
334 //m_log.Debug("[BASE HTTP SERVER]: Handling Request" + request.RawUrl); 336 //m_log.Debug("[BASE HTTP SERVER]: Handling Request" + request.RawUrl);
335 IHttpAgentHandler agentHandler;
336 337
337 if (TryGetAgentHandler(request, response, out agentHandler)) 338 // If the response is null, then we're not going to respond here. This case
339 // triggers when we're at the head of a HTTP poll
340 //
341 if (response != null)
338 { 342 {
339 if (HandleAgentRequest(agentHandler, request, response)) 343 IHttpAgentHandler agentHandler;
344
345 if (TryGetAgentHandler(request, response, out agentHandler))
340 { 346 {
341 return; 347 if (HandleAgentRequest(agentHandler, request, response))
348 {
349 return;
350 }
342 } 351 }
343 }
344 352
353 //response.KeepAlive = true;
354 response.SendChunked = false;
355 }
345 IRequestHandler requestHandler; 356 IRequestHandler requestHandler;
346 //response.KeepAlive = true;
347 response.SendChunked = false;
348 357
349 string path = request.RawUrl; 358 string path = request.RawUrl;
350 string handlerKey = GetHandlerKey(request.HttpMethod, path); 359 string handlerKey = GetHandlerKey(request.HttpMethod, path);
@@ -357,7 +366,9 @@ namespace OpenSim.Framework.Servers.HttpServer
357 // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. 366 // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler.
358 byte[] buffer = null; 367 byte[] buffer = null;
359 368
360 response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. 369 if (response != null)
370 response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
371
361 372
362 if (requestHandler is IStreamedRequestHandler) 373 if (requestHandler is IStreamedRequestHandler)
363 { 374 {
@@ -411,7 +422,12 @@ namespace OpenSim.Framework.Servers.HttpServer
411 //m_log.Warn("[HTTP]: " + requestBody); 422 //m_log.Warn("[HTTP]: " + requestBody);
412 423
413 } 424 }
414 DoHTTPGruntWork(HTTPRequestHandler.Handle(path, keysvals), response); 425 // If we're not responding, we dont' care about the reply
426 //
427 if (response == null)
428 HTTPRequestHandler.Handle(path, keysvals);
429 else
430 DoHTTPGruntWork(HTTPRequestHandler.Handle(path, keysvals), response);
415 return; 431 return;
416 } 432 }
417 else 433 else
@@ -426,6 +442,11 @@ namespace OpenSim.Framework.Servers.HttpServer
426 } 442 }
427 } 443 }
428 444
445 // The handler has run and we're not yet ready to respond, bail
446 //
447 if (response == null)
448 return;
449
429 request.InputStream.Close(); 450 request.InputStream.Close();
430 451
431 // HTTP IN support. The script engine taes it from here 452 // HTTP IN support. The script engine taes it from here
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 55ea4b7..57c5198 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -316,7 +316,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
316 316
317 // This will persist this beyond the expiry of the caps handlers 317 // This will persist this beyond the expiry of the caps handlers
318 MainServer.Instance.AddPollServiceHTTPHandler( 318 MainServer.Instance.AddPollServiceHTTPHandler(
319 capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePath2, new PollServiceEventArgs(HasEvents, GetEvents, NoEvents, agentID)); 319 capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePoll, new PollServiceEventArgs(HasEvents, GetEvents, NoEvents, agentID));
320 320
321 Random rnd = new Random(Environment.TickCount); 321 Random rnd = new Random(Environment.TickCount);
322 lock (m_ids) 322 lock (m_ids)
@@ -491,6 +491,11 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
491 return responsedata; 491 return responsedata;
492 } 492 }
493 493
494 public Hashtable EventQueuePoll(Hashtable request)
495 {
496 return new Hashtable();
497 }
498
494 public Hashtable EventQueuePath2(Hashtable request) 499 public Hashtable EventQueuePath2(Hashtable request)
495 { 500 {
496 string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/",""); 501 string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/","");