diff options
author | UbitUmarov | 2017-01-05 19:32:57 +0000 |
---|---|---|
committer | UbitUmarov | 2017-01-05 19:32:57 +0000 |
commit | 254b26a7d51143d4e08229fa0b0fceabd76a41d0 (patch) | |
tree | 8ed65006e5dc04e69ceba67e31075a9e505e64f6 /OpenSim/Framework/Servers | |
parent | Merge branch 'master' into httptests (diff) | |
parent | Massive tab and trailing space cleanup (diff) | |
download | opensim-SC-254b26a7d51143d4e08229fa0b0fceabd76a41d0.zip opensim-SC-254b26a7d51143d4e08229fa0b0fceabd76a41d0.tar.gz opensim-SC-254b26a7d51143d4e08229fa0b0fceabd76a41d0.tar.bz2 opensim-SC-254b26a7d51143d4e08229fa0b0fceabd76a41d0.tar.xz |
fix merge
Diffstat (limited to '')
23 files changed, 241 insertions, 241 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 541b658..5111673 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -71,9 +71,9 @@ namespace OpenSim.Framework.Servers | |||
71 | 71 | ||
72 | private int m_periodDiagnosticTimerMS = 60 * 60 * 1000; | 72 | private int m_periodDiagnosticTimerMS = 60 * 60 * 1000; |
73 | private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); | 73 | private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); |
74 | 74 | ||
75 | /// <summary> | 75 | /// <summary> |
76 | /// Random uuid for private data | 76 | /// Random uuid for private data |
77 | /// </summary> | 77 | /// </summary> |
78 | protected string m_osSecret = String.Empty; | 78 | protected string m_osSecret = String.Empty; |
79 | 79 | ||
@@ -88,7 +88,7 @@ namespace OpenSim.Framework.Servers | |||
88 | // Random uuid for private data | 88 | // Random uuid for private data |
89 | m_osSecret = UUID.Random().ToString(); | 89 | m_osSecret = UUID.Random().ToString(); |
90 | } | 90 | } |
91 | 91 | ||
92 | private static bool m_NoVerifyCertChain = false; | 92 | private static bool m_NoVerifyCertChain = false; |
93 | private static bool m_NoVerifyCertHostname = false; | 93 | private static bool m_NoVerifyCertHostname = false; |
94 | 94 | ||
@@ -132,10 +132,10 @@ namespace OpenSim.Framework.Servers | |||
132 | m_periodicDiagnosticsTimer.Interval = m_periodDiagnosticTimerMS; | 132 | m_periodicDiagnosticsTimer.Interval = m_periodDiagnosticTimerMS; |
133 | m_periodicDiagnosticsTimer.Enabled = true; | 133 | m_periodicDiagnosticsTimer.Enabled = true; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | protected override void ShutdownSpecific() | 137 | protected override void ShutdownSpecific() |
138 | { | 138 | { |
139 | m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); | 139 | m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); |
140 | 140 | ||
141 | RemovePIDFile(); | 141 | RemovePIDFile(); |
@@ -145,12 +145,12 @@ namespace OpenSim.Framework.Servers | |||
145 | if (!SuppressExit) | 145 | if (!SuppressExit) |
146 | Environment.Exit(0); | 146 | Environment.Exit(0); |
147 | } | 147 | } |
148 | 148 | ||
149 | /// <summary> | 149 | /// <summary> |
150 | /// Provides a list of help topics that are available. Overriding classes should append their topics to the | 150 | /// Provides a list of help topics that are available. Overriding classes should append their topics to the |
151 | /// information returned when the base method is called. | 151 | /// information returned when the base method is called. |
152 | /// </summary> | 152 | /// </summary> |
153 | /// | 153 | /// |
154 | /// <returns> | 154 | /// <returns> |
155 | /// A list of strings that represent different help topics on which more information is available | 155 | /// A list of strings that represent different help topics on which more information is available |
156 | /// </returns> | 156 | /// </returns> |
@@ -176,7 +176,7 @@ namespace OpenSim.Framework.Servers | |||
176 | public virtual void Startup() | 176 | public virtual void Startup() |
177 | { | 177 | { |
178 | m_log.Info("[STARTUP]: Beginning startup processing"); | 178 | m_log.Info("[STARTUP]: Beginning startup processing"); |
179 | 179 | ||
180 | m_log.Info("[STARTUP]: version: " + m_version + Environment.NewLine); | 180 | m_log.Info("[STARTUP]: version: " + m_version + Environment.NewLine); |
181 | // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and | 181 | // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and |
182 | // the clr version number doesn't match the project version number under Mono. | 182 | // the clr version number doesn't match the project version number under Mono. |
@@ -184,7 +184,7 @@ namespace OpenSim.Framework.Servers | |||
184 | m_log.InfoFormat( | 184 | m_log.InfoFormat( |
185 | "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n", | 185 | "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n", |
186 | Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32"); | 186 | Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32"); |
187 | 187 | ||
188 | try | 188 | try |
189 | { | 189 | { |
190 | StartupSpecific(); | 190 | StartupSpecific(); |
@@ -195,18 +195,18 @@ namespace OpenSim.Framework.Servers | |||
195 | (e.Message == null || e.Message == String.Empty) ? "Unknown reason":e.Message ); | 195 | (e.Message == null || e.Message == String.Empty) ? "Unknown reason":e.Message ); |
196 | Environment.Exit(1); | 196 | Environment.Exit(1); |
197 | } | 197 | } |
198 | 198 | ||
199 | TimeSpan timeTaken = DateTime.Now - m_startuptime; | 199 | TimeSpan timeTaken = DateTime.Now - m_startuptime; |
200 | 200 | ||
201 | // MainConsole.Instance.OutputFormat( | 201 | // MainConsole.Instance.OutputFormat( |
202 | // "PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED. Non-script portion of startup took {0}m {1}s.", | 202 | // "PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED. Non-script portion of startup took {0}m {1}s.", |
203 | // timeTaken.Minutes, timeTaken.Seconds); | 203 | // timeTaken.Minutes, timeTaken.Seconds); |
204 | } | 204 | } |
205 | 205 | ||
206 | public string osSecret | 206 | public string osSecret |
207 | { | 207 | { |
208 | // Secret uuid for the simulator | 208 | // Secret uuid for the simulator |
209 | get { return m_osSecret; } | 209 | get { return m_osSecret; } |
210 | } | 210 | } |
211 | 211 | ||
212 | public string StatReport(IOSHttpRequest httpRequest) | 212 | public string StatReport(IOSHttpRequest httpRequest) |
@@ -215,8 +215,8 @@ namespace OpenSim.Framework.Servers | |||
215 | if (httpRequest.Query.ContainsKey("callback")) | 215 | if (httpRequest.Query.ContainsKey("callback")) |
216 | { | 216 | { |
217 | return httpRequest.Query["callback"].ToString() + "(" + StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");"; | 217 | return httpRequest.Query["callback"].ToString() + "(" + StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");"; |
218 | } | 218 | } |
219 | else | 219 | else |
220 | { | 220 | { |
221 | return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); | 221 | return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); |
222 | } | 222 | } |
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 | ||
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 8456654..8e1b545 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 a9860cc..a1bc27b 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | |||
@@ -48,14 +48,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
48 | public DropMethod Drop; | 48 | public DropMethod Drop; |
49 | public UUID Id; | 49 | public UUID Id; |
50 | public int TimeOutms; | 50 | public int TimeOutms; |
51 | public EventType Type; | 51 | public EventType Type; |
52 | 52 | ||
53 | public enum EventType : int | 53 | public enum EventType : int |
54 | { | 54 | { |
55 | LongPoll = 0, | 55 | LongPoll = 0, |
56 | LslHttp = 1, | 56 | LslHttp = 1, |
57 | Inventory = 2, | 57 | Inventory = 2, |
58 | Texture = 3, | 58 | Texture = 3, |
59 | Mesh = 4 | 59 | Mesh = 4 |
60 | } | 60 | } |
61 | 61 | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 5b40590..82c7727 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 | } |
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index e9c284c..29308a9 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs | |||
@@ -239,11 +239,11 @@ namespace OpenSim.Framework.Servers | |||
239 | { | 239 | { |
240 | handlers.AppendFormat( | 240 | handlers.AppendFormat( |
241 | "Registered HTTP Handlers for server at {0}:{1}\n", httpServer.ListenIPAddress, httpServer.Port); | 241 | "Registered HTTP Handlers for server at {0}:{1}\n", httpServer.ListenIPAddress, httpServer.Port); |
242 | 242 | ||
243 | handlers.AppendFormat("* XMLRPC:\n"); | 243 | handlers.AppendFormat("* XMLRPC:\n"); |
244 | foreach (String s in httpServer.GetXmlRpcHandlerKeys()) | 244 | foreach (String s in httpServer.GetXmlRpcHandlerKeys()) |
245 | handlers.AppendFormat("\t{0}\n", s); | 245 | handlers.AppendFormat("\t{0}\n", s); |
246 | 246 | ||
247 | handlers.AppendFormat("* HTTP:\n"); | 247 | handlers.AppendFormat("* HTTP:\n"); |
248 | foreach (String s in httpServer.GetHTTPHandlerKeys()) | 248 | foreach (String s in httpServer.GetHTTPHandlerKeys()) |
249 | handlers.AppendFormat("\t{0}\n", s); | 249 | handlers.AppendFormat("\t{0}\n", s); |
@@ -251,19 +251,19 @@ namespace OpenSim.Framework.Servers | |||
251 | handlers.AppendFormat("* HTTP (poll):\n"); | 251 | handlers.AppendFormat("* HTTP (poll):\n"); |
252 | foreach (String s in httpServer.GetPollServiceHandlerKeys()) | 252 | foreach (String s in httpServer.GetPollServiceHandlerKeys()) |
253 | handlers.AppendFormat("\t{0}\n", s); | 253 | handlers.AppendFormat("\t{0}\n", s); |
254 | 254 | ||
255 | handlers.AppendFormat("* JSONRPC:\n"); | 255 | handlers.AppendFormat("* JSONRPC:\n"); |
256 | foreach (String s in httpServer.GetJsonRpcHandlerKeys()) | 256 | foreach (String s in httpServer.GetJsonRpcHandlerKeys()) |
257 | handlers.AppendFormat("\t{0}\n", s); | 257 | handlers.AppendFormat("\t{0}\n", s); |
258 | 258 | ||
259 | // handlers.AppendFormat("* Agent:\n"); | 259 | // handlers.AppendFormat("* Agent:\n"); |
260 | // foreach (String s in httpServer.GetAgentHandlerKeys()) | 260 | // foreach (String s in httpServer.GetAgentHandlerKeys()) |
261 | // handlers.AppendFormat("\t{0}\n", s); | 261 | // handlers.AppendFormat("\t{0}\n", s); |
262 | 262 | ||
263 | handlers.AppendFormat("* LLSD:\n"); | 263 | handlers.AppendFormat("* LLSD:\n"); |
264 | foreach (String s in httpServer.GetLLSDHandlerKeys()) | 264 | foreach (String s in httpServer.GetLLSDHandlerKeys()) |
265 | handlers.AppendFormat("\t{0}\n", s); | 265 | handlers.AppendFormat("\t{0}\n", s); |
266 | 266 | ||
267 | handlers.AppendFormat("* StreamHandlers ({0}):\n", httpServer.GetStreamHandlerKeys().Count); | 267 | handlers.AppendFormat("* StreamHandlers ({0}):\n", httpServer.GetStreamHandlerKeys().Count); |
268 | foreach (String s in httpServer.GetStreamHandlerKeys()) | 268 | foreach (String s in httpServer.GetStreamHandlerKeys()) |
269 | handlers.AppendFormat("\t{0}\n", s); | 269 | handlers.AppendFormat("\t{0}\n", s); |
@@ -350,7 +350,7 @@ namespace OpenSim.Framework.Servers | |||
350 | { | 350 | { |
351 | if (port == 0) | 351 | if (port == 0) |
352 | return Instance; | 352 | return Instance; |
353 | 353 | ||
354 | if (instance != null && port == Instance.Port) | 354 | if (instance != null && port == Instance.Port) |
355 | return Instance; | 355 | return Instance; |
356 | 356 | ||
diff --git a/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs b/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs index 792c62e..4469e7c 100644 --- a/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Servers/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")] | 8 | [assembly: AssemblyTitle("OpenSim.Framework.Servers")] |
@@ -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/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index 7b806a4..8965e71 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs | |||
@@ -56,7 +56,7 @@ namespace OpenSim.Framework.Servers | |||
56 | protected ICommandConsole m_console; | 56 | protected ICommandConsole m_console; |
57 | 57 | ||
58 | protected OpenSimAppender m_consoleAppender; | 58 | protected OpenSimAppender m_consoleAppender; |
59 | protected FileAppender m_logFileAppender; | 59 | protected FileAppender m_logFileAppender; |
60 | 60 | ||
61 | protected DateTime m_startuptime; | 61 | protected DateTime m_startuptime; |
62 | protected string m_startupDirectory = Environment.CurrentDirectory; | 62 | protected string m_startupDirectory = Environment.CurrentDirectory; |
@@ -81,7 +81,7 @@ namespace OpenSim.Framework.Servers | |||
81 | { | 81 | { |
82 | if (File.Exists(path)) | 82 | if (File.Exists(path)) |
83 | m_log.ErrorFormat( | 83 | m_log.ErrorFormat( |
84 | "[SERVER BASE]: Previous pid file {0} still exists on startup. Possibly previously unclean shutdown.", | 84 | "[SERVER BASE]: Previous pid file {0} still exists on startup. Possibly previously unclean shutdown.", |
85 | path); | 85 | path); |
86 | 86 | ||
87 | try | 87 | try |
@@ -103,7 +103,7 @@ namespace OpenSim.Framework.Servers | |||
103 | m_log.Warn(string.Format("[SERVER BASE]: Could not create PID file at {0} ", path), e); | 103 | m_log.Warn(string.Format("[SERVER BASE]: Could not create PID file at {0} ", path), e); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | protected void RemovePIDFile() | 107 | protected void RemovePIDFile() |
108 | { | 108 | { |
109 | if (m_pidFile != String.Empty) | 109 | if (m_pidFile != String.Empty) |
@@ -166,11 +166,11 @@ namespace OpenSim.Framework.Servers | |||
166 | { | 166 | { |
167 | // FIXME: This should be done through an interface rather than casting. | 167 | // FIXME: This should be done through an interface rather than casting. |
168 | m_consoleAppender.Console = (ConsoleBase)m_console; | 168 | m_consoleAppender.Console = (ConsoleBase)m_console; |
169 | 169 | ||
170 | // If there is no threshold set then the threshold is effectively everything. | 170 | // If there is no threshold set then the threshold is effectively everything. |
171 | if (null == m_consoleAppender.Threshold) | 171 | if (null == m_consoleAppender.Threshold) |
172 | m_consoleAppender.Threshold = Level.All; | 172 | m_consoleAppender.Threshold = Level.All; |
173 | 173 | ||
174 | Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); | 174 | Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); |
175 | } | 175 | } |
176 | 176 | ||
@@ -205,11 +205,11 @@ namespace OpenSim.Framework.Servers | |||
205 | "General", false, "show uptime", "show uptime", "Show server uptime", HandleShow); | 205 | "General", false, "show uptime", "show uptime", "Show server uptime", HandleShow); |
206 | 206 | ||
207 | m_console.Commands.AddCommand( | 207 | m_console.Commands.AddCommand( |
208 | "General", false, "get log level", "get log level", "Get the current console logging level", | 208 | "General", false, "get log level", "get log level", "Get the current console logging level", |
209 | (mod, cmd) => ShowLogLevel()); | 209 | (mod, cmd) => ShowLogLevel()); |
210 | 210 | ||
211 | m_console.Commands.AddCommand( | 211 | m_console.Commands.AddCommand( |
212 | "General", false, "set log level", "set log level <level>", | 212 | "General", false, "set log level", "set log level <level>", |
213 | "Set the console logging level for this session.", HandleSetLogLevel); | 213 | "Set the console logging level for this session.", HandleSetLogLevel); |
214 | 214 | ||
215 | m_console.Commands.AddCommand( | 215 | m_console.Commands.AddCommand( |
@@ -222,14 +222,14 @@ namespace OpenSim.Framework.Servers | |||
222 | "config get [<section>] [<key>]", | 222 | "config get [<section>] [<key>]", |
223 | "Synonym for config show", | 223 | "Synonym for config show", |
224 | HandleConfig); | 224 | HandleConfig); |
225 | 225 | ||
226 | m_console.Commands.AddCommand( | 226 | m_console.Commands.AddCommand( |
227 | "General", false, "config show", | 227 | "General", false, "config show", |
228 | "config show [<section>] [<key>]", | 228 | "config show [<section>] [<key>]", |
229 | "Show config information", | 229 | "Show config information", |
230 | "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine | 230 | "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine |
231 | + "If a section is given but not a field, then all fields in that section are printed.", | 231 | + "If a section is given but not a field, then all fields in that section are printed.", |
232 | HandleConfig); | 232 | HandleConfig); |
233 | 233 | ||
234 | m_console.Commands.AddCommand( | 234 | m_console.Commands.AddCommand( |
235 | "General", false, "config save", | 235 | "General", false, "config save", |
@@ -280,7 +280,7 @@ namespace OpenSim.Framework.Servers | |||
280 | "debug threadpool status", | 280 | "debug threadpool status", |
281 | "Show current debug threadpool parameters.", | 281 | "Show current debug threadpool parameters.", |
282 | HandleDebugThreadpoolStatus); | 282 | HandleDebugThreadpoolStatus); |
283 | 283 | ||
284 | m_console.Commands.AddCommand( | 284 | m_console.Commands.AddCommand( |
285 | "Debug", false, "debug threadpool level", | 285 | "Debug", false, "debug threadpool level", |
286 | "debug threadpool level 0.." + Util.MAX_THREADPOOL_LEVEL, | 286 | "debug threadpool level 0.." + Util.MAX_THREADPOOL_LEVEL, |
@@ -332,7 +332,7 @@ namespace OpenSim.Framework.Servers | |||
332 | { | 332 | { |
333 | WebUtil.SerializeOSDRequestsPerEndpoint = networkConfig.GetBoolean("SerializeOSDRequests", false); | 333 | WebUtil.SerializeOSDRequestsPerEndpoint = networkConfig.GetBoolean("SerializeOSDRequests", false); |
334 | } | 334 | } |
335 | 335 | ||
336 | m_serverStatsCollector = new ServerStatsCollector(); | 336 | m_serverStatsCollector = new ServerStatsCollector(); |
337 | m_serverStatsCollector.Initialise(configSource); | 337 | m_serverStatsCollector.Initialise(configSource); |
338 | m_serverStatsCollector.Start(); | 338 | m_serverStatsCollector.Start(); |
@@ -432,7 +432,7 @@ namespace OpenSim.Framework.Servers | |||
432 | 432 | ||
433 | ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads); | 433 | ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads); |
434 | Notice("Available worker threads: {0}", workerThreads); | 434 | Notice("Available worker threads: {0}", workerThreads); |
435 | Notice("Available IOCP threads: {0}", iocpThreads); | 435 | Notice("Available IOCP threads: {0}", iocpThreads); |
436 | } | 436 | } |
437 | 437 | ||
438 | private void HandleDebugThreadpoolSet(string module, string[] args) | 438 | private void HandleDebugThreadpoolSet(string module, string[] args) |
@@ -488,7 +488,7 @@ namespace OpenSim.Framework.Servers | |||
488 | fail = true; | 488 | fail = true; |
489 | } | 489 | } |
490 | } | 490 | } |
491 | 491 | ||
492 | if (fail) | 492 | if (fail) |
493 | { | 493 | { |
494 | Notice("ERROR: Could not set {0} {1} threads to {2}", poolType, bound, newThreads); | 494 | Notice("ERROR: Could not set {0} {1} threads to {2}", poolType, bound, newThreads); |
@@ -582,7 +582,7 @@ namespace OpenSim.Framework.Servers | |||
582 | if (cmdparams.Length > 0) | 582 | if (cmdparams.Length > 0) |
583 | { | 583 | { |
584 | string firstParam = cmdparams[0].ToLower(); | 584 | string firstParam = cmdparams[0].ToLower(); |
585 | 585 | ||
586 | switch (firstParam) | 586 | switch (firstParam) |
587 | { | 587 | { |
588 | case "set": | 588 | case "set": |
@@ -633,12 +633,12 @@ namespace OpenSim.Framework.Servers | |||
633 | { | 633 | { |
634 | Notice("[{0}]", config.Name); | 634 | Notice("[{0}]", config.Name); |
635 | foreach (string key in config.GetKeys()) | 635 | foreach (string key in config.GetKeys()) |
636 | Notice(" {0} = {1}", key, config.GetString(key)); | 636 | Notice(" {0} = {1}", key, config.GetString(key)); |
637 | } | 637 | } |
638 | else | 638 | else |
639 | { | 639 | { |
640 | Notice( | 640 | Notice( |
641 | "config get {0} {1} : {2}", | 641 | "config get {0} {1} : {2}", |
642 | cmdparams[1], cmdparams[2], config.GetString(cmdparams[2])); | 642 | cmdparams[1], cmdparams[2], config.GetString(cmdparams[2])); |
643 | } | 643 | } |
644 | } | 644 | } |
@@ -692,10 +692,10 @@ namespace OpenSim.Framework.Servers | |||
692 | } | 692 | } |
693 | 693 | ||
694 | string rawLevel = cmd[3]; | 694 | string rawLevel = cmd[3]; |
695 | 695 | ||
696 | ILoggerRepository repository = LogManager.GetRepository(); | 696 | ILoggerRepository repository = LogManager.GetRepository(); |
697 | Level consoleLevel = repository.LevelMap[rawLevel]; | 697 | Level consoleLevel = repository.LevelMap[rawLevel]; |
698 | 698 | ||
699 | if (consoleLevel != null) | 699 | if (consoleLevel != null) |
700 | m_consoleAppender.Threshold = consoleLevel; | 700 | m_consoleAppender.Threshold = consoleLevel; |
701 | else | 701 | else |
@@ -770,9 +770,9 @@ namespace OpenSim.Framework.Servers | |||
770 | protected void ShowInfo() | 770 | protected void ShowInfo() |
771 | { | 771 | { |
772 | Notice(GetVersionText()); | 772 | Notice(GetVersionText()); |
773 | Notice("Startup directory: " + m_startupDirectory); | 773 | Notice("Startup directory: " + m_startupDirectory); |
774 | if (null != m_consoleAppender) | 774 | if (null != m_consoleAppender) |
775 | Notice(String.Format("Console log level: {0}", m_consoleAppender.Threshold)); | 775 | Notice(String.Format("Console log level: {0}", m_consoleAppender.Threshold)); |
776 | } | 776 | } |
777 | 777 | ||
778 | /// <summary> | 778 | /// <summary> |
@@ -873,7 +873,7 @@ namespace OpenSim.Framework.Servers | |||
873 | 873 | ||
874 | public string GetVersionText() | 874 | public string GetVersionText() |
875 | { | 875 | { |
876 | return String.Format("Version: {0} (SIMULATION/{1} - SIMULATION/{2})", | 876 | return String.Format("Version: {0} (SIMULATION/{1} - SIMULATION/{2})", |
877 | m_version, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax); | 877 | m_version, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax); |
878 | } | 878 | } |
879 | 879 | ||
@@ -898,7 +898,7 @@ namespace OpenSim.Framework.Servers | |||
898 | foreach (Watchdog.ThreadWatchdogInfo twi in threads) | 898 | foreach (Watchdog.ThreadWatchdogInfo twi in threads) |
899 | { | 899 | { |
900 | Thread t = twi.Thread; | 900 | Thread t = twi.Thread; |
901 | 901 | ||
902 | sb.AppendFormat( | 902 | sb.AppendFormat( |
903 | reportFormat, | 903 | reportFormat, |
904 | t.ManagedThreadId, | 904 | t.ManagedThreadId, |
@@ -1005,7 +1005,7 @@ namespace OpenSim.Framework.Servers | |||
1005 | MainConsole.Instance.OutputFormat("Aborted thread with id {0}", threadId); | 1005 | MainConsole.Instance.OutputFormat("Aborted thread with id {0}", threadId); |
1006 | else | 1006 | else |
1007 | MainConsole.Instance.OutputFormat("ERROR - Thread with id {0} not found in managed threads", threadId); | 1007 | MainConsole.Instance.OutputFormat("ERROR - Thread with id {0} not found in managed threads", threadId); |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | /// <summary> | 1010 | /// <summary> |
1011 | /// Console output is only possible if a console has been established. | 1011 | /// Console output is only possible if a console has been established. |
@@ -1020,13 +1020,13 @@ namespace OpenSim.Framework.Servers | |||
1020 | m_console.Output(msg); | 1020 | m_console.Output(msg); |
1021 | } | 1021 | } |
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | /// <summary> | 1024 | /// <summary> |
1025 | /// Console output is only possible if a console has been established. | 1025 | /// Console output is only possible if a console has been established. |
1026 | /// That is something that cannot be determined within this class. So | 1026 | /// That is something that cannot be determined within this class. So |
1027 | /// all attempts to use the console MUST be verified. | 1027 | /// all attempts to use the console MUST be verified. |
1028 | /// </summary> | 1028 | /// </summary> |
1029 | /// <param name="format"></param> | 1029 | /// <param name="format"></param> |
1030 | /// <param name="components"></param> | 1030 | /// <param name="components"></param> |
1031 | protected void Notice(string format, params object[] components) | 1031 | protected void Notice(string format, params object[] components) |
1032 | { | 1032 | { |
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs index 60533cd..e5f7043 100644 --- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs +++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs | |||
@@ -92,87 +92,87 @@ namespace OpenSim.Framework.Servers.Tests | |||
92 | public class TestHttpRequest: IHttpRequest | 92 | public class TestHttpRequest: IHttpRequest |
93 | { | 93 | { |
94 | private string _uriPath; | 94 | private string _uriPath; |
95 | public bool BodyIsComplete | 95 | public bool BodyIsComplete |
96 | { | 96 | { |
97 | get { return true; } | 97 | get { return true; } |
98 | } | 98 | } |
99 | public string[] AcceptTypes | 99 | public string[] AcceptTypes |
100 | { | 100 | { |
101 | get {return _acceptTypes; } | 101 | get {return _acceptTypes; } |
102 | } | 102 | } |
103 | private string[] _acceptTypes; | 103 | private string[] _acceptTypes; |
104 | public Stream Body | 104 | public Stream Body |
105 | { | 105 | { |
106 | get { return _body; } | 106 | get { return _body; } |
107 | set { _body = value;} | 107 | set { _body = value;} |
108 | } | 108 | } |
109 | private Stream _body; | 109 | private Stream _body; |
110 | public ConnectionType Connection | 110 | public ConnectionType Connection |
111 | { | 111 | { |
112 | get { return _connection; } | 112 | get { return _connection; } |
113 | set { _connection = value; } | 113 | set { _connection = value; } |
114 | } | 114 | } |
115 | private ConnectionType _connection; | 115 | private ConnectionType _connection; |
116 | public int ContentLength | 116 | public int ContentLength |
117 | { | 117 | { |
118 | get { return _contentLength; } | 118 | get { return _contentLength; } |
119 | set { _contentLength = value; } | 119 | set { _contentLength = value; } |
120 | } | 120 | } |
121 | private int _contentLength; | 121 | private int _contentLength; |
122 | public NameValueCollection Headers | 122 | public NameValueCollection Headers |
123 | { | 123 | { |
124 | get { return _headers; } | 124 | get { return _headers; } |
125 | } | 125 | } |
126 | private NameValueCollection _headers = new NameValueCollection(); | 126 | private NameValueCollection _headers = new NameValueCollection(); |
127 | public string HttpVersion | 127 | public string HttpVersion |
128 | { | 128 | { |
129 | get { return _httpVersion; } | 129 | get { return _httpVersion; } |
130 | set { _httpVersion = value; } | 130 | set { _httpVersion = value; } |
131 | } | 131 | } |
132 | private string _httpVersion = null; | 132 | private string _httpVersion = null; |
133 | public string Method | 133 | public string Method |
134 | { | 134 | { |
135 | get { return _method; } | 135 | get { return _method; } |
136 | set { _method = value; } | 136 | set { _method = value; } |
137 | } | 137 | } |
138 | private string _method = null; | 138 | private string _method = null; |
139 | public HttpInput QueryString | 139 | public HttpInput QueryString |
140 | { | 140 | { |
141 | get { return _queryString; } | 141 | get { return _queryString; } |
142 | } | 142 | } |
143 | private HttpInput _queryString = null; | 143 | private HttpInput _queryString = null; |
144 | public Uri Uri | 144 | public Uri Uri |
145 | { | 145 | { |
146 | get { return _uri; } | 146 | get { return _uri; } |
147 | set { _uri = value; } | 147 | set { _uri = value; } |
148 | } | 148 | } |
149 | private Uri _uri = null; | 149 | private Uri _uri = null; |
150 | public string[] UriParts | 150 | public string[] UriParts |
151 | { | 151 | { |
152 | get { return _uri.Segments; } | 152 | get { return _uri.Segments; } |
153 | } | 153 | } |
154 | public HttpParam Param | 154 | public HttpParam Param |
155 | { | 155 | { |
156 | get { return null; } | 156 | get { return null; } |
157 | } | 157 | } |
158 | public HttpForm Form | 158 | public HttpForm Form |
159 | { | 159 | { |
160 | get { return null; } | 160 | get { return null; } |
161 | } | 161 | } |
162 | public bool IsAjax | 162 | public bool IsAjax |
163 | { | 163 | { |
164 | get { return false; } | 164 | get { return false; } |
165 | } | 165 | } |
166 | public RequestCookies Cookies | 166 | public RequestCookies Cookies |
167 | { | 167 | { |
168 | get { return null; } | 168 | get { return null; } |
169 | } | 169 | } |
170 | 170 | ||
171 | public TestHttpRequest() {} | 171 | public TestHttpRequest() {} |
172 | 172 | ||
173 | public TestHttpRequest(string contentEncoding, string contentType, string userAgent, | 173 | public TestHttpRequest(string contentEncoding, string contentType, string userAgent, |
174 | string remoteAddr, string remotePort, string[] acceptTypes, | 174 | string remoteAddr, string remotePort, string[] acceptTypes, |
175 | ConnectionType connectionType, int contentLength, Uri uri) | 175 | ConnectionType connectionType, int contentLength, Uri uri) |
176 | { | 176 | { |
177 | _headers["content-encoding"] = contentEncoding; | 177 | _headers["content-encoding"] = contentEncoding; |
178 | _headers["content-type"] = contentType; | 178 | _headers["content-type"] = contentType; |
@@ -192,7 +192,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
192 | { | 192 | { |
193 | _headers.Add(name, value); | 193 | _headers.Add(name, value); |
194 | } | 194 | } |
195 | public int AddToBody(byte[] bytes, int offset, int length) | 195 | public int AddToBody(byte[] bytes, int offset, int length) |
196 | { | 196 | { |
197 | return 0; | 197 | return 0; |
198 | } | 198 | } |
@@ -223,7 +223,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
223 | set | 223 | set |
224 | { | 224 | { |
225 | _uriPath = value; | 225 | _uriPath = value; |
226 | 226 | ||
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 | ||
@@ -231,7 +231,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
231 | 231 | ||
232 | public class TestHttpResponse: IHttpResponse | 232 | public class TestHttpResponse: IHttpResponse |
233 | { | 233 | { |
234 | public Stream Body | 234 | public Stream Body |
235 | { | 235 | { |
236 | get { return _body; } | 236 | get { return _body; } |
237 | 237 | ||
@@ -239,14 +239,14 @@ namespace OpenSim.Framework.Servers.Tests | |||
239 | } | 239 | } |
240 | private Stream _body; | 240 | private Stream _body; |
241 | 241 | ||
242 | public string ProtocolVersion | 242 | public string ProtocolVersion |
243 | { | 243 | { |
244 | get { return _protocolVersion; } | 244 | get { return _protocolVersion; } |
245 | set { _protocolVersion = value; } | 245 | set { _protocolVersion = value; } |
246 | } | 246 | } |
247 | private string _protocolVersion; | 247 | private string _protocolVersion; |
248 | 248 | ||
249 | public bool Chunked | 249 | public bool Chunked |
250 | { | 250 | { |
251 | get { return _chunked; } | 251 | get { return _chunked; } |
252 | 252 | ||
@@ -254,7 +254,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
254 | } | 254 | } |
255 | private bool _chunked; | 255 | private bool _chunked; |
256 | 256 | ||
257 | public ConnectionType Connection | 257 | public ConnectionType Connection |
258 | { | 258 | { |
259 | get { return _connection; } | 259 | get { return _connection; } |
260 | 260 | ||
@@ -262,7 +262,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
262 | } | 262 | } |
263 | private ConnectionType _connection; | 263 | private ConnectionType _connection; |
264 | 264 | ||
265 | public Encoding Encoding | 265 | public Encoding Encoding |
266 | { | 266 | { |
267 | get { return _encoding; } | 267 | get { return _encoding; } |
268 | 268 | ||
@@ -270,7 +270,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
270 | } | 270 | } |
271 | private Encoding _encoding; | 271 | private Encoding _encoding; |
272 | 272 | ||
273 | public int KeepAlive | 273 | public int KeepAlive |
274 | { | 274 | { |
275 | get { return _keepAlive; } | 275 | get { return _keepAlive; } |
276 | 276 | ||
@@ -278,7 +278,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
278 | } | 278 | } |
279 | private int _keepAlive; | 279 | private int _keepAlive; |
280 | 280 | ||
281 | public HttpStatusCode Status | 281 | public HttpStatusCode Status |
282 | { | 282 | { |
283 | get { return _status; } | 283 | get { return _status; } |
284 | 284 | ||
@@ -286,7 +286,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
286 | } | 286 | } |
287 | private HttpStatusCode _status; | 287 | private HttpStatusCode _status; |
288 | 288 | ||
289 | public string Reason | 289 | public string Reason |
290 | { | 290 | { |
291 | get { return _reason; } | 291 | get { return _reason; } |
292 | 292 | ||
@@ -294,7 +294,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
294 | } | 294 | } |
295 | private string _reason; | 295 | private string _reason; |
296 | 296 | ||
297 | public long ContentLength | 297 | public long ContentLength |
298 | { | 298 | { |
299 | get { return _contentLength; } | 299 | get { return _contentLength; } |
300 | 300 | ||
@@ -302,7 +302,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
302 | } | 302 | } |
303 | private long _contentLength; | 303 | private long _contentLength; |
304 | 304 | ||
305 | public string ContentType | 305 | public string ContentType |
306 | { | 306 | { |
307 | get { return _contentType; } | 307 | get { return _contentType; } |
308 | 308 | ||
@@ -310,19 +310,19 @@ namespace OpenSim.Framework.Servers.Tests | |||
310 | } | 310 | } |
311 | private string _contentType; | 311 | private string _contentType; |
312 | 312 | ||
313 | public bool HeadersSent | 313 | public bool HeadersSent |
314 | { | 314 | { |
315 | get { return _headersSent; } | 315 | get { return _headersSent; } |
316 | } | 316 | } |
317 | private bool _headersSent; | 317 | private bool _headersSent; |
318 | 318 | ||
319 | public bool Sent | 319 | public bool Sent |
320 | { | 320 | { |
321 | get { return _sent; } | 321 | get { return _sent; } |
322 | } | 322 | } |
323 | private bool _sent; | 323 | private bool _sent; |
324 | 324 | ||
325 | public ResponseCookies Cookies | 325 | public ResponseCookies Cookies |
326 | { | 326 | { |
327 | get { return _cookies; } | 327 | get { return _cookies; } |
328 | } | 328 | } |
@@ -335,25 +335,25 @@ namespace OpenSim.Framework.Servers.Tests | |||
335 | } | 335 | } |
336 | 336 | ||
337 | public void AddHeader(string name, string value) {} | 337 | public void AddHeader(string name, string value) {} |
338 | public void Send() | 338 | public void Send() |
339 | { | 339 | { |
340 | if (!_headersSent) SendHeaders(); | 340 | if (!_headersSent) SendHeaders(); |
341 | if (_sent) throw new InvalidOperationException("stuff already sent"); | 341 | if (_sent) throw new InvalidOperationException("stuff already sent"); |
342 | _sent = true; | 342 | _sent = true; |
343 | } | 343 | } |
344 | 344 | ||
345 | public void SendBody(byte[] buffer, int offset, int count) | 345 | public void SendBody(byte[] buffer, int offset, int count) |
346 | { | 346 | { |
347 | if (!_headersSent) SendHeaders(); | 347 | if (!_headersSent) SendHeaders(); |
348 | _sent = true; | 348 | _sent = true; |
349 | } | 349 | } |
350 | public void SendBody(byte[] buffer) | 350 | public void SendBody(byte[] buffer) |
351 | { | 351 | { |
352 | if (!_headersSent) SendHeaders(); | 352 | if (!_headersSent) SendHeaders(); |
353 | _sent = true; | 353 | _sent = true; |
354 | } | 354 | } |
355 | 355 | ||
356 | public void SendHeaders() | 356 | public void SendHeaders() |
357 | { | 357 | { |
358 | if (_headersSent) throw new InvalidOperationException("headers already sent"); | 358 | if (_headersSent) throw new InvalidOperationException("headers already sent"); |
359 | _headersSent = true; | 359 | _headersSent = true; |
@@ -362,7 +362,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
362 | public void Redirect(Uri uri) {} | 362 | public void Redirect(Uri uri) {} |
363 | public void Redirect(string url) {} | 363 | public void Redirect(string url) {} |
364 | } | 364 | } |
365 | 365 | ||
366 | 366 | ||
367 | public OSHttpRequest req0; | 367 | public OSHttpRequest req0; |
368 | public OSHttpRequest req1; | 368 | public OSHttpRequest req1; |
@@ -374,22 +374,22 @@ namespace OpenSim.Framework.Servers.Tests | |||
374 | [TestFixtureSetUp] | 374 | [TestFixtureSetUp] |
375 | public void Init() | 375 | public void Init() |
376 | { | 376 | { |
377 | TestHttpRequest threq0 = new TestHttpRequest("utf-8", "text/xml", "OpenSim Test Agent", "192.168.0.1", "4711", | 377 | TestHttpRequest threq0 = new TestHttpRequest("utf-8", "text/xml", "OpenSim Test Agent", "192.168.0.1", "4711", |
378 | new string[] {"text/xml"}, | 378 | new string[] {"text/xml"}, |
379 | ConnectionType.KeepAlive, 4711, | 379 | ConnectionType.KeepAlive, 4711, |
380 | new Uri("http://127.0.0.1/admin/inventory/Dr+Who/Tardis")); | 380 | new Uri("http://127.0.0.1/admin/inventory/Dr+Who/Tardis")); |
381 | threq0.Method = "GET"; | 381 | threq0.Method = "GET"; |
382 | threq0.HttpVersion = HttpHelper.HTTP10; | 382 | threq0.HttpVersion = HttpHelper.HTTP10; |
383 | 383 | ||
384 | TestHttpRequest threq1 = new TestHttpRequest("utf-8", "text/xml", "OpenSim Test Agent", "192.168.0.1", "4711", | 384 | TestHttpRequest threq1 = new TestHttpRequest("utf-8", "text/xml", "OpenSim Test Agent", "192.168.0.1", "4711", |
385 | new string[] {"text/xml"}, | 385 | new string[] {"text/xml"}, |
386 | ConnectionType.KeepAlive, 4711, | 386 | ConnectionType.KeepAlive, 4711, |
387 | new Uri("http://127.0.0.1/admin/inventory/Dr+Who/Tardis?a=0&b=1&c=2")); | 387 | new Uri("http://127.0.0.1/admin/inventory/Dr+Who/Tardis?a=0&b=1&c=2")); |
388 | threq1.Method = "POST"; | 388 | threq1.Method = "POST"; |
389 | threq1.HttpVersion = HttpHelper.HTTP11; | 389 | threq1.HttpVersion = HttpHelper.HTTP11; |
390 | threq1.Headers["x-wuff"] = "wuffwuff"; | 390 | threq1.Headers["x-wuff"] = "wuffwuff"; |
391 | threq1.Headers["www-authenticate"] = "go away"; | 391 | threq1.Headers["www-authenticate"] = "go away"; |
392 | 392 | ||
393 | req0 = new OSHttpRequest(new TestHttpClientContext(false), threq0); | 393 | req0 = new OSHttpRequest(new TestHttpClientContext(false), threq0); |
394 | req1 = new OSHttpRequest(new TestHttpClientContext(false), threq1); | 394 | req1 = new OSHttpRequest(new TestHttpClientContext(false), threq1); |
395 | 395 | ||