diff options
author | Teravus Ovares | 2008-10-03 20:38:32 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-10-03 20:38:32 +0000 |
commit | ca125bcf1569507fc798f6e25b8d70ef2652b83c (patch) | |
tree | a1d4341236c4b6129b8b1dc5fec9bc23d9ef67ec | |
parent | * Fixes a http protocol violation in HttpServer in Linux. StringWriter.Appe... (diff) | |
download | opensim-SC-ca125bcf1569507fc798f6e25b8d70ef2652b83c.zip opensim-SC-ca125bcf1569507fc798f6e25b8d70ef2652b83c.tar.gz opensim-SC-ca125bcf1569507fc798f6e25b8d70ef2652b83c.tar.bz2 opensim-SC-ca125bcf1569507fc798f6e25b8d70ef2652b83c.tar.xz |
* Committing a few keep-alive changes. Cleaned up some log messages
-rw-r--r-- | OpenSim/Framework/Servers/BaseHttpServer.cs | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 15bc646..2c0cb5c 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -390,7 +390,7 @@ namespace OpenSim.Framework.Servers | |||
390 | { | 390 | { |
391 | OSHttpRequest req = new OSHttpRequest(context, request); | 391 | OSHttpRequest req = new OSHttpRequest(context, request); |
392 | OSHttpResponse resp = new OSHttpResponse(new HttpServer.HttpResponse(context, request)); | 392 | OSHttpResponse resp = new OSHttpResponse(new HttpServer.HttpResponse(context, request)); |
393 | 393 | //m_log.Info("[Debug BASE HTTP SERVER]: Got Request"); | |
394 | //HttpServerContextObj objstate= new HttpServerContextObj(req,resp); | 394 | //HttpServerContextObj objstate= new HttpServerContextObj(req,resp); |
395 | //ThreadPool.QueueUserWorkItem(new WaitCallback(ConvertIHttpClientContextToOSHttp), (object)objstate); | 395 | //ThreadPool.QueueUserWorkItem(new WaitCallback(ConvertIHttpClientContextToOSHttp), (object)objstate); |
396 | HandleRequest(req, resp); | 396 | HandleRequest(req, resp); |
@@ -447,7 +447,7 @@ namespace OpenSim.Framework.Servers | |||
447 | // the request can be passed through to the other handlers. This is a low | 447 | // the request can be passed through to the other handlers. This is a low |
448 | // probability event; if a request is matched it is normally expected to be | 448 | // probability event; if a request is matched it is normally expected to be |
449 | // handled | 449 | // handled |
450 | 450 | //m_log.Info("[Debug BASE HTTP SERVER]: Handling Request" + request.RawUrl); | |
451 | IHttpAgentHandler agentHandler; | 451 | IHttpAgentHandler agentHandler; |
452 | 452 | ||
453 | if (TryGetAgentHandler(request, response, out agentHandler)) | 453 | if (TryGetAgentHandler(request, response, out agentHandler)) |
@@ -469,7 +469,7 @@ namespace OpenSim.Framework.Servers | |||
469 | 469 | ||
470 | if (TryGetStreamHandler(handlerKey, out requestHandler)) | 470 | if (TryGetStreamHandler(handlerKey, out requestHandler)) |
471 | { | 471 | { |
472 | 472 | //m_log.Info("[Debug BASE HTTP SERVER]: Found Stream Handler"); | |
473 | // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. | 473 | // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. |
474 | byte[] buffer; | 474 | byte[] buffer; |
475 | if (requestHandler is IStreamedRequestHandler) | 475 | if (requestHandler is IStreamedRequestHandler) |
@@ -480,6 +480,7 @@ namespace OpenSim.Framework.Servers | |||
480 | } | 480 | } |
481 | else if (requestHandler is IGenericHTTPHandler) | 481 | else if (requestHandler is IGenericHTTPHandler) |
482 | { | 482 | { |
483 | //m_log.Info("[Debug BASE HTTP SERVER]: Found Caps based HTTP Handler"); | ||
483 | IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; | 484 | IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; |
484 | Stream requestStream = request.InputStream; | 485 | Stream requestStream = request.InputStream; |
485 | 486 | ||
@@ -572,6 +573,7 @@ namespace OpenSim.Framework.Servers | |||
572 | { | 573 | { |
573 | if (strAccept.Contains("application/llsd+xml")) | 574 | if (strAccept.Contains("application/llsd+xml")) |
574 | { | 575 | { |
576 | //m_log.Info("[Debug BASE HTTP SERVER]: Found an application/llsd+xml accept header"); | ||
575 | HandleLLSDRequests(request, response); | 577 | HandleLLSDRequests(request, response); |
576 | return; | 578 | return; |
577 | } | 579 | } |
@@ -582,34 +584,41 @@ namespace OpenSim.Framework.Servers | |||
582 | { | 584 | { |
583 | case null: | 585 | case null: |
584 | case "text/html": | 586 | case "text/html": |
587 | //m_log.Info("[Debug BASE HTTP SERVER]: found a text/html content type"); | ||
585 | HandleHTTPRequest(request, response); | 588 | HandleHTTPRequest(request, response); |
586 | return; | 589 | return; |
587 | 590 | ||
588 | case "application/llsd+xml": | 591 | case "application/llsd+xml": |
589 | case "application/xml+llsd": | 592 | case "application/xml+llsd": |
593 | //m_log.Info("[Debug BASE HTTP SERVER]: found a application/llsd+xml content type"); | ||
590 | HandleLLSDRequests(request, response); | 594 | HandleLLSDRequests(request, response); |
591 | return; | 595 | return; |
592 | 596 | ||
593 | case "text/xml": | 597 | case "text/xml": |
594 | case "application/xml": | 598 | case "application/xml": |
595 | default: | 599 | default: |
600 | //m_log.Info("[Debug BASE HTTP SERVER]: in default handler"); | ||
596 | // Point of note.. the DoWeHaveA methods check for an EXACT path | 601 | // Point of note.. the DoWeHaveA methods check for an EXACT path |
597 | // if (request.RawUrl.Contains("/CAPS/EQG")) | 602 | // if (request.RawUrl.Contains("/CAPS/EQG")) |
598 | // { | 603 | // { |
599 | // int i = 1; | 604 | // int i = 1; |
600 | // } | 605 | // } |
606 | //m_log.Info("[Debug BASE HTTP SERVER]: Checking for LLSD Handler"); | ||
601 | if (DoWeHaveALLSDHandler(request.RawUrl)) | 607 | if (DoWeHaveALLSDHandler(request.RawUrl)) |
602 | { | 608 | { |
609 | //m_log.Info("[Debug BASE HTTP SERVER]: Found LLSD Handler"); | ||
603 | HandleLLSDRequests(request, response); | 610 | HandleLLSDRequests(request, response); |
604 | return; | 611 | return; |
605 | } | 612 | } |
606 | 613 | //m_log.Info("[Debug BASE HTTP SERVER]: Checking for HTTP Handler"); | |
607 | if (DoWeHaveAHTTPHandler(request.RawUrl)) | 614 | if (DoWeHaveAHTTPHandler(request.RawUrl)) |
608 | { | 615 | { |
616 | //m_log.Info("[Debug BASE HTTP SERVER]: found HTTP Handler"); | ||
609 | HandleHTTPRequest(request, response); | 617 | HandleHTTPRequest(request, response); |
610 | return; | 618 | return; |
611 | } | 619 | } |
612 | 620 | ||
621 | //m_log.Info("[Debug BASE HTTP SERVER]: Generic XMLRPC"); | ||
613 | // generic login request. | 622 | // generic login request. |
614 | HandleXmlRpcRequests(request, response); | 623 | HandleXmlRpcRequests(request, response); |
615 | 624 | ||
@@ -796,6 +805,7 @@ namespace OpenSim.Framework.Servers | |||
796 | 805 | ||
797 | private void HandleLLSDRequests(OSHttpRequest request, OSHttpResponse response) | 806 | private void HandleLLSDRequests(OSHttpRequest request, OSHttpResponse response) |
798 | { | 807 | { |
808 | //m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request"); | ||
799 | Stream requestStream = request.InputStream; | 809 | Stream requestStream = request.InputStream; |
800 | 810 | ||
801 | Encoding encoding = Encoding.UTF8; | 811 | Encoding encoding = Encoding.UTF8; |
@@ -806,6 +816,7 @@ namespace OpenSim.Framework.Servers | |||
806 | requestStream.Close(); | 816 | requestStream.Close(); |
807 | 817 | ||
808 | //m_log.DebugFormat("[OGP]: {0}:{1}", request.RawUrl, requestBody); | 818 | //m_log.DebugFormat("[OGP]: {0}:{1}", request.RawUrl, requestBody); |
819 | response.KeepAlive = false; | ||
809 | 820 | ||
810 | LLSD llsdRequest = null; | 821 | LLSD llsdRequest = null; |
811 | LLSD llsdResponse = null; | 822 | LLSD llsdResponse = null; |
@@ -870,12 +881,13 @@ namespace OpenSim.Framework.Servers | |||
870 | else | 881 | else |
871 | { | 882 | { |
872 | response.ContentType = "application/llsd+xml"; | 883 | response.ContentType = "application/llsd+xml"; |
873 | 884 | //m_log.Info("[Debug BASE HTTP SERVER]: Response: " + llsdResponse.ToString()); | |
874 | buffer = LLSDParser.SerializeXmlBytes(llsdResponse); | 885 | buffer = LLSDParser.SerializeXmlBytes(llsdResponse); |
875 | } | 886 | } |
876 | response.SendChunked = false; | 887 | response.SendChunked = false; |
877 | response.ContentLength64 = buffer.Length; | 888 | response.ContentLength64 = buffer.Length; |
878 | response.ContentEncoding = Encoding.UTF8; | 889 | response.ContentEncoding = Encoding.UTF8; |
890 | response.KeepAlive = false; | ||
879 | 891 | ||
880 | try | 892 | try |
881 | { | 893 | { |
@@ -891,6 +903,8 @@ namespace OpenSim.Framework.Servers | |||
891 | try | 903 | try |
892 | { | 904 | { |
893 | response.Send(); | 905 | response.Send(); |
906 | response.OutputStream.Flush(); | ||
907 | response.OutputStream.Close(); | ||
894 | } | 908 | } |
895 | catch (SocketException e) | 909 | catch (SocketException e) |
896 | { | 910 | { |
@@ -1292,6 +1306,7 @@ namespace OpenSim.Framework.Servers | |||
1292 | 1306 | ||
1293 | private static void DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) | 1307 | private static void DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) |
1294 | { | 1308 | { |
1309 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); | ||
1295 | int responsecode = (int)responsedata["int_response_code"]; | 1310 | int responsecode = (int)responsedata["int_response_code"]; |
1296 | string responseString = (string)responsedata["str_response_string"]; | 1311 | string responseString = (string)responsedata["str_response_string"]; |
1297 | string contentType = (string)responsedata["content_type"]; | 1312 | string contentType = (string)responsedata["content_type"]; |