From e19defde36ddbd5ff90d8304c6fe3b57110f8078 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 8 Jul 2013 22:03:07 +0100
Subject: Add "show caps stats by user" and "show caps stats by cap" console
commands to print various counts of capability invocation by user and by cap
This currently prints caps requests received and handled, so that overload of received compared to handled or deadlock can be detected.
This involves making BaseStreamHandler and BaseOutputStream record the ints, which means inheritors should subclass ProcessRequest() instead of Handle()
However, existing inheriting classes overriding Handle() will still work, albeit without stats recording.
"show caps" becomes "show caps list" to disambiguate between show caps commands
---
.../Handlers/Authentication/OpenIdServerHandler.cs | 30 ++++++++--------------
1 file changed, 11 insertions(+), 19 deletions(-)
(limited to 'OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs')
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
index 18cef15..66a26fc 100644
--- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Server.Handlers.Authentication
#endregion
}
- public class OpenIdStreamHandler : IStreamHandler
+ public class OpenIdStreamHandler : BaseOutputStreamHandler
{
#region HTML
@@ -191,42 +191,34 @@ For more information, see http://openid.net/.
#endregion HTML
- public string Name { get { return "OpenId"; } }
- public string Description { get { return null; } }
- public string ContentType { get { return m_contentType; } }
- public string HttpMethod { get { return m_httpMethod; } }
- public string Path { get { return m_path; } }
-
- string m_contentType;
- string m_httpMethod;
- string m_path;
IAuthenticationService m_authenticationService;
IUserAccountService m_userAccountService;
ProviderMemoryStore m_openidStore = new ProviderMemoryStore();
+ public override string ContentType { get { return "text/html"; } }
+
///
/// Constructor
///
- public OpenIdStreamHandler(string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService)
+ public OpenIdStreamHandler(
+ string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService)
+ : base(httpMethod, path, "OpenId", "OpenID stream handler")
{
m_authenticationService = authService;
m_userAccountService = userService;
- m_httpMethod = httpMethod;
- m_path = path;
-
- m_contentType = "text/html";
}
///
/// Handles all GET and POST requests for OpenID identifier pages and endpoint
/// server communication
///
- public void Handle(string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
+ protected override void ProcessRequest(
+ string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath));
// Defult to returning HTML content
- m_contentType = "text/html";
+ httpResponse.ContentType = ContentType;
try
{
@@ -276,7 +268,7 @@ For more information, see http://openid.net/.
string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type");
if (contentTypeValues != null && contentTypeValues.Length == 1)
- m_contentType = contentTypeValues[0];
+ httpResponse.ContentType = contentTypeValues[0];
// Set the response code and document body based on the OpenID result
httpResponse.StatusCode = (int)provider.Request.Response.Code;
@@ -344,4 +336,4 @@ For more information, see http://openid.net/.
return false;
}
}
-}
+}
\ No newline at end of file
--
cgit v1.1