aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSimBase.cs
diff options
context:
space:
mode:
authorCharles Krinke2009-05-02 16:28:30 +0000
committerCharles Krinke2009-05-02 16:28:30 +0000
commit280d2cbf4ab7a075b3a3d16744ba4f2b2a19c984 (patch)
tree79a984b7874804d64007e9944d9c23180cf82f0e /OpenSim/Region/Application/OpenSimBase.cs
parentThank you kindly, MCortez for a patch that solves: (diff)
downloadopensim-SC_OLD-280d2cbf4ab7a075b3a3d16744ba4f2b2a19c984.zip
opensim-SC_OLD-280d2cbf4ab7a075b3a3d16744ba4f2b2a19c984.tar.gz
opensim-SC_OLD-280d2cbf4ab7a075b3a3d16744ba4f2b2a19c984.tar.bz2
opensim-SC_OLD-280d2cbf4ab7a075b3a3d16744ba4f2b2a19c984.tar.xz
Thank you kindly, BlueWall, for a patch that:
Move json stats to non-published resource name Remove well-known resource name for json stats, creating dynamic uris with private keys and add a user configurable resource name for region owner usage.
Diffstat (limited to 'OpenSim/Region/Application/OpenSimBase.cs')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs64
1 files changed, 58 insertions, 6 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 2203e45..af7b707 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -65,6 +65,8 @@ namespace OpenSim
65 65
66 protected string proxyUrl; 66 protected string proxyUrl;
67 protected int proxyOffset = 0; 67 protected int proxyOffset = 0;
68
69 public string userStatsURI = String.Empty;
68 70
69 protected bool m_autoCreateClientStack = true; 71 protected bool m_autoCreateClientStack = true;
70 72
@@ -189,6 +191,9 @@ namespace OpenSim
189 string pidFile = startupConfig.GetString("PIDFile", String.Empty); 191 string pidFile = startupConfig.GetString("PIDFile", String.Empty);
190 if (pidFile != String.Empty) 192 if (pidFile != String.Empty)
191 CreatePIDFile(pidFile); 193 CreatePIDFile(pidFile);
194
195 userStatsURI = startupConfig.GetString("Stats_URI", String.Empty);
196
192 } 197 }
193 198
194 base.StartupSpecific(); 199 base.StartupSpecific();
@@ -508,7 +513,9 @@ namespace OpenSim
508 // set initial ServerURI 513 // set initial ServerURI
509 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port; 514 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port;
510 regionInfo.HttpPort = m_httpServerPort; 515 regionInfo.HttpPort = m_httpServerPort;
511 516
517 regionInfo.osSecret = m_osSecret;
518
512 if ((proxyUrl.Length > 0) && (portadd_flag)) 519 if ((proxyUrl.Length > 0) && (portadd_flag))
513 { 520 {
514 // set proxy url to RegionInfo 521 // set proxy url to RegionInfo
@@ -543,7 +550,10 @@ namespace OpenSim
543 scene.LoadPrimsFromStorage(regionInfo.originRegionID); 550 scene.LoadPrimsFromStorage(regionInfo.originRegionID);
544 551
545 scene.StartTimer(); 552 scene.StartTimer();
546 553
554 // TODO : Try setting resource for region xstats here on scene
555 scene.CommsManager.HttpServer.AddStreamHandler( new Region.Framework.Scenes.RegionStatsHandler(regionInfo));
556
547 // moved these here as the terrain texture has to be created after the modules are initialized 557 // moved these here as the terrain texture has to be created after the modules are initialized
548 // and has to happen before the region is registered with the grid. 558 // and has to happen before the region is registered with the grid.
549 scene.CreateTerrainTexture(false); 559 scene.CreateTerrainTexture(false);
@@ -813,16 +823,18 @@ namespace OpenSim
813 } 823 }
814 824
815 /// <summary> 825 /// <summary>
816 /// Handler to supply the current extended status of this sim 826 /// Handler to supply the current extended status of this sim
827 /// Sends the statistical data in a json serialization
817 /// </summary> 828 /// </summary>
818 /// Sends the statistical data in a json serialization
819 public class XSimStatusHandler : IStreamedRequestHandler 829 public class XSimStatusHandler : IStreamedRequestHandler
820 { 830 {
821 OpenSimBase m_opensim; 831 OpenSimBase m_opensim;
832 string osXStatsURI = String.Empty;
822 833
823 public XSimStatusHandler(OpenSimBase sim) 834 public XSimStatusHandler(OpenSimBase sim)
824 { 835 {
825 m_opensim = sim; 836 m_opensim = sim;
837 osXStatsURI = Util.SHA1Hash(sim.osSecret);
826 } 838 }
827 839
828 public byte[] Handle(string path, Stream request, 840 public byte[] Handle(string path, Stream request,
@@ -842,11 +854,50 @@ namespace OpenSim
842 } 854 }
843 855
844 public string Path 856 public string Path
845 { 857 {
846 get { return "/simstatusx/"; } 858 // This is for the OpenSim instance and is the osSecret hashed
859 get { return "/" + osXStatsURI + "/"; }
847 } 860 }
848 } 861 }
849 862
863 /// <summary>
864 /// Handler to supply the current extended status of this sim
865 /// Sends the statistical data in a json serialization
866 /// </summary>
867 public class UXSimStatusHandler : IStreamedRequestHandler
868 {
869 OpenSimBase m_opensim;
870 string osUXStatsURI = String.Empty;
871
872 public UXSimStatusHandler(OpenSimBase sim)
873 {
874 m_opensim = sim;
875 osUXStatsURI = sim.userStatsURI;
876
877 }
878
879 public byte[] Handle(string path, Stream request,
880 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
881 {
882 return Encoding.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
883 }
884
885 public string ContentType
886 {
887 get { return "text/plain"; }
888 }
889
890 public string HttpMethod
891 {
892 get { return "GET"; }
893 }
894
895 public string Path
896 {
897 // This is for the OpenSim instance and is the osSecret hashed
898 get { return "/" + osUXStatsURI + "/"; }
899 }
900 }
850 901
851 #endregion 902 #endregion
852 903
@@ -906,6 +957,7 @@ namespace OpenSim
906 } 957 }
907 } 958 }
908 959
960
909 public class OpenSimConfigSource 961 public class OpenSimConfigSource
910 { 962 {
911 public IConfigSource Source; 963 public IConfigSource Source;