diff options
author | Melanie Thielker | 2017-01-05 19:07:37 +0000 |
---|---|---|
committer | Melanie Thielker | 2017-01-05 19:07:37 +0000 |
commit | b16abc8166c29585cb76cc55c3bdd76e5833cb4f (patch) | |
tree | 6a34f465a74b7a3a6dc00a3d7aa8dcc25ac3e3a5 /OpenSim/Framework/Servers/HttpServer | |
parent | Make it possible to disable the bakes module in the way it is described in co... (diff) | |
download | opensim-SC-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.zip opensim-SC-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.gz opensim-SC-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.bz2 opensim-SC-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.xz |
Massive tab and trailing space cleanup
Diffstat (limited to '')
18 files changed, 121 insertions, 121 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index e431042..fb92b92 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
58 | 58 | ||
59 | /// <summary> | 59 | /// <summary> |
60 | /// This is a pending websocket request before it got an sucessful upgrade response. | 60 | /// This is a pending websocket request before it got an sucessful upgrade response. |
61 | /// The consumer must call handler.HandshakeAndUpgrade() to signal to the handler to | 61 | /// The consumer must call handler.HandshakeAndUpgrade() to signal to the handler to |
62 | /// start the connection and optionally provide an origin authentication method. | 62 | /// start the connection and optionally provide an origin authentication method. |
63 | /// </summary> | 63 | /// </summary> |
64 | /// <param name="servicepath"></param> | 64 | /// <param name="servicepath"></param> |
@@ -104,7 +104,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
104 | new Dictionary<string, PollServiceEventArgs>(); | 104 | new Dictionary<string, PollServiceEventArgs>(); |
105 | 105 | ||
106 | protected Dictionary<string, WebSocketRequestDelegate> m_WebSocketHandlers = | 106 | protected Dictionary<string, WebSocketRequestDelegate> m_WebSocketHandlers = |
107 | new Dictionary<string, WebSocketRequestDelegate>(); | 107 | new Dictionary<string, WebSocketRequestDelegate>(); |
108 | 108 | ||
109 | protected uint m_port; | 109 | protected uint m_port; |
110 | protected uint m_sslport; | 110 | protected uint m_sslport; |
@@ -253,7 +253,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
253 | return new List<string>(m_rpcHandlers.Keys); | 253 | return new List<string>(m_rpcHandlers.Keys); |
254 | } | 254 | } |
255 | 255 | ||
256 | // JsonRPC | 256 | // JsonRPC |
257 | public bool AddJsonRPCHandler(string method, JsonRPCMethod handler) | 257 | public bool AddJsonRPCHandler(string method, JsonRPCMethod handler) |
258 | { | 258 | { |
259 | lock(jsonRpcHandlers) | 259 | lock(jsonRpcHandlers) |
@@ -459,11 +459,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
459 | dWebSocketRequestDelegate(req.Url.AbsolutePath, new WebSocketHttpServerHandler(req, context, 8192)); | 459 | dWebSocketRequestDelegate(req.Url.AbsolutePath, new WebSocketHttpServerHandler(req, context, 8192)); |
460 | return; | 460 | return; |
461 | } | 461 | } |
462 | 462 | ||
463 | OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); | 463 | OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); |
464 | resp.ReuseContext = true; | 464 | resp.ReuseContext = true; |
465 | // resp.ReuseContext = false; | 465 | // resp.ReuseContext = false; |
466 | HandleRequest(req, resp); | 466 | HandleRequest(req, resp); |
467 | 467 | ||
468 | // !!!HACK ALERT!!! | 468 | // !!!HACK ALERT!!! |
469 | // There seems to be a bug in the underlying http code that makes subsequent requests | 469 | // There seems to be a bug in the underlying http code that makes subsequent requests |
@@ -554,7 +554,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
554 | LogIncomingToStreamHandler(request, requestHandler); | 554 | LogIncomingToStreamHandler(request, requestHandler); |
555 | 555 | ||
556 | response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. | 556 | response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. |
557 | 557 | ||
558 | if (requestHandler is IStreamedRequestHandler) | 558 | if (requestHandler is IStreamedRequestHandler) |
559 | { | 559 | { |
560 | IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; | 560 | IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; |
@@ -630,16 +630,16 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
630 | case "text/html": | 630 | case "text/html": |
631 | if (DebugLevel >= 3) | 631 | if (DebugLevel >= 3) |
632 | LogIncomingToContentTypeHandler(request); | 632 | LogIncomingToContentTypeHandler(request); |
633 | 633 | ||
634 | buffer = HandleHTTPRequest(request, response); | 634 | buffer = HandleHTTPRequest(request, response); |
635 | break; | 635 | break; |
636 | 636 | ||
637 | case "application/llsd+xml": | 637 | case "application/llsd+xml": |
638 | case "application/xml+llsd": | 638 | case "application/xml+llsd": |
639 | case "application/llsd+json": | 639 | case "application/llsd+json": |
640 | if (DebugLevel >= 3) | 640 | if (DebugLevel >= 3) |
641 | LogIncomingToContentTypeHandler(request); | 641 | LogIncomingToContentTypeHandler(request); |
642 | 642 | ||
643 | buffer = HandleLLSDRequests(request, response); | 643 | buffer = HandleLLSDRequests(request, response); |
644 | break; | 644 | break; |
645 | 645 | ||
@@ -649,7 +649,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
649 | 649 | ||
650 | buffer = HandleJsonRpcRequests(request, response); | 650 | buffer = HandleJsonRpcRequests(request, response); |
651 | break; | 651 | break; |
652 | 652 | ||
653 | case "text/xml": | 653 | case "text/xml": |
654 | case "application/xml": | 654 | case "application/xml": |
655 | case "application/json": | 655 | case "application/json": |
@@ -666,7 +666,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
666 | { | 666 | { |
667 | if (DebugLevel >= 3) | 667 | if (DebugLevel >= 3) |
668 | LogIncomingToContentTypeHandler(request); | 668 | LogIncomingToContentTypeHandler(request); |
669 | 669 | ||
670 | buffer = HandleLLSDRequests(request, response); | 670 | buffer = HandleLLSDRequests(request, response); |
671 | } | 671 | } |
672 | // m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); | 672 | // m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); |
@@ -674,18 +674,18 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
674 | { | 674 | { |
675 | if (DebugLevel >= 3) | 675 | if (DebugLevel >= 3) |
676 | LogIncomingToContentTypeHandler(request); | 676 | LogIncomingToContentTypeHandler(request); |
677 | 677 | ||
678 | buffer = HandleHTTPRequest(request, response); | 678 | buffer = HandleHTTPRequest(request, response); |
679 | } | 679 | } |
680 | else | 680 | else |
681 | { | 681 | { |
682 | if (DebugLevel >= 3) | 682 | if (DebugLevel >= 3) |
683 | LogIncomingToXmlRpcHandler(request); | 683 | LogIncomingToXmlRpcHandler(request); |
684 | 684 | ||
685 | // generic login request. | 685 | // generic login request. |
686 | buffer = HandleXmlRpcRequests(request, response); | 686 | buffer = HandleXmlRpcRequests(request, response); |
687 | } | 687 | } |
688 | 688 | ||
689 | break; | 689 | break; |
690 | } | 690 | } |
691 | } | 691 | } |
@@ -972,7 +972,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
972 | // private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) | 972 | // private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) |
973 | // { | 973 | // { |
974 | // agentHandler = null; | 974 | // agentHandler = null; |
975 | // | 975 | // |
976 | // lock (m_agentHandlers) | 976 | // lock (m_agentHandlers) |
977 | // { | 977 | // { |
978 | // foreach (IHttpAgentHandler handler in m_agentHandlers.Values) | 978 | // foreach (IHttpAgentHandler handler in m_agentHandlers.Values) |
@@ -1171,7 +1171,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1171 | return buffer; | 1171 | return buffer; |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | // JsonRpc (v2.0 only) | 1174 | // JsonRpc (v2.0 only) |
1175 | // Batch requests not yet supported | 1175 | // Batch requests not yet supported |
1176 | private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response) | 1176 | private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response) |
1177 | { | 1177 | { |
@@ -1188,7 +1188,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1188 | jsonRpcResponse.Error.Code = ErrorCode.InternalError; | 1188 | jsonRpcResponse.Error.Code = ErrorCode.InternalError; |
1189 | jsonRpcResponse.Error.Message = e.Message; | 1189 | jsonRpcResponse.Error.Message = e.Message; |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | requestStream.Close(); | 1192 | requestStream.Close(); |
1193 | 1193 | ||
1194 | if (jsonRpcRequest != null) | 1194 | if (jsonRpcRequest != null) |
@@ -1253,7 +1253,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1253 | string responseData = string.Empty; | 1253 | string responseData = string.Empty; |
1254 | 1254 | ||
1255 | responseData = jsonRpcResponse.Serialize(); | 1255 | responseData = jsonRpcResponse.Serialize(); |
1256 | 1256 | ||
1257 | byte[] buffer = Encoding.UTF8.GetBytes(responseData); | 1257 | byte[] buffer = Encoding.UTF8.GetBytes(responseData); |
1258 | return buffer; | 1258 | return buffer; |
1259 | } | 1259 | } |
@@ -1533,7 +1533,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1533 | } | 1533 | } |
1534 | } | 1534 | } |
1535 | } | 1535 | } |
1536 | 1536 | ||
1537 | if (String.IsNullOrEmpty(bestMatch)) | 1537 | if (String.IsNullOrEmpty(bestMatch)) |
1538 | { | 1538 | { |
1539 | llsdHandler = null; | 1539 | llsdHandler = null; |
@@ -1899,8 +1899,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1899 | response.SendChunked = false; | 1899 | response.SendChunked = false; |
1900 | response.ContentLength64 = buffer.Length; | 1900 | response.ContentLength64 = buffer.Length; |
1901 | response.ContentEncoding = Encoding.UTF8; | 1901 | response.ContentEncoding = Encoding.UTF8; |
1902 | 1902 | ||
1903 | 1903 | ||
1904 | return buffer; | 1904 | return buffer; |
1905 | } | 1905 | } |
1906 | 1906 | ||
@@ -1977,7 +1977,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1977 | throw e; | 1977 | throw e; |
1978 | } | 1978 | } |
1979 | 1979 | ||
1980 | m_requestsProcessedStat | 1980 | m_requestsProcessedStat |
1981 | = new Stat( | 1981 | = new Stat( |
1982 | "HTTPRequestsServed", | 1982 | "HTTPRequestsServed", |
1983 | "Number of inbound HTTP requests processed", | 1983 | "Number of inbound HTTP requests processed", |
@@ -1989,7 +1989,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1989 | MeasuresOfInterest.AverageChangeOverTime, | 1989 | MeasuresOfInterest.AverageChangeOverTime, |
1990 | stat => stat.Value = RequestNumber, | 1990 | stat => stat.Value = RequestNumber, |
1991 | StatVerbosity.Debug); | 1991 | StatVerbosity.Debug); |
1992 | 1992 | ||
1993 | StatsManager.RegisterStat(m_requestsProcessedStat); | 1993 | StatsManager.RegisterStat(m_requestsProcessedStat); |
1994 | } | 1994 | } |
1995 | 1995 | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs index d4a1ec3..01d95e9 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs | |||
@@ -69,13 +69,13 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
69 | { | 69 | { |
70 | StatsManager.RegisterStat( | 70 | StatsManager.RegisterStat( |
71 | new Stat( | 71 | new Stat( |
72 | "requests", | 72 | "requests", |
73 | "requests", | 73 | "requests", |
74 | "Number of requests received by this service endpoint", | 74 | "Number of requests received by this service endpoint", |
75 | "requests", | 75 | "requests", |
76 | "service", | 76 | "service", |
77 | string.Format("{0}:{1}", httpMethod, path), | 77 | string.Format("{0}:{1}", httpMethod, path), |
78 | StatType.Pull, | 78 | StatType.Pull, |
79 | MeasuresOfInterest.AverageChangeOverTime, | 79 | MeasuresOfInterest.AverageChangeOverTime, |
80 | s => s.Value = RequestsReceived, | 80 | s => s.Value = RequestsReceived, |
81 | StatVerbosity.Debug)); | 81 | StatVerbosity.Debug)); |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs index 41aa19b..7fc9f0b 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
47 | : base(httpMethod, path, name, description) {} | 47 | : base(httpMethod, path, name, description) {} |
48 | 48 | ||
49 | protected BaseStreamHandler(string httpMethod, string path, IServiceAuth auth) | 49 | protected BaseStreamHandler(string httpMethod, string path, IServiceAuth auth) |
50 | : base(httpMethod, path, null, null) | 50 | : base(httpMethod, path, null, null) |
51 | { | 51 | { |
52 | m_Auth = auth; | 52 | m_Auth = auth; |
53 | } | 53 | } |
@@ -62,7 +62,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
62 | HttpStatusCode statusCode; | 62 | HttpStatusCode statusCode; |
63 | 63 | ||
64 | if (!m_Auth.Authenticate(httpRequest.Headers, httpResponse.AddHeader, out statusCode)) | 64 | if (!m_Auth.Authenticate(httpRequest.Headers, httpResponse.AddHeader, out statusCode)) |
65 | { | 65 | { |
66 | httpResponse.StatusCode = (int)statusCode; | 66 | httpResponse.StatusCode = (int)statusCode; |
67 | httpResponse.ContentType = "text/plain"; | 67 | httpResponse.ContentType = "text/plain"; |
68 | return new byte[0]; | 68 | return new byte[0]; |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandlerBasicDOSProtector.cs b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandlerBasicDOSProtector.cs index 1b88545..9619e03 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandlerBasicDOSProtector.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandlerBasicDOSProtector.cs | |||
@@ -37,7 +37,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
37 | /// </remarks> | 37 | /// </remarks> |
38 | public abstract class BaseStreamHandlerBasicDOSProtector : BaseRequestHandler, IStreamedRequestHandler | 38 | public abstract class BaseStreamHandlerBasicDOSProtector : BaseRequestHandler, IStreamedRequestHandler |
39 | { | 39 | { |
40 | 40 | ||
41 | private readonly BasicDosProtectorOptions _options; | 41 | private readonly BasicDosProtectorOptions _options; |
42 | private readonly BasicDOSProtector _dosProtector; | 42 | private readonly BasicDOSProtector _dosProtector; |
43 | 43 | ||
@@ -63,7 +63,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
63 | result = ThrottledRequest(path, request, httpRequest, httpResponse); | 63 | result = ThrottledRequest(path, request, httpRequest, httpResponse); |
64 | if (_options.MaxConcurrentSessions > 0) | 64 | if (_options.MaxConcurrentSessions > 0) |
65 | _dosProtector.ProcessEnd(clientstring, endpoint); | 65 | _dosProtector.ProcessEnd(clientstring, endpoint); |
66 | 66 | ||
67 | RequestsHandled++; | 67 | RequestsHandled++; |
68 | 68 | ||
69 | return result; | 69 | return result; |
@@ -81,7 +81,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
81 | return new byte[0]; | 81 | return new byte[0]; |
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
85 | private string GetRemoteAddr(IOSHttpRequest httpRequest) | 85 | private string GetRemoteAddr(IOSHttpRequest httpRequest) |
86 | { | 86 | { |
87 | string remoteaddr = string.Empty; | 87 | string remoteaddr = string.Empty; |
@@ -101,7 +101,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
101 | clientstring = GetRemoteAddr(httpRequest); | 101 | clientstring = GetRemoteAddr(httpRequest); |
102 | 102 | ||
103 | return clientstring; | 103 | return clientstring; |
104 | 104 | ||
105 | } | 105 | } |
106 | } | 106 | } |
107 | } | 107 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/GenericHTTPBasicDOSProtector.cs b/OpenSim/Framework/Servers/HttpServer/GenericHTTPBasicDOSProtector.cs index cd4b8ff..98d33e4 100644 --- a/OpenSim/Framework/Servers/HttpServer/GenericHTTPBasicDOSProtector.cs +++ b/OpenSim/Framework/Servers/HttpServer/GenericHTTPBasicDOSProtector.cs | |||
@@ -33,7 +33,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
33 | { | 33 | { |
34 | private readonly GenericHTTPMethod _normalMethod; | 34 | private readonly GenericHTTPMethod _normalMethod; |
35 | private readonly GenericHTTPMethod _throttledMethod; | 35 | private readonly GenericHTTPMethod _throttledMethod; |
36 | 36 | ||
37 | private readonly BasicDosProtectorOptions _options; | 37 | private readonly BasicDosProtectorOptions _options; |
38 | private readonly BasicDOSProtector _dosProtector; | 38 | private readonly BasicDOSProtector _dosProtector; |
39 | 39 | ||
@@ -41,7 +41,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
41 | { | 41 | { |
42 | _normalMethod = normalMethod; | 42 | _normalMethod = normalMethod; |
43 | _throttledMethod = throttledMethod; | 43 | _throttledMethod = throttledMethod; |
44 | 44 | ||
45 | _options = options; | 45 | _options = options; |
46 | _dosProtector = new BasicDOSProtector(_options); | 46 | _dosProtector = new BasicDOSProtector(_options); |
47 | } | 47 | } |
@@ -60,7 +60,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
60 | 60 | ||
61 | return process; | 61 | return process; |
62 | } | 62 | } |
63 | 63 | ||
64 | private string GetRemoteAddr(Hashtable request) | 64 | private string GetRemoteAddr(Hashtable request) |
65 | { | 65 | { |
66 | string remoteaddr = ""; | 66 | string remoteaddr = ""; |
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs index d162bc1..3a04074 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs | |||
@@ -45,26 +45,26 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
45 | // // the handlers - it is NOT required to be an actual agent header | 45 | // // the handlers - it is NOT required to be an actual agent header |
46 | // // value. | 46 | // // value. |
47 | // bool AddAgentHandler(string agent, IHttpAgentHandler handler); | 47 | // bool AddAgentHandler(string agent, IHttpAgentHandler handler); |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
50 | /// Add a handler for an HTTP request. | 50 | /// Add a handler for an HTTP request. |
51 | /// </summary> | 51 | /// </summary> |
52 | /// <remarks> | 52 | /// <remarks> |
53 | /// This handler can actually be invoked either as | 53 | /// This handler can actually be invoked either as |
54 | /// | 54 | /// |
55 | /// http://<hostname>:<port>/?method=<methodName> | 55 | /// http://<hostname>:<port>/?method=<methodName> |
56 | /// | 56 | /// |
57 | /// or | 57 | /// or |
58 | /// | 58 | /// |
59 | /// http://<hostname>:<port><method> | 59 | /// http://<hostname>:<port><method> |
60 | /// | 60 | /// |
61 | /// if the method name starts with a slash. For example, AddHTTPHandler("/object/", ...) on a standalone region | 61 | /// if the method name starts with a slash. For example, AddHTTPHandler("/object/", ...) on a standalone region |
62 | /// server will register a handler that can be invoked with either | 62 | /// server will register a handler that can be invoked with either |
63 | /// | 63 | /// |
64 | /// http://localhost:9000/?method=/object/ | 64 | /// http://localhost:9000/?method=/object/ |
65 | /// | 65 | /// |
66 | /// or | 66 | /// or |
67 | /// | 67 | /// |
68 | /// http://localhost:9000/object/ | 68 | /// http://localhost:9000/object/ |
69 | /// | 69 | /// |
70 | /// In addition, the handler invoked by the HTTP server for any request is the one when best matches the request | 70 | /// In addition, the handler invoked by the HTTP server for any request is the one when best matches the request |
@@ -87,7 +87,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
87 | /// <param name="handler">handle the LLSD response</param> | 87 | /// <param name="handler">handle the LLSD response</param> |
88 | /// <returns></returns> | 88 | /// <returns></returns> |
89 | bool AddLLSDHandler(string path, LLSDMethod handler); | 89 | bool AddLLSDHandler(string path, LLSDMethod handler); |
90 | 90 | ||
91 | /// <summary> | 91 | /// <summary> |
92 | /// Add a stream handler to the http server. If the handler already exists, then nothing happens. | 92 | /// Add a stream handler to the http server. If the handler already exists, then nothing happens. |
93 | /// </summary> | 93 | /// </summary> |
@@ -98,7 +98,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
98 | bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive); | 98 | bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive); |
99 | 99 | ||
100 | bool AddJsonRPCHandler(string method, JsonRPCMethod handler); | 100 | bool AddJsonRPCHandler(string method, JsonRPCMethod handler); |
101 | 101 | ||
102 | /// <summary> | 102 | /// <summary> |
103 | /// Websocket HTTP server handlers. | 103 | /// Websocket HTTP server handlers. |
104 | /// </summary> | 104 | /// </summary> |
@@ -108,7 +108,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
108 | 108 | ||
109 | 109 | ||
110 | void RemoveWebSocketHandler(string servicepath); | 110 | void RemoveWebSocketHandler(string servicepath); |
111 | 111 | ||
112 | /// <summary> | 112 | /// <summary> |
113 | /// Gets the XML RPC handler for given method name | 113 | /// Gets the XML RPC handler for given method name |
114 | /// </summary> | 114 | /// </summary> |
@@ -125,7 +125,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
125 | // /// <param name="handler"></param> | 125 | // /// <param name="handler"></param> |
126 | // /// <returns></returns> | 126 | // /// <returns></returns> |
127 | // bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); | 127 | // bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); |
128 | 128 | ||
129 | /// <summary> | 129 | /// <summary> |
130 | /// Remove an HTTP handler | 130 | /// Remove an HTTP handler |
131 | /// </summary> | 131 | /// </summary> |
@@ -134,15 +134,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
134 | void RemoveHTTPHandler(string httpMethod, string path); | 134 | void RemoveHTTPHandler(string httpMethod, string path); |
135 | 135 | ||
136 | void RemovePollServiceHTTPHandler(string httpMethod, string path); | 136 | void RemovePollServiceHTTPHandler(string httpMethod, string path); |
137 | 137 | ||
138 | bool RemoveLLSDHandler(string path, LLSDMethod handler); | 138 | bool RemoveLLSDHandler(string path, LLSDMethod handler); |
139 | 139 | ||
140 | void RemoveStreamHandler(string httpMethod, string path); | 140 | void RemoveStreamHandler(string httpMethod, string path); |
141 | 141 | ||
142 | void RemoveXmlRPCHandler(string method); | 142 | void RemoveXmlRPCHandler(string method); |
143 | 143 | ||
144 | void RemoveJsonRPCHandler(string method); | 144 | void RemoveJsonRPCHandler(string method); |
145 | 145 | ||
146 | string GetHTTP404(string host); | 146 | string GetHTTP404(string host); |
147 | 147 | ||
148 | string GetHTTP500(); | 148 | string GetHTTP500(); |
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs index b8541cb..62d92fb 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
83 | { | 83 | { |
84 | void Handle(string path, Stream request, Stream response, IOSHttpRequest httpReqbuest, IOSHttpResponse httpResponse); | 84 | void Handle(string path, Stream request, Stream response, IOSHttpRequest httpReqbuest, IOSHttpResponse httpResponse); |
85 | } | 85 | } |
86 | 86 | ||
87 | public interface IGenericHTTPHandler : IRequestHandler | 87 | public interface IGenericHTTPHandler : IRequestHandler |
88 | { | 88 | { |
89 | Hashtable Handle(string path, Hashtable request); | 89 | Hashtable Handle(string path, Hashtable request); |
diff --git a/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs index f3faf4f..411ee31 100644 --- a/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
43 | public class JsonRpcRequestManager | 43 | public class JsonRpcRequestManager |
44 | { | 44 | { |
45 | static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | public JsonRpcRequestManager() | 47 | public JsonRpcRequestManager() |
48 | { | 48 | { |
49 | } | 49 | } |
@@ -188,6 +188,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
188 | 188 | ||
189 | return true; | 189 | return true; |
190 | } | 190 | } |
191 | 191 | ||
192 | } | 192 | } |
193 | } | 193 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/JsonRpcResponse.cs b/OpenSim/Framework/Servers/HttpServer/JsonRpcResponse.cs index 2c50587..91d284b 100644 --- a/OpenSim/Framework/Servers/HttpServer/JsonRpcResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/JsonRpcResponse.cs | |||
@@ -144,7 +144,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
144 | { | 144 | { |
145 | 145 | ||
146 | } | 146 | } |
147 | return result; | 147 | return result; |
148 | } | 148 | } |
149 | } | 149 | } |
150 | } | 150 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs index 05ec6dc..1a6b8cf 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs | |||
@@ -155,11 +155,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
155 | private string _userAgent; | 155 | private string _userAgent; |
156 | 156 | ||
157 | internal IHttpRequest IHttpRequest | 157 | internal IHttpRequest IHttpRequest |
158 | { | 158 | { |
159 | get { return _request; } | 159 | get { return _request; } |
160 | } | 160 | } |
161 | 161 | ||
162 | internal IHttpClientContext IHttpClientContext | 162 | internal IHttpClientContext IHttpClientContext |
163 | { | 163 | { |
164 | get { return _context; } | 164 | get { return _context; } |
165 | } | 165 | } |
@@ -192,19 +192,19 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
192 | // ignore | 192 | // ignore |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | if (null != req.Headers["content-type"]) | 196 | if (null != req.Headers["content-type"]) |
197 | _contentType = _request.Headers["content-type"]; | 197 | _contentType = _request.Headers["content-type"]; |
198 | if (null != req.Headers["user-agent"]) | 198 | if (null != req.Headers["user-agent"]) |
199 | _userAgent = req.Headers["user-agent"]; | 199 | _userAgent = req.Headers["user-agent"]; |
200 | 200 | ||
201 | if (null != req.Headers["remote_addr"]) | 201 | if (null != req.Headers["remote_addr"]) |
202 | { | 202 | { |
203 | try | 203 | try |
204 | { | 204 | { |
205 | IPAddress addr = IPAddress.Parse(req.Headers["remote_addr"]); | 205 | IPAddress addr = IPAddress.Parse(req.Headers["remote_addr"]); |
206 | // sometimes req.Headers["remote_port"] returns a comma separated list, so use | 206 | // sometimes req.Headers["remote_port"] returns a comma separated list, so use |
207 | // the first one in the list and log it | 207 | // the first one in the list and log it |
208 | string[] strPorts = req.Headers["remote_port"].Split(new char[] { ',' }); | 208 | string[] strPorts = req.Headers["remote_port"].Split(new char[] { ',' }); |
209 | if (strPorts.Length > 1) | 209 | if (strPorts.Length > 1) |
210 | { | 210 | { |
@@ -216,7 +216,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
216 | } | 216 | } |
217 | catch (FormatException) | 217 | catch (FormatException) |
218 | { | 218 | { |
219 | _log.ErrorFormat("[OSHttpRequest]: format exception on addr/port {0}:{1}, ignoring", | 219 | _log.ErrorFormat("[OSHttpRequest]: format exception on addr/port {0}:{1}, ignoring", |
220 | req.Headers["remote_addr"], req.Headers["remote_port"]); | 220 | req.Headers["remote_addr"], req.Headers["remote_port"]); |
221 | } | 221 | } |
222 | } | 222 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs index ccf9c91..d7744fc 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs | |||
@@ -115,7 +115,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
115 | 115 | ||
116 | public bool KeepAlive | 116 | public bool KeepAlive |
117 | { | 117 | { |
118 | get | 118 | get |
119 | { | 119 | { |
120 | return _httpResponse.Connection == ConnectionType.KeepAlive; | 120 | return _httpResponse.Connection == ConnectionType.KeepAlive; |
121 | } | 121 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpStatusCodes.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpStatusCodes.cs index a736c8b..88e3068 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpStatusCodes.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpStatusCodes.cs | |||
@@ -91,7 +91,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
91 | /// 300 Redirect: different presentation forms available, take a pick | 91 | /// 300 Redirect: different presentation forms available, take a pick |
92 | /// </summary> | 92 | /// </summary> |
93 | RedirectMultipleChoices = 300, | 93 | RedirectMultipleChoices = 300, |
94 | 94 | ||
95 | /// <summary> | 95 | /// <summary> |
96 | /// 301 Redirect: requested resource has moved and now lives somewhere else | 96 | /// 301 Redirect: requested resource has moved and now lives somewhere else |
97 | /// </summary> | 97 | /// </summary> |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index 3fd3bf7..8ace7a9 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | |||
@@ -46,14 +46,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
46 | public RequestMethod Request; | 46 | public RequestMethod Request; |
47 | public UUID Id; | 47 | public UUID Id; |
48 | public int TimeOutms; | 48 | public int TimeOutms; |
49 | public EventType Type; | 49 | public EventType Type; |
50 | 50 | ||
51 | public enum EventType : int | 51 | public enum EventType : int |
52 | { | 52 | { |
53 | LongPoll = 0, | 53 | LongPoll = 0, |
54 | LslHttp = 1, | 54 | LslHttp = 1, |
55 | Inventory = 2, | 55 | Inventory = 2, |
56 | Texture = 3, | 56 | Texture = 3, |
57 | Mesh = 4 | 57 | Mesh = 4 |
58 | } | 58 | } |
59 | 59 | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index ffcad0f..936146d 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -80,7 +80,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
80 | startInfo.ThreadPoolName = "PoolService"; | 80 | startInfo.ThreadPoolName = "PoolService"; |
81 | 81 | ||
82 | m_threadPool = new SmartThreadPool(startInfo); | 82 | m_threadPool = new SmartThreadPool(startInfo); |
83 | 83 | ||
84 | } | 84 | } |
85 | 85 | ||
86 | public void Start() | 86 | public void Start() |
@@ -109,7 +109,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
109 | true, | 109 | true, |
110 | null, | 110 | null, |
111 | 1000 * 60 * 10); | 111 | 1000 * 60 * 10); |
112 | 112 | ||
113 | 113 | ||
114 | } | 114 | } |
115 | 115 | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs b/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs index 398179f..9b663ba 100644 --- a/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs | |||
@@ -2,7 +2,7 @@ | |||
2 | using System.Runtime.CompilerServices; | 2 | using System.Runtime.CompilerServices; |
3 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
4 | 4 | ||
5 | // General Information about an assembly is controlled through the following | 5 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 6 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 7 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("OpenSim.Framework.Servers.HttpServer")] | 8 | [assembly: AssemblyTitle("OpenSim.Framework.Servers.HttpServer")] |
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices; | |||
14 | [assembly: AssemblyTrademark("")] | 14 | [assembly: AssemblyTrademark("")] |
15 | [assembly: AssemblyCulture("")] | 15 | [assembly: AssemblyCulture("")] |
16 | 16 | ||
17 | // Setting ComVisible to false makes the types in this assembly not visible | 17 | // Setting ComVisible to false makes the types in this assembly not visible |
18 | // to COM components. If you need to access a type in this assembly from | 18 | // to COM components. If you need to access a type in this assembly from |
19 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
20 | [assembly: ComVisible(false)] | 20 | [assembly: ComVisible(false)] |
21 | 21 | ||
@@ -25,7 +25,7 @@ using System.Runtime.InteropServices; | |||
25 | // Version information for an assembly consists of the following four values: | 25 | // Version information for an assembly consists of the following four values: |
26 | // | 26 | // |
27 | // Major Version | 27 | // Major Version |
28 | // Minor Version | 28 | // Minor Version |
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index ad69cd2..68073c1 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | |||
@@ -291,5 +291,5 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
291 | serializer.Serialize(xmlWriter, response); | 291 | serializer.Serialize(xmlWriter, response); |
292 | } | 292 | } |
293 | } | 293 | } |
294 | } | 294 | } |
295 | } \ No newline at end of file | 295 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs b/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs index c2925e3..c8af90f 100644 --- a/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs | |||
@@ -75,7 +75,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
75 | public event PongDelegate OnPong; | 75 | public event PongDelegate OnPong; |
76 | 76 | ||
77 | /// <summary> | 77 | /// <summary> |
78 | /// This is a regular HTTP Request... This may be removed in the future. | 78 | /// This is a regular HTTP Request... This may be removed in the future. |
79 | /// </summary> | 79 | /// </summary> |
80 | // public event RegularHttpRequestDelegate OnRegularHttpRequest; | 80 | // public event RegularHttpRequestDelegate OnRegularHttpRequest; |
81 | 81 | ||
@@ -93,9 +93,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
93 | /// When the websocket is closed, this will be fired. | 93 | /// When the websocket is closed, this will be fired. |
94 | /// </summary> | 94 | /// </summary> |
95 | public event CloseDelegate OnClose; | 95 | public event CloseDelegate OnClose; |
96 | 96 | ||
97 | /// <summary> | 97 | /// <summary> |
98 | /// Set this delegate to allow your module to validate the origin of the | 98 | /// Set this delegate to allow your module to validate the origin of the |
99 | /// Websocket request. Primary line of defense against cross site scripting | 99 | /// Websocket request. Primary line of defense against cross site scripting |
100 | /// </summary> | 100 | /// </summary> |
101 | public ValidateHandshake HandshakeValidateMethodOverride = null; | 101 | public ValidateHandshake HandshakeValidateMethodOverride = null; |
@@ -181,7 +181,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
181 | { | 181 | { |
182 | throw new InvalidOperationException("The socket has been shutdown"); | 182 | throw new InvalidOperationException("The socket has been shutdown"); |
183 | } | 183 | } |
184 | } | 184 | } |
185 | set | 185 | set |
186 | { | 186 | { |
187 | if (_networkContext != null && _networkContext.Socket != null) | 187 | if (_networkContext != null && _networkContext.Socket != null) |
@@ -194,8 +194,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
194 | } | 194 | } |
195 | 195 | ||
196 | /// <summary> | 196 | /// <summary> |
197 | /// This triggers the websocket to start the upgrade process... | 197 | /// This triggers the websocket to start the upgrade process... |
198 | /// This is a Generalized Networking 'common sense' helper method. Some people expect to call Start() instead | 198 | /// This is a Generalized Networking 'common sense' helper method. Some people expect to call Start() instead |
199 | /// of the more context appropriate HandshakeAndUpgrade() | 199 | /// of the more context appropriate HandshakeAndUpgrade() |
200 | /// </summary> | 200 | /// </summary> |
201 | public void Start() | 201 | public void Start() |
@@ -261,7 +261,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
261 | acceptKey = GenerateAcceptKey(websocketKey); | 261 | acceptKey = GenerateAcceptKey(websocketKey); |
262 | string rawaccept = string.Format(HandshakeAcceptText, acceptKey); | 262 | string rawaccept = string.Format(HandshakeAcceptText, acceptKey); |
263 | SendUpgradeSuccess(rawaccept); | 263 | SendUpgradeSuccess(rawaccept); |
264 | 264 | ||
265 | 265 | ||
266 | } | 266 | } |
267 | else | 267 | else |
@@ -282,7 +282,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
282 | } | 282 | } |
283 | 283 | ||
284 | /// <summary> | 284 | /// <summary> |
285 | /// Generates a handshake response key string based on the client's | 285 | /// Generates a handshake response key string based on the client's |
286 | /// provided key to prove to the client that we're allowing the Websocket | 286 | /// provided key to prove to the client that we're allowing the Websocket |
287 | /// upgrade of our own free will and we were not coerced into doing it. | 287 | /// upgrade of our own free will and we were not coerced into doing it. |
288 | /// </summary> | 288 | /// </summary> |
@@ -298,7 +298,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
298 | SHA1 hashobj = SHA1.Create(); | 298 | SHA1 hashobj = SHA1.Create(); |
299 | string ret = Convert.ToBase64String(hashobj.ComputeHash(Encoding.UTF8.GetBytes(acceptkey))); | 299 | string ret = Convert.ToBase64String(hashobj.ComputeHash(Encoding.UTF8.GetBytes(acceptkey))); |
300 | hashobj.Clear(); | 300 | hashobj.Clear(); |
301 | 301 | ||
302 | return ret; | 302 | return ret; |
303 | } | 303 | } |
304 | 304 | ||
@@ -310,11 +310,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
310 | { | 310 | { |
311 | // Create a new websocket state so we can keep track of data in between network reads. | 311 | // Create a new websocket state so we can keep track of data in between network reads. |
312 | WebSocketState socketState = new WebSocketState() { ReceivedBytes = new List<byte>(), Header = WebsocketFrameHeader.HeaderDefault(), FrameComplete = true}; | 312 | WebSocketState socketState = new WebSocketState() { ReceivedBytes = new List<byte>(), Header = WebsocketFrameHeader.HeaderDefault(), FrameComplete = true}; |
313 | 313 | ||
314 | byte[] bhandshakeResponse = Encoding.UTF8.GetBytes(pHandshakeResponse); | 314 | byte[] bhandshakeResponse = Encoding.UTF8.GetBytes(pHandshakeResponse); |
315 | 315 | ||
316 | 316 | ||
317 | 317 | ||
318 | 318 | ||
319 | try | 319 | try |
320 | { | 320 | { |
@@ -324,7 +324,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
324 | } | 324 | } |
325 | // Begin reading the TCP stream before writing the Upgrade success message to the other side of the stream. | 325 | // Begin reading the TCP stream before writing the Upgrade success message to the other side of the stream. |
326 | _networkContext.Stream.BeginRead(_buffer, 0, _bufferLength, OnReceive, socketState); | 326 | _networkContext.Stream.BeginRead(_buffer, 0, _bufferLength, OnReceive, socketState); |
327 | 327 | ||
328 | // Write the upgrade handshake success message | 328 | // Write the upgrade handshake success message |
329 | _networkContext.Stream.Write(bhandshakeResponse, 0, bhandshakeResponse.Length); | 329 | _networkContext.Stream.Write(bhandshakeResponse, 0, bhandshakeResponse.Length); |
330 | _networkContext.Stream.Flush(); | 330 | _networkContext.Stream.Flush(); |
@@ -345,7 +345,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
345 | catch (ObjectDisposedException) | 345 | catch (ObjectDisposedException) |
346 | { | 346 | { |
347 | Close(string.Empty); | 347 | Close(string.Empty); |
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
351 | /// <summary> | 351 | /// <summary> |
@@ -369,7 +369,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
369 | 369 | ||
370 | /// <summary> | 370 | /// <summary> |
371 | /// This is our ugly Async OnReceive event handler. | 371 | /// This is our ugly Async OnReceive event handler. |
372 | /// This chunks the input stream based on the length of the provided buffer and processes out | 372 | /// This chunks the input stream based on the length of the provided buffer and processes out |
373 | /// as many frames as it can. It then moves the unprocessed data to the beginning of the buffer. | 373 | /// as many frames as it can. It then moves the unprocessed data to the beginning of the buffer. |
374 | /// </summary> | 374 | /// </summary> |
375 | /// <param name="ar">Our Async State from beginread</param> | 375 | /// <param name="ar">Our Async State from beginread</param> |
@@ -390,7 +390,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
390 | 390 | ||
391 | if (_bufferPosition > _bufferLength) | 391 | if (_bufferPosition > _bufferLength) |
392 | { | 392 | { |
393 | // Message too big for chunksize.. not sure how this happened... | 393 | // Message too big for chunksize.. not sure how this happened... |
394 | //Close(string.Empty); | 394 | //Close(string.Empty); |
395 | } | 395 | } |
396 | 396 | ||
@@ -413,7 +413,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
413 | if (pheader.PayloadLen > (ulong) _maxPayloadBytes) | 413 | if (pheader.PayloadLen > (ulong) _maxPayloadBytes) |
414 | { | 414 | { |
415 | Close("Invalid Payload size"); | 415 | Close("Invalid Payload size"); |
416 | 416 | ||
417 | return; | 417 | return; |
418 | } | 418 | } |
419 | if (pheader.PayloadLen > 0) | 419 | if (pheader.PayloadLen > 0) |
@@ -487,7 +487,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
487 | _socketState.ReceivedBytes.Clear(); | 487 | _socketState.ReceivedBytes.Clear(); |
488 | _socketState.ExpectedBytes = 0; | 488 | _socketState.ExpectedBytes = 0; |
489 | // do some processing | 489 | // do some processing |
490 | } | 490 | } |
491 | } | 491 | } |
492 | } | 492 | } |
493 | if (offset > 0) | 493 | if (offset > 0) |
@@ -504,7 +504,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
504 | } | 504 | } |
505 | else | 505 | else |
506 | { | 506 | { |
507 | // We can't read the stream anymore... | 507 | // We can't read the stream anymore... |
508 | } | 508 | } |
509 | } | 509 | } |
510 | catch (IOException) | 510 | catch (IOException) |
@@ -533,7 +533,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
533 | textMessageFrame.Header.Opcode = WebSocketReader.OpCode.Text; | 533 | textMessageFrame.Header.Opcode = WebSocketReader.OpCode.Text; |
534 | textMessageFrame.Header.IsEnd = true; | 534 | textMessageFrame.Header.IsEnd = true; |
535 | SendSocket(textMessageFrame.ToBytes()); | 535 | SendSocket(textMessageFrame.ToBytes()); |
536 | 536 | ||
537 | } | 537 | } |
538 | 538 | ||
539 | public void SendData(byte[] data) | 539 | public void SendData(byte[] data) |
@@ -657,7 +657,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
657 | SendSocket(pongFrame.ToBytes()); | 657 | SendSocket(pongFrame.ToBytes()); |
658 | break; | 658 | break; |
659 | case WebSocketReader.OpCode.Pong: | 659 | case WebSocketReader.OpCode.Pong: |
660 | 660 | ||
661 | PongDelegate pongD = OnPong; | 661 | PongDelegate pongD = OnPong; |
662 | if (pongD != null) | 662 | if (pongD != null) |
663 | { | 663 | { |
@@ -701,7 +701,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
701 | { | 701 | { |
702 | textD(this, new WebsocketTextEventArgs() { Data = Encoding.UTF8.GetString(psocketState.ReceivedBytes.ToArray()) }); | 702 | textD(this, new WebsocketTextEventArgs() { Data = Encoding.UTF8.GetString(psocketState.ReceivedBytes.ToArray()) }); |
703 | } | 703 | } |
704 | 704 | ||
705 | // Send Done Event! | 705 | // Send Done Event! |
706 | } | 706 | } |
707 | break; | 707 | break; |
@@ -719,7 +719,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
719 | { | 719 | { |
720 | if (psocketState.ContinuationFrame.Header.Opcode == WebSocketReader.OpCode.Text) | 720 | if (psocketState.ContinuationFrame.Header.Opcode == WebSocketReader.OpCode.Text) |
721 | { | 721 | { |
722 | // Send Done event | 722 | // Send Done event |
723 | TextDelegate textD = OnText; | 723 | TextDelegate textD = OnText; |
724 | if (textD != null) | 724 | if (textD != null) |
725 | { | 725 | { |
@@ -744,9 +744,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
744 | break; | 744 | break; |
745 | case WebSocketReader.OpCode.Close: | 745 | case WebSocketReader.OpCode.Close: |
746 | Close(string.Empty); | 746 | Close(string.Empty); |
747 | 747 | ||
748 | break; | 748 | break; |
749 | 749 | ||
750 | } | 750 | } |
751 | psocketState.Header.SetDefault(); | 751 | psocketState.Header.SetDefault(); |
752 | psocketState.ReceivedBytes.Clear(); | 752 | psocketState.ReceivedBytes.Clear(); |
@@ -837,12 +837,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
837 | } | 837 | } |
838 | 838 | ||
839 | /// <summary> | 839 | /// <summary> |
840 | /// Attempts to read a header off the provided buffer. Returns true, exports a WebSocketFrameheader, | 840 | /// Attempts to read a header off the provided buffer. Returns true, exports a WebSocketFrameheader, |
841 | /// and an int to move the buffer forward when it reads a header. False when it can't read a header | 841 | /// and an int to move the buffer forward when it reads a header. False when it can't read a header |
842 | /// </summary> | 842 | /// </summary> |
843 | /// <param name="pBuffer">Bytes read from the stream</param> | 843 | /// <param name="pBuffer">Bytes read from the stream</param> |
844 | /// <param name="pOffset">Starting place in the stream to begin trying to read from</param> | 844 | /// <param name="pOffset">Starting place in the stream to begin trying to read from</param> |
845 | /// <param name="length">Lenth in the stream to try and read from. Provided for cases where the | 845 | /// <param name="length">Lenth in the stream to try and read from. Provided for cases where the |
846 | /// buffer's length is larger then the data in it</param> | 846 | /// buffer's length is larger then the data in it</param> |
847 | /// <param name="oHeader">Outputs the read WebSocket frame header</param> | 847 | /// <param name="oHeader">Outputs the read WebSocket frame header</param> |
848 | /// <param name="moveBuffer">Informs the calling stream to move the buffer forward</param> | 848 | /// <param name="moveBuffer">Informs the calling stream to move the buffer forward</param> |
@@ -897,7 +897,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
897 | oHeader.PayloadLen = BitConverter.ToUInt16(pBuffer, pOffset + index); | 897 | oHeader.PayloadLen = BitConverter.ToUInt16(pBuffer, pOffset + index); |
898 | index += 2; | 898 | index += 2; |
899 | break; | 899 | break; |
900 | case 127: // we got more this is a bigger frame | 900 | case 127: // we got more this is a bigger frame |
901 | // 8 bytes - uint64 - most significant bit 0 network byte order | 901 | // 8 bytes - uint64 - most significant bit 0 network byte order |
902 | minumheadersize += 8; | 902 | minumheadersize += 8; |
903 | if (length < minumheadersize) | 903 | if (length < minumheadersize) |
@@ -909,7 +909,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
909 | oHeader.PayloadLen = BitConverter.ToUInt64(pBuffer, pOffset + index); | 909 | oHeader.PayloadLen = BitConverter.ToUInt64(pBuffer, pOffset + index); |
910 | index += 8; | 910 | index += 8; |
911 | break; | 911 | break; |
912 | 912 | ||
913 | } | 913 | } |
914 | //oHeader.PayloadLeft = oHeader.PayloadLen; // Start the count in case it's chunked over the network. This is different then frame fragmentation | 914 | //oHeader.PayloadLeft = oHeader.PayloadLen; // Start the count in case it's chunked over the network. This is different then frame fragmentation |
915 | if (oHeader.IsMasked) | 915 | if (oHeader.IsMasked) |
@@ -937,9 +937,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
937 | /* | 937 | /* |
938 | * RFC6455 | 938 | * RFC6455 |
939 | nib 0 1 2 3 4 5 6 7 | 939 | nib 0 1 2 3 4 5 6 7 |
940 | byt 0 1 2 3 | 940 | byt 0 1 2 3 |
941 | dec 0 1 2 3 | 941 | dec 0 1 2 3 |
942 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 942 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
943 | +-+-+-+-+-------+-+-------------+-------------------------------+ | 943 | +-+-+-+-+-------+-+-------------+-------------------------------+ |
944 | |F|R|R|R| opcode|M| Payload len | Extended payload length | | 944 | |F|R|R|R| opcode|M| Payload len | Extended payload length | |
945 | |I|S|S|S| (4) |A| (7) | (16/64) + | 945 | |I|S|S|S| (4) |A| (7) | (16/64) + |
@@ -963,7 +963,7 @@ dec 0 1 2 3 | |||
963 | public static readonly WebSocketFrame DefaultFrame = new WebSocketFrame(){Header = new WebsocketFrameHeader(),WebSocketPayload = new byte[0]}; | 963 | public static readonly WebSocketFrame DefaultFrame = new WebSocketFrame(){Header = new WebsocketFrameHeader(),WebSocketPayload = new byte[0]}; |
964 | public WebsocketFrameHeader Header; | 964 | public WebsocketFrameHeader Header; |
965 | public byte[] WebSocketPayload; | 965 | public byte[] WebSocketPayload; |
966 | 966 | ||
967 | public byte[] ToBytes() | 967 | public byte[] ToBytes() |
968 | { | 968 | { |
969 | Header.PayloadLen = (ulong)WebSocketPayload.Length; | 969 | Header.PayloadLen = (ulong)WebSocketPayload.Length; |
@@ -991,7 +991,7 @@ dec 0 1 2 3 | |||
991 | public int Mask; | 991 | public int Mask; |
992 | /* | 992 | /* |
993 | byt 0 1 2 3 | 993 | byt 0 1 2 3 |
994 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 994 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
995 | +---------------+---------------+---------------+---------------+ | 995 | +---------------+---------------+---------------+---------------+ |
996 | | Octal 1 | Octal 2 | Octal 3 | Octal 4 | | 996 | | Octal 1 | Octal 2 | Octal 3 | Octal 4 | |
997 | +---------------+---------------+---------------+---------------+ | 997 | +---------------+---------------+---------------+---------------+ |
@@ -1002,11 +1002,11 @@ byt 0 1 2 3 | |||
1002 | 1002 | ||
1003 | public UInt64 PayloadLen; | 1003 | public UInt64 PayloadLen; |
1004 | //public UInt64 PayloadLeft; | 1004 | //public UInt64 PayloadLeft; |
1005 | // Payload is X + Y | 1005 | // Payload is X + Y |
1006 | //public UInt64 ExtensionDataLength; | 1006 | //public UInt64 ExtensionDataLength; |
1007 | //public UInt64 ApplicationDataLength; | 1007 | //public UInt64 ApplicationDataLength; |
1008 | public static readonly WebsocketFrameHeader ZeroHeader = WebsocketFrameHeader.HeaderDefault(); | 1008 | public static readonly WebsocketFrameHeader ZeroHeader = WebsocketFrameHeader.HeaderDefault(); |
1009 | 1009 | ||
1010 | public void SetDefault() | 1010 | public void SetDefault() |
1011 | { | 1011 | { |
1012 | 1012 | ||
@@ -1025,16 +1025,16 @@ byt 0 1 2 3 | |||
1025 | /// <summary> | 1025 | /// <summary> |
1026 | /// Returns a byte array representing the Frame header | 1026 | /// Returns a byte array representing the Frame header |
1027 | /// </summary> | 1027 | /// </summary> |
1028 | /// <param name="payload">This is the frame data payload. The header describes the size of the payload. | 1028 | /// <param name="payload">This is the frame data payload. The header describes the size of the payload. |
1029 | /// If payload is null, a Zero sized payload is assumed</param> | 1029 | /// If payload is null, a Zero sized payload is assumed</param> |
1030 | /// <returns>Returns a byte array representing the frame header</returns> | 1030 | /// <returns>Returns a byte array representing the frame header</returns> |
1031 | public byte[] ToBytes(byte[] payload) | 1031 | public byte[] ToBytes(byte[] payload) |
1032 | { | 1032 | { |
1033 | List<byte> result = new List<byte>(); | 1033 | List<byte> result = new List<byte>(); |
1034 | 1034 | ||
1035 | // Squeeze in our opcode and our ending bit. | 1035 | // Squeeze in our opcode and our ending bit. |
1036 | result.Add((byte)((byte)Opcode | (IsEnd?0x80:0x00) )); | 1036 | result.Add((byte)((byte)Opcode | (IsEnd?0x80:0x00) )); |
1037 | 1037 | ||
1038 | // Again with the three different byte interpretations of size.. | 1038 | // Again with the three different byte interpretations of size.. |
1039 | 1039 | ||
1040 | //bytesize | 1040 | //bytesize |
@@ -1056,7 +1056,7 @@ byt 0 1 2 3 | |||
1056 | Array.Reverse(payloadLengthByte); | 1056 | Array.Reverse(payloadLengthByte); |
1057 | result.AddRange(payloadLengthByte); | 1057 | result.AddRange(payloadLengthByte); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | // Only add a payload if it's not null | 1060 | // Only add a payload if it's not null |
1061 | if (payload != null) | 1061 | if (payload != null) |
1062 | { | 1062 | { |
@@ -1155,5 +1155,5 @@ byt 0 1 2 3 | |||
1155 | 1155 | ||
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | 1158 | ||
1159 | } | 1159 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/XmlRpcBasicDOSProtector.cs b/OpenSim/Framework/Servers/HttpServer/XmlRpcBasicDOSProtector.cs index f212208..6b2c0ab 100644 --- a/OpenSim/Framework/Servers/HttpServer/XmlRpcBasicDOSProtector.cs +++ b/OpenSim/Framework/Servers/HttpServer/XmlRpcBasicDOSProtector.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
36 | { | 36 | { |
37 | private readonly XmlRpcMethod _normalMethod; | 37 | private readonly XmlRpcMethod _normalMethod; |
38 | private readonly XmlRpcMethod _throttledMethod; | 38 | private readonly XmlRpcMethod _throttledMethod; |
39 | 39 | ||
40 | private readonly BasicDosProtectorOptions _options; | 40 | private readonly BasicDosProtectorOptions _options; |
41 | private readonly BasicDOSProtector _dosProtector; | 41 | private readonly BasicDOSProtector _dosProtector; |
42 | 42 | ||
@@ -44,7 +44,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
44 | { | 44 | { |
45 | _normalMethod = normalMethod; | 45 | _normalMethod = normalMethod; |
46 | _throttledMethod = throttledMethod; | 46 | _throttledMethod = throttledMethod; |
47 | 47 | ||
48 | _options = options; | 48 | _options = options; |
49 | _dosProtector = new BasicDOSProtector(_options); | 49 | _dosProtector = new BasicDOSProtector(_options); |
50 | 50 | ||
@@ -87,5 +87,5 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
87 | 87 | ||
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | } | 91 | } |