diff options
Diffstat (limited to 'OpenSim/Region/Application/OpenSimBase.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 74 |
1 files changed, 17 insertions, 57 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 11cacac..db76529 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -843,73 +843,49 @@ namespace OpenSim | |||
843 | /// <summary> | 843 | /// <summary> |
844 | /// Handler to supply the current status of this sim | 844 | /// Handler to supply the current status of this sim |
845 | /// </summary> | 845 | /// </summary> |
846 | /// <remarks> | ||
846 | /// Currently this is always OK if the simulator is still listening for connections on its HTTP service | 847 | /// Currently this is always OK if the simulator is still listening for connections on its HTTP service |
847 | public class SimStatusHandler : IStreamedRequestHandler | 848 | /// </remarks> |
849 | public class SimStatusHandler : BaseStreamHandler | ||
848 | { | 850 | { |
849 | public byte[] Handle(string path, Stream request, | 851 | public SimStatusHandler() : base("GET", "/simstatus", "SimStatus", "Simulator Status") {} |
852 | |||
853 | protected override byte[] ProcessRequest(string path, Stream request, | ||
850 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 854 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
851 | { | 855 | { |
852 | return Util.UTF8.GetBytes("OK"); | 856 | return Util.UTF8.GetBytes("OK"); |
853 | } | 857 | } |
854 | 858 | ||
855 | public string Name { get { return "SimStatus"; } } | 859 | public override string ContentType |
856 | public string Description { get { return "Simulator Status"; } } | ||
857 | |||
858 | public string ContentType | ||
859 | { | 860 | { |
860 | get { return "text/plain"; } | 861 | get { return "text/plain"; } |
861 | } | 862 | } |
862 | |||
863 | public string HttpMethod | ||
864 | { | ||
865 | get { return "GET"; } | ||
866 | } | ||
867 | |||
868 | public string Path | ||
869 | { | ||
870 | get { return "/simstatus"; } | ||
871 | } | ||
872 | } | 863 | } |
873 | 864 | ||
874 | /// <summary> | 865 | /// <summary> |
875 | /// Handler to supply the current extended status of this sim | 866 | /// Handler to supply the current extended status of this sim |
876 | /// Sends the statistical data in a json serialization | 867 | /// Sends the statistical data in a json serialization |
877 | /// </summary> | 868 | /// </summary> |
878 | public class XSimStatusHandler : IStreamedRequestHandler | 869 | public class XSimStatusHandler : BaseStreamHandler |
879 | { | 870 | { |
880 | OpenSimBase m_opensim; | 871 | OpenSimBase m_opensim; |
881 | string osXStatsURI = String.Empty; | ||
882 | |||
883 | public string Name { get { return "XSimStatus"; } } | ||
884 | public string Description { get { return "Simulator XStatus"; } } | ||
885 | 872 | ||
886 | public XSimStatusHandler(OpenSimBase sim) | 873 | public XSimStatusHandler(OpenSimBase sim) |
874 | : base("GET", "/" + Util.SHA1Hash(sim.osSecret), "XSimStatus", "Simulator XStatus") | ||
887 | { | 875 | { |
888 | m_opensim = sim; | 876 | m_opensim = sim; |
889 | osXStatsURI = Util.SHA1Hash(sim.osSecret); | ||
890 | } | 877 | } |
891 | 878 | ||
892 | public byte[] Handle(string path, Stream request, | 879 | protected override byte[] ProcessRequest(string path, Stream request, |
893 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 880 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
894 | { | 881 | { |
895 | return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); | 882 | return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); |
896 | } | 883 | } |
897 | 884 | ||
898 | public string ContentType | 885 | public override string ContentType |
899 | { | 886 | { |
900 | get { return "text/plain"; } | 887 | get { return "text/plain"; } |
901 | } | 888 | } |
902 | |||
903 | public string HttpMethod | ||
904 | { | ||
905 | get { return "GET"; } | ||
906 | } | ||
907 | |||
908 | public string Path | ||
909 | { | ||
910 | // This is for the OpenSimulator instance and is the osSecret hashed | ||
911 | get { return "/" + osXStatsURI; } | ||
912 | } | ||
913 | } | 889 | } |
914 | 890 | ||
915 | /// <summary> | 891 | /// <summary> |
@@ -918,42 +894,26 @@ namespace OpenSim | |||
918 | /// If the request contains a key, "callback" the response will be wrappend in the | 894 | /// If the request contains a key, "callback" the response will be wrappend in the |
919 | /// associated value for jsonp used with ajax/javascript | 895 | /// associated value for jsonp used with ajax/javascript |
920 | /// </summary> | 896 | /// </summary> |
921 | public class UXSimStatusHandler : IStreamedRequestHandler | 897 | protected class UXSimStatusHandler : BaseStreamHandler |
922 | { | 898 | { |
923 | OpenSimBase m_opensim; | 899 | OpenSimBase m_opensim; |
924 | string osUXStatsURI = String.Empty; | ||
925 | |||
926 | public string Name { get { return "UXSimStatus"; } } | ||
927 | public string Description { get { return "Simulator UXStatus"; } } | ||
928 | 900 | ||
929 | public UXSimStatusHandler(OpenSimBase sim) | 901 | public UXSimStatusHandler(OpenSimBase sim) |
902 | : base("GET", "/" + sim.userStatsURI, "UXSimStatus", "Simulator UXStatus") | ||
930 | { | 903 | { |
931 | m_opensim = sim; | 904 | m_opensim = sim; |
932 | osUXStatsURI = sim.userStatsURI; | ||
933 | |||
934 | } | 905 | } |
935 | 906 | ||
936 | public byte[] Handle(string path, Stream request, | 907 | protected override byte[] ProcessRequest(string path, Stream request, |
937 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 908 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
938 | { | 909 | { |
939 | return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); | 910 | return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); |
940 | } | 911 | } |
941 | 912 | ||
942 | public string ContentType | 913 | public override string ContentType |
943 | { | 914 | { |
944 | get { return "text/plain"; } | 915 | get { return "text/plain"; } |
945 | } | 916 | } |
946 | |||
947 | public string HttpMethod | ||
948 | { | ||
949 | get { return "GET"; } | ||
950 | } | ||
951 | |||
952 | public string Path | ||
953 | { | ||
954 | // This is for the OpenSimulator instance and is the user provided URI | ||
955 | get { return "/" + osUXStatsURI; } | ||
956 | } | ||
957 | } | 917 | } |
958 | 918 | ||
959 | #endregion | 919 | #endregion |