diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 9c6ee9c..516604a 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -60,7 +60,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
60 | 60 | ||
61 | /// <summary> | 61 | /// <summary> |
62 | /// This is a pending websocket request before it got an sucessful upgrade response. | 62 | /// This is a pending websocket request before it got an sucessful upgrade response. |
63 | /// The consumer must call handler.HandshakeAndUpgrade() to signal to the handler to | 63 | /// The consumer must call handler.HandshakeAndUpgrade() to signal to the handler to |
64 | /// start the connection and optionally provide an origin authentication method. | 64 | /// start the connection and optionally provide an origin authentication method. |
65 | /// </summary> | 65 | /// </summary> |
66 | /// <param name="servicepath"></param> | 66 | /// <param name="servicepath"></param> |
@@ -106,7 +106,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
106 | new Dictionary<string, PollServiceEventArgs>(); | 106 | new Dictionary<string, PollServiceEventArgs>(); |
107 | 107 | ||
108 | protected Dictionary<string, WebSocketRequestDelegate> m_WebSocketHandlers = | 108 | protected Dictionary<string, WebSocketRequestDelegate> m_WebSocketHandlers = |
109 | new Dictionary<string, WebSocketRequestDelegate>(); | 109 | new Dictionary<string, WebSocketRequestDelegate>(); |
110 | 110 | ||
111 | protected uint m_port; | 111 | protected uint m_port; |
112 | protected bool m_ssl; | 112 | protected bool m_ssl; |
@@ -386,7 +386,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
386 | return new List<string>(m_rpcHandlers.Keys); | 386 | return new List<string>(m_rpcHandlers.Keys); |
387 | } | 387 | } |
388 | 388 | ||
389 | // JsonRPC | 389 | // JsonRPC |
390 | public bool AddJsonRPCHandler(string method, JsonRPCMethod handler) | 390 | public bool AddJsonRPCHandler(string method, JsonRPCMethod handler) |
391 | { | 391 | { |
392 | lock(jsonRpcHandlers) | 392 | lock(jsonRpcHandlers) |
@@ -588,11 +588,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
588 | dWebSocketRequestDelegate(req.Url.AbsolutePath, new WebSocketHttpServerHandler(req, context, 8192)); | 588 | dWebSocketRequestDelegate(req.Url.AbsolutePath, new WebSocketHttpServerHandler(req, context, 8192)); |
589 | return; | 589 | return; |
590 | } | 590 | } |
591 | 591 | ||
592 | OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); | 592 | OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); |
593 | // resp.ReuseContext = true; | 593 | // resp.ReuseContext = true; |
594 | // resp.ReuseContext = false; | 594 | // resp.ReuseContext = false; |
595 | HandleRequest(req, resp); | 595 | HandleRequest(req, resp); |
596 | 596 | ||
597 | // !!!HACK ALERT!!! | 597 | // !!!HACK ALERT!!! |
598 | // There seems to be a bug in the underlying http code that makes subsequent requests | 598 | // There seems to be a bug in the underlying http code that makes subsequent requests |
@@ -684,7 +684,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
684 | LogIncomingToStreamHandler(request, requestHandler); | 684 | LogIncomingToStreamHandler(request, requestHandler); |
685 | 685 | ||
686 | response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. | 686 | response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. |
687 | 687 | ||
688 | if (requestHandler is IStreamedRequestHandler) | 688 | if (requestHandler is IStreamedRequestHandler) |
689 | { | 689 | { |
690 | IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; | 690 | IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; |
@@ -754,16 +754,16 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
754 | case "text/html": | 754 | case "text/html": |
755 | if (DebugLevel >= 3) | 755 | if (DebugLevel >= 3) |
756 | LogIncomingToContentTypeHandler(request); | 756 | LogIncomingToContentTypeHandler(request); |
757 | 757 | ||
758 | buffer = HandleHTTPRequest(request, response); | 758 | buffer = HandleHTTPRequest(request, response); |
759 | break; | 759 | break; |
760 | 760 | ||
761 | case "application/llsd+xml": | 761 | case "application/llsd+xml": |
762 | case "application/xml+llsd": | 762 | case "application/xml+llsd": |
763 | case "application/llsd+json": | 763 | case "application/llsd+json": |
764 | if (DebugLevel >= 3) | 764 | if (DebugLevel >= 3) |
765 | LogIncomingToContentTypeHandler(request); | 765 | LogIncomingToContentTypeHandler(request); |
766 | 766 | ||
767 | buffer = HandleLLSDRequests(request, response); | 767 | buffer = HandleLLSDRequests(request, response); |
768 | break; | 768 | break; |
769 | 769 | ||
@@ -773,7 +773,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
773 | 773 | ||
774 | buffer = HandleJsonRpcRequests(request, response); | 774 | buffer = HandleJsonRpcRequests(request, response); |
775 | break; | 775 | break; |
776 | 776 | ||
777 | case "text/xml": | 777 | case "text/xml": |
778 | case "application/xml": | 778 | case "application/xml": |
779 | case "application/json": | 779 | case "application/json": |
@@ -790,7 +790,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
790 | { | 790 | { |
791 | if (DebugLevel >= 3) | 791 | if (DebugLevel >= 3) |
792 | LogIncomingToContentTypeHandler(request); | 792 | LogIncomingToContentTypeHandler(request); |
793 | 793 | ||
794 | buffer = HandleLLSDRequests(request, response); | 794 | buffer = HandleLLSDRequests(request, response); |
795 | } | 795 | } |
796 | // m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); | 796 | // m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); |
@@ -798,18 +798,18 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
798 | { | 798 | { |
799 | if (DebugLevel >= 3) | 799 | if (DebugLevel >= 3) |
800 | LogIncomingToContentTypeHandler(request); | 800 | LogIncomingToContentTypeHandler(request); |
801 | 801 | ||
802 | buffer = HandleHTTPRequest(request, response); | 802 | buffer = HandleHTTPRequest(request, response); |
803 | } | 803 | } |
804 | else | 804 | else |
805 | { | 805 | { |
806 | if (DebugLevel >= 3) | 806 | if (DebugLevel >= 3) |
807 | LogIncomingToXmlRpcHandler(request); | 807 | LogIncomingToXmlRpcHandler(request); |
808 | 808 | ||
809 | // generic login request. | 809 | // generic login request. |
810 | buffer = HandleXmlRpcRequests(request, response); | 810 | buffer = HandleXmlRpcRequests(request, response); |
811 | } | 811 | } |
812 | 812 | ||
813 | break; | 813 | break; |
814 | } | 814 | } |
815 | } | 815 | } |
@@ -1093,7 +1093,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1093 | // private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) | 1093 | // private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) |
1094 | // { | 1094 | // { |
1095 | // agentHandler = null; | 1095 | // agentHandler = null; |
1096 | // | 1096 | // |
1097 | // lock (m_agentHandlers) | 1097 | // lock (m_agentHandlers) |
1098 | // { | 1098 | // { |
1099 | // foreach (IHttpAgentHandler handler in m_agentHandlers.Values) | 1099 | // foreach (IHttpAgentHandler handler in m_agentHandlers.Values) |
@@ -1304,7 +1304,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1304 | return buffer; | 1304 | return buffer; |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | // JsonRpc (v2.0 only) | 1307 | // JsonRpc (v2.0 only) |
1308 | // Batch requests not yet supported | 1308 | // Batch requests not yet supported |
1309 | private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response) | 1309 | private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response) |
1310 | { | 1310 | { |
@@ -1321,7 +1321,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1321 | jsonRpcResponse.Error.Code = ErrorCode.InternalError; | 1321 | jsonRpcResponse.Error.Code = ErrorCode.InternalError; |
1322 | jsonRpcResponse.Error.Message = e.Message; | 1322 | jsonRpcResponse.Error.Message = e.Message; |
1323 | } | 1323 | } |
1324 | 1324 | ||
1325 | requestStream.Close(); | 1325 | requestStream.Close(); |
1326 | 1326 | ||
1327 | if (jsonRpcRequest != null) | 1327 | if (jsonRpcRequest != null) |
@@ -1386,7 +1386,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1386 | string responseData = string.Empty; | 1386 | string responseData = string.Empty; |
1387 | 1387 | ||
1388 | responseData = jsonRpcResponse.Serialize(); | 1388 | responseData = jsonRpcResponse.Serialize(); |
1389 | 1389 | ||
1390 | byte[] buffer = Encoding.UTF8.GetBytes(responseData); | 1390 | byte[] buffer = Encoding.UTF8.GetBytes(responseData); |
1391 | return buffer; | 1391 | return buffer; |
1392 | } | 1392 | } |
@@ -1666,7 +1666,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1666 | } | 1666 | } |
1667 | } | 1667 | } |
1668 | } | 1668 | } |
1669 | 1669 | ||
1670 | if (String.IsNullOrEmpty(bestMatch)) | 1670 | if (String.IsNullOrEmpty(bestMatch)) |
1671 | { | 1671 | { |
1672 | llsdHandler = null; | 1672 | llsdHandler = null; |
@@ -2029,8 +2029,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
2029 | response.SendChunked = false; | 2029 | response.SendChunked = false; |
2030 | response.ContentLength64 = buffer.Length; | 2030 | response.ContentLength64 = buffer.Length; |
2031 | response.ContentEncoding = Encoding.UTF8; | 2031 | response.ContentEncoding = Encoding.UTF8; |
2032 | 2032 | ||
2033 | 2033 | ||
2034 | return buffer; | 2034 | return buffer; |
2035 | } | 2035 | } |
2036 | 2036 | ||
@@ -2111,7 +2111,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
2111 | throw e; | 2111 | throw e; |
2112 | } | 2112 | } |
2113 | 2113 | ||
2114 | m_requestsProcessedStat | 2114 | m_requestsProcessedStat |
2115 | = new Stat( | 2115 | = new Stat( |
2116 | "HTTPRequestsServed", | 2116 | "HTTPRequestsServed", |
2117 | "Number of inbound HTTP requests processed", | 2117 | "Number of inbound HTTP requests processed", |
@@ -2123,7 +2123,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
2123 | MeasuresOfInterest.AverageChangeOverTime, | 2123 | MeasuresOfInterest.AverageChangeOverTime, |
2124 | stat => stat.Value = RequestNumber, | 2124 | stat => stat.Value = RequestNumber, |
2125 | StatVerbosity.Debug); | 2125 | StatVerbosity.Debug); |
2126 | 2126 | ||
2127 | StatsManager.RegisterStat(m_requestsProcessedStat); | 2127 | StatsManager.RegisterStat(m_requestsProcessedStat); |
2128 | } | 2128 | } |
2129 | 2129 | ||