diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 4c35132..ccec9b7 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -378,6 +378,22 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
378 | /// <param name="response"></param> | 378 | /// <param name="response"></param> |
379 | public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) | 379 | public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) |
380 | { | 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 | |||
381 | string reqnum = "unknown"; | 397 | string reqnum = "unknown"; |
382 | int tickstart = Environment.TickCount; | 398 | int tickstart = Environment.TickCount; |
383 | 399 | ||
@@ -495,7 +511,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
495 | 511 | ||
496 | request.InputStream.Close(); | 512 | request.InputStream.Close(); |
497 | 513 | ||
498 | // HTTP IN support. The script engine taes it from here | 514 | // HTTP IN support. The script engine takes it from here |
499 | // Nothing to worry about for us. | 515 | // Nothing to worry about for us. |
500 | // | 516 | // |
501 | if (buffer == null) | 517 | if (buffer == null) |
@@ -609,19 +625,19 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
609 | { | 625 | { |
610 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e); | 626 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e); |
611 | } | 627 | } |
612 | catch (InvalidOperationException e) | 628 | catch (Exception e) |
613 | { | 629 | { |
614 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e); | 630 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw " + e.ToString()); |
615 | SendHTML500(response); | 631 | SendHTML500(response); |
616 | } | 632 | } |
617 | finally | 633 | finally |
618 | { | 634 | { |
619 | // 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 |
620 | // since its just for reporting, 200ms limit can be adjusted | 636 | // since its just for reporting, tickdiff limit can be adjusted |
621 | int tickdiff = Environment.TickCount - tickstart; | 637 | int tickdiff = Environment.TickCount - tickstart; |
622 | if (tickdiff > 500) | 638 | if (tickdiff > 3000) |
623 | m_log.InfoFormat( | 639 | m_log.InfoFormat( |
624 | "[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); |
625 | } | 641 | } |
626 | } | 642 | } |
627 | 643 | ||
@@ -785,7 +801,19 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
785 | if (methodWasFound) | 801 | if (methodWasFound) |
786 | { | 802 | { |
787 | xmlRprcRequest.Params.Add(request.Url); // Param[2] | 803 | xmlRprcRequest.Params.Add(request.Url); // Param[2] |
788 | 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 | |||
789 | 817 | ||
790 | try | 818 | try |
791 | { | 819 | { |