diff options
author | Kitto Flora | 2011-03-22 20:33:24 +0000 |
---|---|---|
committer | Kitto Flora | 2011-03-22 20:33:24 +0000 |
commit | 764e8c2a4371c24d1a0bd067c0bcbc806562064d (patch) | |
tree | 03dfb1bfe16c420fdbb6a1aa723c9203771d1beb /OpenSim/Framework/Servers | |
parent | Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff) | |
parent | Add some more fields to Estate settings and make them work. (diff) | |
download | opensim-SC-764e8c2a4371c24d1a0bd067c0bcbc806562064d.zip opensim-SC-764e8c2a4371c24d1a0bd067c0bcbc806562064d.tar.gz opensim-SC-764e8c2a4371c24d1a0bd067c0bcbc806562064d.tar.bz2 opensim-SC-764e8c2a4371c24d1a0bd067c0bcbc806562064d.tar.xz |
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Framework/Servers')
4 files changed, 83 insertions, 21 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index ebf7ded..5c3cad4 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -319,18 +319,21 @@ namespace OpenSim.Framework.Servers | |||
319 | return; | 319 | return; |
320 | } | 320 | } |
321 | 321 | ||
322 | string rawLevel = cmd[3]; | 322 | if (cmd.Length > 3) |
323 | 323 | { | |
324 | ILoggerRepository repository = LogManager.GetRepository(); | 324 | string rawLevel = cmd[3]; |
325 | Level consoleLevel = repository.LevelMap[rawLevel]; | 325 | |
326 | 326 | ILoggerRepository repository = LogManager.GetRepository(); | |
327 | if (consoleLevel != null) | 327 | Level consoleLevel = repository.LevelMap[rawLevel]; |
328 | m_consoleAppender.Threshold = consoleLevel; | 328 | |
329 | else | 329 | if (consoleLevel != null) |
330 | Notice( | 330 | m_consoleAppender.Threshold = consoleLevel; |
331 | String.Format( | 331 | else |
332 | "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", | 332 | Notice( |
333 | rawLevel)); | 333 | String.Format( |
334 | "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", | ||
335 | rawLevel)); | ||
336 | } | ||
334 | 337 | ||
335 | Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); | 338 | Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); |
336 | } | 339 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index d4ee7ba..ccec9b7 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -143,6 +143,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | public List<string> GetStreamHandlerKeys() | ||
147 | { | ||
148 | return new List<string>(m_streamHandlers.Keys); | ||
149 | } | ||
150 | |||
146 | private static string GetHandlerKey(string httpMethod, string path) | 151 | private static string GetHandlerKey(string httpMethod, string path) |
147 | { | 152 | { |
148 | return httpMethod + ":" + path; | 153 | return httpMethod + ":" + path; |
@@ -179,6 +184,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
179 | } | 184 | } |
180 | } | 185 | } |
181 | 186 | ||
187 | public List<string> GetXmlRpcHandlerKeys() | ||
188 | { | ||
189 | return new List<string>(m_rpcHandlers.Keys); | ||
190 | } | ||
191 | |||
182 | public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) | 192 | public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) |
183 | { | 193 | { |
184 | //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); | 194 | //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); |
@@ -196,6 +206,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
196 | return false; | 206 | return false; |
197 | } | 207 | } |
198 | 208 | ||
209 | public List<string> GetHTTPHandlerKeys() | ||
210 | { | ||
211 | return new List<string>(m_HTTPHandlers.Keys); | ||
212 | } | ||
213 | |||
214 | |||
199 | public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args) | 215 | public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args) |
200 | { | 216 | { |
201 | bool pollHandlerResult = false; | 217 | bool pollHandlerResult = false; |
@@ -214,6 +230,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
214 | return false; | 230 | return false; |
215 | } | 231 | } |
216 | 232 | ||
233 | public List<string> GetPollServiceHandlerKeys() | ||
234 | { | ||
235 | return new List<string>(m_pollHandlers.Keys); | ||
236 | } | ||
237 | |||
238 | |||
217 | // Note that the agent string is provided simply to differentiate | 239 | // Note that the agent string is provided simply to differentiate |
218 | // the handlers - it is NOT required to be an actual agent header | 240 | // the handlers - it is NOT required to be an actual agent header |
219 | // value. | 241 | // value. |
@@ -232,6 +254,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
232 | return false; | 254 | return false; |
233 | } | 255 | } |
234 | 256 | ||
257 | public List<string> GetAgentHandlerKeys() | ||
258 | { | ||
259 | return new List<string>(m_agentHandlers.Keys); | ||
260 | } | ||
261 | |||
235 | public bool AddLLSDHandler(string path, LLSDMethod handler) | 262 | public bool AddLLSDHandler(string path, LLSDMethod handler) |
236 | { | 263 | { |
237 | lock (m_llsdHandlers) | 264 | lock (m_llsdHandlers) |
@@ -245,6 +272,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
245 | return false; | 272 | return false; |
246 | } | 273 | } |
247 | 274 | ||
275 | public List<string> GetLLSDHandlerKeys() | ||
276 | { | ||
277 | return new List<string>(m_llsdHandlers.Keys); | ||
278 | } | ||
279 | |||
248 | public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler) | 280 | public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler) |
249 | { | 281 | { |
250 | m_defaultLlsdHandler = handler; | 282 | m_defaultLlsdHandler = handler; |
@@ -346,6 +378,22 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
346 | /// <param name="response"></param> | 378 | /// <param name="response"></param> |
347 | public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) | 379 | public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) |
348 | { | 380 | { |
381 | if (request.HttpMethod == String.Empty) // Can't handle empty requests, not wasting a thread | ||
382 | { | ||
383 | try | ||
384 | { | ||
385 | SendHTML500(response); | ||
386 | } | ||
387 | catch | ||
388 | { | ||
389 | } | ||
390 | |||
391 | return; | ||
392 | } | ||
393 | |||
394 | string requestMethod = request.HttpMethod; | ||
395 | string uriString = request.RawUrl; | ||
396 | |||
349 | string reqnum = "unknown"; | 397 | string reqnum = "unknown"; |
350 | int tickstart = Environment.TickCount; | 398 | int tickstart = Environment.TickCount; |
351 | 399 | ||
@@ -463,7 +511,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
463 | 511 | ||
464 | request.InputStream.Close(); | 512 | request.InputStream.Close(); |
465 | 513 | ||
466 | // HTTP IN support. The script engine taes it from here | 514 | // HTTP IN support. The script engine takes it from here |
467 | // Nothing to worry about for us. | 515 | // Nothing to worry about for us. |
468 | // | 516 | // |
469 | if (buffer == null) | 517 | if (buffer == null) |
@@ -577,19 +625,19 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
577 | { | 625 | { |
578 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e); | 626 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e); |
579 | } | 627 | } |
580 | catch (InvalidOperationException e) | 628 | catch (Exception e) |
581 | { | 629 | { |
582 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e); | 630 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw " + e.ToString()); |
583 | SendHTML500(response); | 631 | SendHTML500(response); |
584 | } | 632 | } |
585 | finally | 633 | finally |
586 | { | 634 | { |
587 | // Every month or so this will wrap and give bad numbers, not really a problem | 635 | // Every month or so this will wrap and give bad numbers, not really a problem |
588 | // since its just for reporting, 200ms limit can be adjusted | 636 | // since its just for reporting, tickdiff limit can be adjusted |
589 | int tickdiff = Environment.TickCount - tickstart; | 637 | int tickdiff = Environment.TickCount - tickstart; |
590 | if (tickdiff > 500) | 638 | if (tickdiff > 3000) |
591 | m_log.InfoFormat( | 639 | m_log.InfoFormat( |
592 | "[BASE HTTP SERVER]: slow request <{0}> for {1} took {2} ms", reqnum, request.RawUrl, tickdiff); | 640 | "[BASE HTTP SERVER]: slow {0} request for {1} from {2} took {3} ms", requestMethod, uriString, request.RemoteIPEndPoint.ToString(), tickdiff); |
593 | } | 641 | } |
594 | } | 642 | } |
595 | 643 | ||
@@ -753,7 +801,19 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
753 | if (methodWasFound) | 801 | if (methodWasFound) |
754 | { | 802 | { |
755 | xmlRprcRequest.Params.Add(request.Url); // Param[2] | 803 | xmlRprcRequest.Params.Add(request.Url); // Param[2] |
756 | xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3] | 804 | |
805 | string xff = "X-Forwarded-For"; | ||
806 | string xfflower = xff.ToLower(); | ||
807 | foreach (string s in request.Headers.AllKeys) | ||
808 | { | ||
809 | if (s != null && s.Equals(xfflower)) | ||
810 | { | ||
811 | xff = xfflower; | ||
812 | break; | ||
813 | } | ||
814 | } | ||
815 | xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3] | ||
816 | |||
757 | 817 | ||
758 | try | 818 | try |
759 | { | 819 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs index 129a544..2c2b47d 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
83 | /// <summary> | 83 | /// <summary> |
84 | /// Regular expression used to match against path of the | 84 | /// Regular expression used to match against path of the |
85 | /// incoming HTTP request. If you want to match any string | 85 | /// incoming HTTP request. If you want to match any string |
86 | /// either use '.*' or null. To match on the emtpy string use | 86 | /// either use '.*' or null. To match on the empty string use |
87 | /// '^$'. | 87 | /// '^$'. |
88 | /// </summary> | 88 | /// </summary> |
89 | public virtual Regex Path | 89 | public virtual Regex Path |
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs index e62407a..dc4eb8f 100644 --- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs +++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs | |||
@@ -34,7 +34,6 @@ using System.Text; | |||
34 | using HttpServer; | 34 | using HttpServer; |
35 | using HttpServer.FormDecoders; | 35 | using HttpServer.FormDecoders; |
36 | using NUnit.Framework; | 36 | using NUnit.Framework; |
37 | using NUnit.Framework.SyntaxHelpers; | ||
38 | using OpenSim.Framework.Servers.HttpServer; | 37 | using OpenSim.Framework.Servers.HttpServer; |
39 | 38 | ||
40 | namespace OpenSim.Framework.Servers.Tests | 39 | namespace OpenSim.Framework.Servers.Tests |