diff options
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 39 |
1 files changed, 30 insertions, 9 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 |