aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs58
1 files changed, 33 insertions, 25 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index ad5af1f..f5addc8 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -156,7 +156,7 @@ namespace OpenSim.Framework.Servers.HttpServer
156 } 156 }
157 } 157 }
158 158
159 public List<string> GetStreamHandlerKeys() 159 public List<string> GetStreamHandlerKeys()
160 { 160 {
161 lock (m_streamHandlers) 161 lock (m_streamHandlers)
162 return new List<string>(m_streamHandlers.Keys); 162 return new List<string>(m_streamHandlers.Keys);
@@ -356,7 +356,7 @@ namespace OpenSim.Framework.Servers.HttpServer
356 } 356 }
357 catch (Exception e) 357 catch (Exception e)
358 { 358 {
359 m_log.ErrorFormat("[BASE HTTP SERVER]: OnRequest() failed with {0}{1}", e.Message, e.StackTrace); 359 m_log.Error(String.Format("[BASE HTTP SERVER]: OnRequest() failed: {0} ", e.Message), e);
360 } 360 }
361 } 361 }
362 362
@@ -410,6 +410,8 @@ namespace OpenSim.Framework.Servers.HttpServer
410// string reqnum = "unknown"; 410// string reqnum = "unknown";
411 int tickstart = Environment.TickCount; 411 int tickstart = Environment.TickCount;
412 412
413 IRequestHandler requestHandler = null;
414
413 try 415 try
414 { 416 {
415 // OpenSim.Framework.WebUtil.OSHeaderRequestID 417 // OpenSim.Framework.WebUtil.OSHeaderRequestID
@@ -438,8 +440,6 @@ namespace OpenSim.Framework.Servers.HttpServer
438 //response.KeepAlive = true; 440 //response.KeepAlive = true;
439 response.SendChunked = false; 441 response.SendChunked = false;
440 442
441 IRequestHandler requestHandler;
442
443 string path = request.RawUrl; 443 string path = request.RawUrl;
444 string handlerKey = GetHandlerKey(request.HttpMethod, path); 444 string handlerKey = GetHandlerKey(request.HttpMethod, path);
445 445
@@ -447,8 +447,8 @@ namespace OpenSim.Framework.Servers.HttpServer
447 { 447 {
448 if (DebugLevel >= 1) 448 if (DebugLevel >= 1)
449 m_log.DebugFormat( 449 m_log.DebugFormat(
450 "[BASE HTTP SERVER]: Found stream handler for {0} {1}", 450 "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}",
451 request.HttpMethod, request.Url.PathAndQuery); 451 request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description);
452 452
453 // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. 453 // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler.
454 byte[] buffer = null; 454 byte[] buffer = null;
@@ -551,11 +551,11 @@ namespace OpenSim.Framework.Servers.HttpServer
551 catch (SocketException e) 551 catch (SocketException e)
552 { 552 {
553 // This has to be here to prevent a Linux/Mono crash 553 // This has to be here to prevent a Linux/Mono crash
554 m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); 554 m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e);
555 } 555 }
556 catch (IOException e) 556 catch (IOException e)
557 { 557 {
558 m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); 558 m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}. ", e.Message), e);
559 } 559 }
560 560
561 return; 561 return;
@@ -658,15 +658,15 @@ namespace OpenSim.Framework.Servers.HttpServer
658 // 658 //
659 // An alternative may be to turn off all response write exceptions on the HttpListener, but let's go 659 // An alternative may be to turn off all response write exceptions on the HttpListener, but let's go
660 // with the minimum first 660 // with the minimum first
661 m_log.WarnFormat("[BASE HTTP SERVER]: HandleRequest threw {0}.\nNOTE: this may be spurious on Linux", e); 661 m_log.Warn(String.Format("[BASE HTTP SERVER]: HandleRequest threw {0}.\nNOTE: this may be spurious on Linux ", e.Message), e);
662 } 662 }
663 catch (IOException e) 663 catch (IOException e)
664 { 664 {
665 m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e); 665 m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e);
666 } 666 }
667 catch (Exception e) 667 catch (Exception e)
668 { 668 {
669 m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e.StackTrace); 669 m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e);
670 SendHTML500(response); 670 SendHTML500(response);
671 } 671 }
672 finally 672 finally
@@ -675,8 +675,16 @@ namespace OpenSim.Framework.Servers.HttpServer
675 // since its just for reporting, tickdiff limit can be adjusted 675 // since its just for reporting, tickdiff limit can be adjusted
676 int tickdiff = Environment.TickCount - tickstart; 676 int tickdiff = Environment.TickCount - tickstart;
677 if (tickdiff > 3000) 677 if (tickdiff > 3000)
678 {
678 m_log.InfoFormat( 679 m_log.InfoFormat(
679 "[BASE HTTP SERVER]: slow {0} request for {1} from {2} took {3} ms", requestMethod, uriString, request.RemoteIPEndPoint.ToString(), tickdiff); 680 "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms",
681 requestMethod,
682 uriString,
683 requestHandler != null ? requestHandler.Name : "",
684 requestHandler != null ? requestHandler.Description : "",
685 request.RemoteIPEndPoint.ToString(),
686 tickdiff);
687 }
680 } 688 }
681 } 689 }
682 690
@@ -925,11 +933,11 @@ namespace OpenSim.Framework.Servers.HttpServer
925 catch (SocketException e) 933 catch (SocketException e)
926 { 934 {
927 // This has to be here to prevent a Linux/Mono crash 935 // This has to be here to prevent a Linux/Mono crash
928 m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); 936 m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e);
929 } 937 }
930 catch (IOException e) 938 catch (IOException e)
931 { 939 {
932 m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); 940 m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0} ", e.Message), e);
933 } 941 }
934 } 942 }
935 return; 943 return;
@@ -962,11 +970,11 @@ namespace OpenSim.Framework.Servers.HttpServer
962 catch (SocketException e) 970 catch (SocketException e)
963 { 971 {
964 // This has to be here to prevent a Linux/Mono crash 972 // This has to be here to prevent a Linux/Mono crash
965 m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); 973 m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e);
966 } 974 }
967 catch (IOException e) 975 catch (IOException e)
968 { 976 {
969 m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); 977 m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0} ", e.Message), e);
970 } 978 }
971 } 979 }
972 } 980 }
@@ -1077,12 +1085,12 @@ namespace OpenSim.Framework.Servers.HttpServer
1077 } 1085 }
1078 catch (IOException e) 1086 catch (IOException e)
1079 { 1087 {
1080 m_log.WarnFormat("[BASE HTTP SERVER]: LLSD IOException {0}.", e); 1088 m_log.Warn(String.Format("[BASE HTTP SERVER]: LLSD IOException {0} ", e.Message), e);
1081 } 1089 }
1082 catch (SocketException e) 1090 catch (SocketException e)
1083 { 1091 {
1084 // This has to be here to prevent a Linux/Mono crash 1092 // This has to be here to prevent a Linux/Mono crash
1085 m_log.WarnFormat("[BASE HTTP SERVER]: LLSD issue {0}.\nNOTE: this may be spurious on Linux.", e); 1093 m_log.Warn(String.Format("[BASE HTTP SERVER]: LLSD issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e);
1086 } 1094 }
1087 } 1095 }
1088 } 1096 }
@@ -1334,8 +1342,8 @@ namespace OpenSim.Framework.Servers.HttpServer
1334 catch (SocketException f) 1342 catch (SocketException f)
1335 { 1343 {
1336 // This has to be here to prevent a Linux/Mono crash 1344 // This has to be here to prevent a Linux/Mono crash
1337 m_log.WarnFormat( 1345 m_log.Warn(
1338 "[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", f); 1346 String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", f.Message), f);
1339 } 1347 }
1340 } 1348 }
1341 catch(Exception) 1349 catch(Exception)
@@ -1653,11 +1661,11 @@ namespace OpenSim.Framework.Servers.HttpServer
1653 catch (SocketException e) 1661 catch (SocketException e)
1654 { 1662 {
1655 // This has to be here to prevent a Linux/Mono crash 1663 // This has to be here to prevent a Linux/Mono crash
1656 m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); 1664 m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e);
1657 } 1665 }
1658 catch (IOException e) 1666 catch (IOException e)
1659 { 1667 {
1660 m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); 1668 m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0} ", e.Message), e);
1661 } 1669 }
1662 } 1670 }
1663 } 1671 }
@@ -1694,7 +1702,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1694 catch (SocketException e) 1702 catch (SocketException e)
1695 { 1703 {
1696 // This has to be here to prevent a Linux/Mono crash 1704 // This has to be here to prevent a Linux/Mono crash
1697 m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); 1705 m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e);
1698 } 1706 }
1699 } 1707 }
1700 } 1708 }
@@ -1730,7 +1738,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1730 catch (SocketException e) 1738 catch (SocketException e)
1731 { 1739 {
1732 // This has to be here to prevent a Linux/Mono crash 1740 // This has to be here to prevent a Linux/Mono crash
1733 m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); 1741 m_log.Warn(String.Format("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e);
1734 } 1742 }
1735 } 1743 }
1736 } 1744 }
@@ -1809,7 +1817,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1809 1817
1810 public void httpServerException(object source, Exception exception) 1818 public void httpServerException(object source, Exception exception)
1811 { 1819 {
1812 m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); 1820 m_log.Error(String.Format("[BASE HTTP SERVER]: {0} had an exception: {1} ", source.ToString(), exception.Message), exception);
1813 /* 1821 /*
1814 if (HTTPDRunning)// && NotSocketErrors > 5) 1822 if (HTTPDRunning)// && NotSocketErrors > 5)
1815 { 1823 {