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