aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-07-08 22:03:07 +0100
committerJustin Clark-Casey (justincc)2013-07-08 22:03:07 +0100
commite19defde36ddbd5ff90d8304c6fe3b57110f8078 (patch)
tree63b349551f341f00a8a9c598a76343d7b453c328
parentMake dictionary read/write locking consistent in CapabilitiesModule, rename t... (diff)
downloadopensim-SC_OLD-e19defde36ddbd5ff90d8304c6fe3b57110f8078.zip
opensim-SC_OLD-e19defde36ddbd5ff90d8304c6fe3b57110f8078.tar.gz
opensim-SC_OLD-e19defde36ddbd5ff90d8304c6fe3b57110f8078.tar.bz2
opensim-SC_OLD-e19defde36ddbd5ff90d8304c6fe3b57110f8078.tar.xz
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
Diffstat (limited to '')
-rw-r--r--OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs2
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs2
-rw-r--r--OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs2
-rw-r--r--OpenSim/Capabilities/CapsHandlers.cs16
-rw-r--r--OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs2
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs2
-rw-r--r--OpenSim/Capabilities/LLSDStreamHandler.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs4
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs27
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs15
-rw-r--r--OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs4
-rw-r--r--OpenSim/Framework/Servers/HttpServer/RestSessionService.cs13
-rw-r--r--OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs2
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs8
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs234
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs2
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs30
-rw-r--r--OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs1
-rw-r--r--OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Map/MapAddServerConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Map/MapGetServerConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs8
-rw-r--r--OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs4
-rw-r--r--OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs2
43 files changed, 346 insertions, 80 deletions
diff --git a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
index 3584f78..67750f5 100644
--- a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Groups
113 m_GroupsService = service; 113 m_GroupsService = service;
114 } 114 }
115 115
116 public override byte[] Handle(string path, Stream requestData, 116 protected override byte[] ProcessRequest(string path, Stream requestData,
117 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 117 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
118 { 118 {
119 StreamReader sr = new StreamReader(requestData); 119 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
index 28f7acc..515b818 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Groups
75 m_GroupsService = service; 75 m_GroupsService = service;
76 } 76 }
77 77
78 public override byte[] Handle(string path, Stream requestData, 78 protected override byte[] ProcessRequest(string path, Stream requestData,
79 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 79 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
80 { 80 {
81 StreamReader sr = new StreamReader(requestData); 81 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs
index 2b3a01d..32c24db 100644
--- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs
+++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs
@@ -75,7 +75,7 @@ namespace OpenSim.OfflineIM
75 m_OfflineIMService = service; 75 m_OfflineIMService = service;
76 } 76 }
77 77
78 public override byte[] Handle(string path, Stream requestData, 78 protected override byte[] ProcessRequest(string path, Stream requestData,
79 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 79 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
80 { 80 {
81 StreamReader sr = new StreamReader(requestData); 81 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Capabilities/CapsHandlers.cs b/OpenSim/Capabilities/CapsHandlers.cs
index 458272d..890df90 100644
--- a/OpenSim/Capabilities/CapsHandlers.cs
+++ b/OpenSim/Capabilities/CapsHandlers.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Framework.Capabilities
39 /// </summary> 39 /// </summary>
40 public class CapsHandlers 40 public class CapsHandlers
41 { 41 {
42 private Dictionary <string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>(); 42 private Dictionary<string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>();
43 private IHttpServer m_httpListener; 43 private IHttpServer m_httpListener;
44 private string m_httpListenerHostName; 44 private string m_httpListenerHostName;
45 private uint m_httpListenerPort; 45 private uint m_httpListenerPort;
@@ -184,5 +184,17 @@ namespace OpenSim.Framework.Capabilities
184 184
185 return caps; 185 return caps;
186 } 186 }
187
188 /// <summary>
189 /// Returns a copy of the dictionary of all the HTTP cap handlers
190 /// </summary>
191 /// <returns>
192 /// The dictionary copy. The key is the capability name, the value is the HTTP handler.
193 /// </returns>
194 public Dictionary<string, IRequestHandler> GetCapsHandlers()
195 {
196 lock (m_capsHandlers)
197 return new Dictionary<string, IRequestHandler>(m_capsHandlers);
198 }
187 } 199 }
188} 200} \ No newline at end of file
diff --git a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
index 4dca592..426174d 100644
--- a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
+++ b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Capabilities.Handlers
56 m_PeopleService = peopleService; 56 m_PeopleService = peopleService;
57 } 57 }
58 58
59 public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 59 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
60 { 60 {
61 // Try to parse the texture ID from the request URL 61 // Try to parse the texture ID from the request URL
62 NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); 62 NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index 9f3cc19..789bf2b 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Capabilities.Handlers
64 m_assetService = assService; 64 m_assetService = assService;
65 } 65 }
66 66
67 public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 67 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
68 { 68 {
69 // Try to parse the texture ID from the request URL 69 // Try to parse the texture ID from the request URL
70 NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); 70 NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
diff --git a/OpenSim/Capabilities/LLSDStreamHandler.cs b/OpenSim/Capabilities/LLSDStreamHandler.cs
index 5df24b2..4fa1153 100644
--- a/OpenSim/Capabilities/LLSDStreamHandler.cs
+++ b/OpenSim/Capabilities/LLSDStreamHandler.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Capabilities
48 m_method = method; 48 m_method = method;
49 } 49 }
50 50
51 public override byte[] Handle(string path, Stream request, 51 protected override byte[] ProcessRequest(string path, Stream request,
52 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 52 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
53 { 53 {
54 //Encoding encoding = Util.UTF8; 54 //Encoding encoding = Util.UTF8;
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs
index ae7aaf2..bbac699 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs
@@ -31,6 +31,10 @@ namespace OpenSim.Framework.Servers.HttpServer
31{ 31{
32 public abstract class BaseRequestHandler 32 public abstract class BaseRequestHandler
33 { 33 {
34 public int RequestsReceived { get; protected set; }
35
36 public int RequestsHandled { get; protected set; }
37
34 public virtual string ContentType 38 public virtual string ContentType
35 { 39 {
36 get { return "application/xml"; } 40 get { return "application/xml"; }
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs
index 6342983..252cc2a 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs
@@ -29,14 +29,35 @@ using System.IO;
29 29
30namespace OpenSim.Framework.Servers.HttpServer 30namespace OpenSim.Framework.Servers.HttpServer
31{ 31{
32 /// <summary>
33 /// Base streamed request handler.
34 /// </summary>
35 /// <remarks>
36 /// Inheriting classes should override ProcessRequest() rather than Handle()
37 /// </remarks>
32 public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler 38 public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler
33 { 39 {
34 public abstract byte[] Handle(string path, Stream request,
35 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
36
37 protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {} 40 protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {}
38 41
39 protected BaseStreamHandler(string httpMethod, string path, string name, string description) 42 protected BaseStreamHandler(string httpMethod, string path, string name, string description)
40 : base(httpMethod, path, name, description) {} 43 : base(httpMethod, path, name, description) {}
44
45 public virtual byte[] Handle(
46 string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
47 {
48 RequestsReceived++;
49
50 byte[] result = ProcessRequest(path, request, httpRequest, httpResponse);
51
52 RequestsHandled++;
53
54 return result;
55 }
56
57 protected virtual byte[] ProcessRequest(
58 string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
59 {
60 return null;
61 }
41 } 62 }
42} \ No newline at end of file 63} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs
index b94bfb4..1b03f54 100644
--- a/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Framework.Servers.HttpServer
45 m_method = binaryMethod; 45 m_method = binaryMethod;
46 } 46 }
47 47
48 public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 48 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
49 { 49 {
50 byte[] data = ReadFully(request); 50 byte[] data = ReadFully(request);
51 string param = GetParam(path); 51 string param = GetParam(path);
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs
index cb5cce5..b8541cb 100644
--- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs
+++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs
@@ -32,7 +32,6 @@ namespace OpenSim.Framework.Servers.HttpServer
32{ 32{
33 public interface IRequestHandler 33 public interface IRequestHandler
34 { 34 {
35
36 /// <summary> 35 /// <summary>
37 /// Name for this handler. 36 /// Name for this handler.
38 /// </summary> 37 /// </summary>
@@ -59,6 +58,19 @@ namespace OpenSim.Framework.Servers.HttpServer
59 58
60 // Return path 59 // Return path
61 string Path { get; } 60 string Path { get; }
61
62 /// <summary>
63 /// Number of requests received by this handler
64 /// </summary>
65 int RequestsReceived { get; }
66
67 /// <summary>
68 /// Number of requests handled.
69 /// </summary>
70 /// <remarks>
71 /// Should be equal to RequestsReceived unless requested are being handled slowly or there is deadlock.
72 /// </remarks>
73 int RequestsHandled { get; }
62 } 74 }
63 75
64 public interface IStreamedRequestHandler : IRequestHandler 76 public interface IStreamedRequestHandler : IRequestHandler
@@ -69,7 +81,6 @@ namespace OpenSim.Framework.Servers.HttpServer
69 81
70 public interface IStreamHandler : IRequestHandler 82 public interface IStreamHandler : IRequestHandler
71 { 83 {
72 // Handle request stream, return byte array
73 void Handle(string path, Stream request, Stream response, IOSHttpRequest httpReqbuest, IOSHttpResponse httpResponse); 84 void Handle(string path, Stream request, Stream response, IOSHttpRequest httpReqbuest, IOSHttpResponse httpResponse);
74 } 85 }
75 86
diff --git a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs
index 07082a8..bd55657 100644
--- a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs
+++ b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Framework.Servers.HttpServer
33{ 33{
34 public delegate TResponse RestDeserialiseMethod<TRequest, TResponse>(TRequest request); 34 public delegate TResponse RestDeserialiseMethod<TRequest, TResponse>(TRequest request);
35 35
36 public class RestDeserialiseHandler<TRequest, TResponse> : BaseRequestHandler, IStreamHandler 36 public class RestDeserialiseHandler<TRequest, TResponse> : BaseOutputStreamHandler, IStreamHandler
37 where TRequest : new() 37 where TRequest : new()
38 { 38 {
39 private RestDeserialiseMethod<TRequest, TResponse> m_method; 39 private RestDeserialiseMethod<TRequest, TResponse> m_method;
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Servers.HttpServer
48 m_method = method; 48 m_method = method;
49 } 49 }
50 50
51 public void Handle(string path, Stream request, Stream responseStream, 51 protected override void ProcessRequest(string path, Stream request, Stream responseStream,
52 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 52 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
53 { 53 {
54 TRequest deserial; 54 TRequest deserial;
diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
index edcd134..83c9848 100644
--- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
+++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
@@ -183,7 +183,7 @@ namespace OpenSim.Framework.Servers.HttpServer
183 183
184 public delegate bool CheckIdentityMethod(string sid, string aid); 184 public delegate bool CheckIdentityMethod(string sid, string aid);
185 185
186 public class RestDeserialiseSecureHandler<TRequest, TResponse> : BaseRequestHandler, IStreamHandler 186 public class RestDeserialiseSecureHandler<TRequest, TResponse> : BaseOutputStreamHandler, IStreamHandler
187 where TRequest : new() 187 where TRequest : new()
188 { 188 {
189 private static readonly ILog m_log 189 private static readonly ILog m_log
@@ -201,7 +201,7 @@ namespace OpenSim.Framework.Servers.HttpServer
201 m_method = method; 201 m_method = method;
202 } 202 }
203 203
204 public void Handle(string path, Stream request, Stream responseStream, 204 protected override void ProcessRequest(string path, Stream request, Stream responseStream,
205 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 205 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
206 { 206 {
207 RestSessionObject<TRequest> deserial = default(RestSessionObject<TRequest>); 207 RestSessionObject<TRequest> deserial = default(RestSessionObject<TRequest>);
@@ -237,7 +237,7 @@ namespace OpenSim.Framework.Servers.HttpServer
237 237
238 public delegate bool CheckTrustedSourceMethod(IPEndPoint peer); 238 public delegate bool CheckTrustedSourceMethod(IPEndPoint peer);
239 239
240 public class RestDeserialiseTrustedHandler<TRequest, TResponse> : BaseRequestHandler, IStreamHandler 240 public class RestDeserialiseTrustedHandler<TRequest, TResponse> : BaseOutputStreamHandler, IStreamHandler
241 where TRequest : new() 241 where TRequest : new()
242 { 242 {
243 private static readonly ILog m_log 243 private static readonly ILog m_log
@@ -260,7 +260,7 @@ namespace OpenSim.Framework.Servers.HttpServer
260 m_method = method; 260 m_method = method;
261 } 261 }
262 262
263 public void Handle(string path, Stream request, Stream responseStream, 263 protected override void ProcessRequest(string path, Stream request, Stream responseStream,
264 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 264 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
265 { 265 {
266 TRequest deserial = default(TRequest); 266 TRequest deserial = default(TRequest);
@@ -292,6 +292,5 @@ namespace OpenSim.Framework.Servers.HttpServer
292 serializer.Serialize(xmlWriter, response); 292 serializer.Serialize(xmlWriter, response);
293 } 293 }
294 } 294 }
295 } 295 }
296 296} \ No newline at end of file
297}
diff --git a/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs
index 1f17fee..0305dee 100644
--- a/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs
+++ b/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Servers.HttpServer
48 m_restMethod = restMethod; 48 m_restMethod = restMethod;
49 } 49 }
50 50
51 public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 51 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
52 { 52 {
53 Encoding encoding = Encoding.UTF8; 53 Encoding encoding = Encoding.UTF8;
54 StreamReader streamReader = new StreamReader(request, encoding); 54 StreamReader streamReader = new StreamReader(request, encoding);
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 841069c..f0c088a 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -766,7 +766,7 @@ namespace OpenSim
766 { 766 {
767 public SimStatusHandler() : base("GET", "/simstatus", "SimStatus", "Simulator Status") {} 767 public SimStatusHandler() : base("GET", "/simstatus", "SimStatus", "Simulator Status") {}
768 768
769 public override byte[] Handle(string path, Stream request, 769 protected override byte[] ProcessRequest(string path, Stream request,
770 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 770 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
771 { 771 {
772 return Util.UTF8.GetBytes("OK"); 772 return Util.UTF8.GetBytes("OK");
@@ -792,7 +792,7 @@ namespace OpenSim
792 m_opensim = sim; 792 m_opensim = sim;
793 } 793 }
794 794
795 public override byte[] Handle(string path, Stream request, 795 protected override byte[] ProcessRequest(string path, Stream request,
796 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 796 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
797 { 797 {
798 return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); 798 return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
@@ -810,7 +810,7 @@ namespace OpenSim
810 /// If the request contains a key, "callback" the response will be wrappend in the 810 /// If the request contains a key, "callback" the response will be wrappend in the
811 /// associated value for jsonp used with ajax/javascript 811 /// associated value for jsonp used with ajax/javascript
812 /// </summary> 812 /// </summary>
813 public class UXSimStatusHandler : BaseStreamHandler 813 protected class UXSimStatusHandler : BaseStreamHandler
814 { 814 {
815 OpenSimBase m_opensim; 815 OpenSimBase m_opensim;
816 816
@@ -820,7 +820,7 @@ namespace OpenSim
820 m_opensim = sim; 820 m_opensim = sim;
821 } 821 }
822 822
823 public override byte[] Handle(string path, Stream request, 823 protected override byte[] ProcessRequest(string path, Stream request,
824 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 824 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
825 { 825 {
826 return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); 826 return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs
index 69dd76f..a133a69 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs
@@ -176,7 +176,7 @@ namespace OpenSim.Region.ClientStack.Linden
176 m_isGod = m_scene.Permissions.IsGod(agentID); 176 m_isGod = m_scene.Permissions.IsGod(agentID);
177 } 177 }
178 178
179 public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 179 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
180 { 180 {
181 StreamReader reader = new StreamReader(request); 181 StreamReader reader = new StreamReader(request);
182 string message = reader.ReadToEnd(); 182 string message = reader.ReadToEnd();
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
index 08196f1..2116605 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
54 m_FriendsModule = fmodule; 54 m_FriendsModule = fmodule;
55 } 55 }
56 56
57 public override byte[] Handle( 57 protected override byte[] ProcessRequest(
58 string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 58 string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
59 { 59 {
60 StreamReader sr = new StreamReader(requestData); 60 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
index c8b341b..bd60611 100644
--- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Linq;
31using System.Reflection; 32using System.Reflection;
32using System.Text; 33using System.Text;
33using log4net; 34using log4net;
@@ -37,6 +38,7 @@ using OpenMetaverse;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
39using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
42using Caps=OpenSim.Framework.Capabilities.Caps; 44using Caps=OpenSim.Framework.Capabilities.Caps;
@@ -58,6 +60,7 @@ namespace OpenSim.Region.CoreModules.Framework
58 protected Dictionary<UUID, Caps> m_capsObjects = new Dictionary<UUID, Caps>(); 60 protected Dictionary<UUID, Caps> m_capsObjects = new Dictionary<UUID, Caps>();
59 61
60 protected Dictionary<UUID, string> m_capsPaths = new Dictionary<UUID, string>(); 62 protected Dictionary<UUID, string> m_capsPaths = new Dictionary<UUID, string>();
63
61 protected Dictionary<UUID, Dictionary<ulong, string>> m_childrenSeeds 64 protected Dictionary<UUID, Dictionary<ulong, string>> m_childrenSeeds
62 = new Dictionary<UUID, Dictionary<ulong, string>>(); 65 = new Dictionary<UUID, Dictionary<ulong, string>>();
63 66
@@ -70,9 +73,24 @@ namespace OpenSim.Region.CoreModules.Framework
70 m_scene = scene; 73 m_scene = scene;
71 m_scene.RegisterModuleInterface<ICapabilitiesModule>(this); 74 m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
72 75
73 MainConsole.Instance.Commands.AddCommand("Comms", false, "show caps", 76 MainConsole.Instance.Commands.AddCommand(
74 "show caps", 77 "Comms", false, "show caps list",
75 "Shows all registered capabilities for users", HandleShowCapsCommand); 78 "show caps list",
79 "Shows list of registered capabilities for users.", HandleShowCapsListCommand);
80
81 MainConsole.Instance.Commands.AddCommand(
82 "Comms", false, "show caps stats by user",
83 "show caps stats [<first-name> <last-name>]",
84 "Shows statistics on capabilities use by user.",
85 "If a user name is given, then prints a detailed breakdown of caps use ordered by number of requests received.",
86 HandleShowCapsStatsByUserCommand);
87
88 MainConsole.Instance.Commands.AddCommand(
89 "Comms", false, "show caps stats by cap",
90 "show caps stats by cap [<cap-name>]",
91 "Shows statistics on capabilities use by capability.",
92 "If a capability name is given, then prints a detailed breakdown of use by each user.",
93 HandleShowCapsStatsByCapCommand);
76 } 94 }
77 95
78 public void RegionLoaded(Scene scene) 96 public void RegionLoaded(Scene scene)
@@ -262,8 +280,11 @@ namespace OpenSim.Region.CoreModules.Framework
262 } 280 }
263 } 281 }
264 282
265 private void HandleShowCapsCommand(string module, string[] cmdparams) 283 private void HandleShowCapsListCommand(string module, string[] cmdParams)
266 { 284 {
285 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
286 return;
287
267 StringBuilder caps = new StringBuilder(); 288 StringBuilder caps = new StringBuilder();
268 caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); 289 caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
269 290
@@ -286,5 +307,210 @@ namespace OpenSim.Region.CoreModules.Framework
286 307
287 MainConsole.Instance.Output(caps.ToString()); 308 MainConsole.Instance.Output(caps.ToString());
288 } 309 }
310
311 private void HandleShowCapsStatsByCapCommand(string module, string[] cmdParams)
312 {
313 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
314 return;
315
316 if (cmdParams.Length != 5 && cmdParams.Length != 6)
317 {
318 MainConsole.Instance.Output("Usage: show caps stats by cap [<cap-name>]");
319 return;
320 }
321
322 StringBuilder sb = new StringBuilder();
323 sb.AppendFormat("Region {0}:\n", m_scene.Name);
324
325 if (cmdParams.Length == 5)
326 {
327 BuildSummaryStatsByCapReport(sb);
328 }
329 else if (cmdParams.Length == 6)
330 {
331 BuildDetailedStatsByCapReport(sb, cmdParams[5]);
332 }
333
334 MainConsole.Instance.Output(sb.ToString());
335 }
336
337 private void BuildDetailedStatsByCapReport(StringBuilder sb, string capName)
338 {
339 sb.AppendFormat("Capability name {0}\n", capName);
340
341 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
342 cdt.AddColumn("User Name", 34);
343 cdt.AddColumn("Req Received", 12);
344 cdt.AddColumn("Req Handled", 12);
345 cdt.Indent = 2;
346
347 Dictionary<string, int> receivedStats = new Dictionary<string, int>();
348 Dictionary<string, int> handledStats = new Dictionary<string, int>();
349
350 m_scene.ForEachScenePresence(
351 sp =>
352 {
353 Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
354
355 if (caps == null)
356 return;
357
358 Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
359
360 IRequestHandler reqHandler;
361 if (capsHandlers.TryGetValue(capName, out reqHandler))
362 {
363 receivedStats[sp.Name] = reqHandler.RequestsReceived;
364 handledStats[sp.Name] = reqHandler.RequestsHandled;
365 }
366 }
367 );
368
369 foreach (KeyValuePair<string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value))
370 {
371 cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
372 }
373
374 sb.Append(cdt.ToString());
375 }
376
377 private void BuildSummaryStatsByCapReport(StringBuilder sb)
378 {
379 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
380 cdt.AddColumn("Name", 34);
381 cdt.AddColumn("Req Received", 12);
382 cdt.AddColumn("Req Handled", 12);
383 cdt.Indent = 2;
384
385 Dictionary<string, int> receivedStats = new Dictionary<string, int>();
386 Dictionary<string, int> handledStats = new Dictionary<string, int>();
387
388 m_scene.ForEachScenePresence(
389 sp =>
390 {
391 Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
392
393 if (caps == null)
394 return;
395
396 Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
397
398 foreach (IRequestHandler reqHandler in capsHandlers.Values)
399 {
400 string reqName = reqHandler.Name ?? "";
401
402 if (!receivedStats.ContainsKey(reqName))
403 {
404 receivedStats[reqName] = reqHandler.RequestsReceived;
405 handledStats[reqName] = reqHandler.RequestsHandled;
406 }
407 else
408 {
409 receivedStats[reqName] += reqHandler.RequestsReceived;
410 handledStats[reqName] += reqHandler.RequestsHandled;
411 }
412 }
413 }
414 );
415
416 foreach (KeyValuePair<string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value))
417 cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
418
419 sb.Append(cdt.ToString());
420 }
421
422 private void HandleShowCapsStatsByUserCommand(string module, string[] cmdParams)
423 {
424 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
425 return;
426
427 if (cmdParams.Length != 5 && cmdParams.Length != 7)
428 {
429 MainConsole.Instance.Output("Usage: show caps stats by user [<first-name> <last-name>]");
430 return;
431 }
432
433 StringBuilder sb = new StringBuilder();
434 sb.AppendFormat("Region {0}:\n", m_scene.Name);
435
436 if (cmdParams.Length == 5)
437 {
438 BuildSummaryStatsByUserReport(sb);
439 }
440 else if (cmdParams.Length == 7)
441 {
442 string firstName = cmdParams[5];
443 string lastName = cmdParams[6];
444
445 ScenePresence sp = m_scene.GetScenePresence(firstName, lastName);
446
447 if (sp == null)
448 return;
449
450 BuildDetailedStatsByUserReport(sb, sp);
451 }
452
453 MainConsole.Instance.Output(sb.ToString());
454 }
455
456 private void BuildDetailedStatsByUserReport(StringBuilder sb, ScenePresence sp)
457 {
458 sb.AppendFormat("Avatar name {0}, type {1}\n", sp.Name, sp.IsChildAgent ? "child" : "root");
459
460 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
461 cdt.AddColumn("Cap Name", 34);
462 cdt.AddColumn("Req Received", 12);
463 cdt.AddColumn("Req Handled", 12);
464 cdt.Indent = 2;
465
466 Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
467
468 if (caps == null)
469 return;
470
471 Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
472
473 foreach (IRequestHandler reqHandler in capsHandlers.Values.OrderByDescending(rh => rh.RequestsReceived))
474 {
475 cdt.AddRow(reqHandler.Name, reqHandler.RequestsReceived, reqHandler.RequestsHandled);
476 }
477
478 sb.Append(cdt.ToString());
479 }
480
481 private void BuildSummaryStatsByUserReport(StringBuilder sb)
482 {
483 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
484 cdt.AddColumn("Name", 32);
485 cdt.AddColumn("Type", 5);
486 cdt.AddColumn("Req Received", 12);
487 cdt.AddColumn("Req Handled", 12);
488 cdt.Indent = 2;
489
490 m_scene.ForEachScenePresence(
491 sp =>
492 {
493 Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
494
495 if (caps == null)
496 return;
497
498 Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
499
500 int totalRequestsReceived = 0;
501 int totalRequestsHandled = 0;
502
503 foreach (IRequestHandler reqHandler in capsHandlers.Values)
504 {
505 totalRequestsReceived += reqHandler.RequestsReceived;
506 totalRequestsHandled += reqHandler.RequestsHandled;
507 }
508
509 cdt.AddRow(sp.Name, sp.IsChildAgent ? "child" : "root", totalRequestsReceived, totalRequestsHandled);
510 }
511 );
512
513 sb.Append(cdt.ToString());
514 }
289 } 515 }
290} \ No newline at end of file 516} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs
index eb74cda..2366767 100644
--- a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
55 m_EstateModule = fmodule; 55 m_EstateModule = fmodule;
56 } 56 }
57 57
58 public override byte[] Handle(string path, Stream requestData, 58 protected override byte[] ProcessRequest(string path, Stream requestData,
59 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 59 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
60 { 60 {
61 StreamReader sr = new StreamReader(requestData); 61 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
index 726becf..f208afb 100644
--- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
+++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Scenes
63 osXStatsURI = Util.SHA1Hash(regionInfo.osSecret); 63 osXStatsURI = Util.SHA1Hash(regionInfo.osSecret);
64 } 64 }
65 65
66 public override byte[] Handle( 66 protected override byte[] ProcessRequest(
67 string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 67 string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
68 { 68 {
69 return Util.UTF8.GetBytes(Report()); 69 return Util.UTF8.GetBytes(Report());
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs
index 1ea1c20..6e0a80a 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs
@@ -281,7 +281,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
281 m_module = module; 281 m_module = module;
282 } 282 }
283 283
284 public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 284 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
285 { 285 {
286 StreamReader reader = new StreamReader(request); 286 StreamReader reader = new StreamReader(request);
287 string requestBody = reader.ReadToEnd(); 287 string requestBody = reader.ReadToEnd();
diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs
index 550b5d4..8720cc7 100644
--- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs
+++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
55 m_WorldViewModule = fmodule; 55 m_WorldViewModule = fmodule;
56 } 56 }
57 57
58 public override byte[] Handle(string path, Stream requestData, 58 protected override byte[] ProcessRequest(string path, Stream requestData,
59 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 59 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
60 { 60 {
61 httpResponse.ContentType = "image/jpeg"; 61 httpResponse.ContentType = "image/jpeg";
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
index 986394b..941b97d 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Server.Handlers.Asset
70 m_allowedTypes = allowedTypes; 70 m_allowedTypes = allowedTypes;
71 } 71 }
72 72
73 public override byte[] Handle(string path, Stream request, 73 protected override byte[] ProcessRequest(string path, Stream request,
74 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 74 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
75 { 75 {
76 bool result = false; 76 bool result = false;
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
index 8f7412b..8b23a83 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Asset
54 m_AssetService = service; 54 m_AssetService = service;
55 } 55 }
56 56
57 public override byte[] Handle(string path, Stream request, 57 protected override byte[] ProcessRequest(string path, Stream request,
58 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 58 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
59 { 59 {
60 byte[] result = new byte[0]; 60 byte[] result = new byte[0];
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
index a006fa8..8eebc61 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Asset
54 m_AssetService = service; 54 m_AssetService = service;
55 } 55 }
56 56
57 public override byte[] Handle(string path, Stream request, 57 protected override byte[] ProcessRequest(string path, Stream request,
58 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 58 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
59 { 59 {
60 AssetBase asset; 60 AssetBase asset;
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
index 6b93cd9..16e011a 100644
--- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Server.Handlers.Authentication
70 } 70 }
71 } 71 }
72 72
73 public override byte[] Handle(string path, Stream request, 73 protected override byte[] ProcessRequest(string path, Stream request,
74 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 74 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
75 { 75 {
76 string[] p = SplitParams(path); 76 string[] p = SplitParams(path);
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
147 #endregion 147 #endregion
148 } 148 }
149 149
150 public class OpenIdStreamHandler : IStreamHandler 150 public class OpenIdStreamHandler : BaseOutputStreamHandler
151 { 151 {
152 #region HTML 152 #region HTML
153 153
@@ -191,42 +191,34 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
191 191
192 #endregion HTML 192 #endregion HTML
193 193
194 public string Name { get { return "OpenId"; } }
195 public string Description { get { return null; } }
196 public string ContentType { get { return m_contentType; } }
197 public string HttpMethod { get { return m_httpMethod; } }
198 public string Path { get { return m_path; } }
199
200 string m_contentType;
201 string m_httpMethod;
202 string m_path;
203 IAuthenticationService m_authenticationService; 194 IAuthenticationService m_authenticationService;
204 IUserAccountService m_userAccountService; 195 IUserAccountService m_userAccountService;
205 ProviderMemoryStore m_openidStore = new ProviderMemoryStore(); 196 ProviderMemoryStore m_openidStore = new ProviderMemoryStore();
206 197
198 public override string ContentType { get { return "text/html"; } }
199
207 /// <summary> 200 /// <summary>
208 /// Constructor 201 /// Constructor
209 /// </summary> 202 /// </summary>
210 public OpenIdStreamHandler(string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService) 203 public OpenIdStreamHandler(
204 string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService)
205 : base(httpMethod, path, "OpenId", "OpenID stream handler")
211 { 206 {
212 m_authenticationService = authService; 207 m_authenticationService = authService;
213 m_userAccountService = userService; 208 m_userAccountService = userService;
214 m_httpMethod = httpMethod;
215 m_path = path;
216
217 m_contentType = "text/html";
218 } 209 }
219 210
220 /// <summary> 211 /// <summary>
221 /// Handles all GET and POST requests for OpenID identifier pages and endpoint 212 /// Handles all GET and POST requests for OpenID identifier pages and endpoint
222 /// server communication 213 /// server communication
223 /// </summary> 214 /// </summary>
224 public void Handle(string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 215 protected override void ProcessRequest(
216 string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
225 { 217 {
226 Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath)); 218 Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath));
227 219
228 // Defult to returning HTML content 220 // Defult to returning HTML content
229 m_contentType = "text/html"; 221 httpResponse.ContentType = ContentType;
230 222
231 try 223 try
232 { 224 {
@@ -276,7 +268,7 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
276 268
277 string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type"); 269 string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type");
278 if (contentTypeValues != null && contentTypeValues.Length == 1) 270 if (contentTypeValues != null && contentTypeValues.Length == 1)
279 m_contentType = contentTypeValues[0]; 271 httpResponse.ContentType = contentTypeValues[0];
280 272
281 // Set the response code and document body based on the OpenID result 273 // Set the response code and document body based on the OpenID result
282 httpResponse.StatusCode = (int)provider.Request.Response.Code; 274 httpResponse.StatusCode = (int)provider.Request.Response.Code;
@@ -344,4 +336,4 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
344 return false; 336 return false;
345 } 337 }
346 } 338 }
347} 339} \ No newline at end of file
diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
index bcf9d47..c9b4e9b 100644
--- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Authorization
54 m_AuthorizationService = service; 54 m_AuthorizationService = service;
55 } 55 }
56 56
57 public override byte[] Handle(string path, Stream request, 57 protected override byte[] ProcessRequest(string path, Stream request,
58 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 58 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
59 { 59 {
60 XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest)); 60 XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest));
diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
index 8cd747e..d6bbb8f 100644
--- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Avatar
56 m_AvatarService = service; 56 m_AvatarService = service;
57 } 57 }
58 58
59 public override byte[] Handle(string path, Stream requestData, 59 protected override byte[] ProcessRequest(string path, Stream requestData,
60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
61 { 61 {
62 StreamReader sr = new StreamReader(requestData); 62 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
index 47a8558..ca0a24c 100644
--- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Friends
57 m_FriendsService = service; 57 m_FriendsService = service;
58 } 58 }
59 59
60 public override byte[] Handle(string path, Stream requestData, 60 protected override byte[] ProcessRequest(string path, Stream requestData,
61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
62 { 62 {
63 StreamReader sr = new StreamReader(requestData); 63 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index ef5f33e..89cba8a 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Grid
57 m_GridService = service; 57 m_GridService = service;
58 } 58 }
59 59
60 public override byte[] Handle(string path, Stream requestData, 60 protected override byte[] ProcessRequest(string path, Stream requestData,
61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 61 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
62 { 62 {
63 StreamReader sr = new StreamReader(requestData); 63 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
index 7483395..0b98e9a 100644
--- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.GridUser
56 m_GridUserService = service; 56 m_GridUserService = service;
57 } 57 }
58 58
59 public override byte[] Handle(string path, Stream requestData, 59 protected override byte[] ProcessRequest(string path, Stream requestData,
60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
61 { 61 {
62 StreamReader sr = new StreamReader(requestData); 62 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
index 0aa2729..a2bdadb 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
68 m_log.ErrorFormat("[HGFRIENDS HANDLER]: TheService is null!"); 68 m_log.ErrorFormat("[HGFRIENDS HANDLER]: TheService is null!");
69 } 69 }
70 70
71 public override byte[] Handle(string path, Stream requestData, 71 protected override byte[] ProcessRequest(string path, Stream requestData,
72 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 72 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
73 { 73 {
74 StreamReader sr = new StreamReader(requestData); 74 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
index f306b1c..06eaf2e 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
@@ -91,7 +91,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
91 m_HandlersType = handlersType; 91 m_HandlersType = handlersType;
92 } 92 }
93 93
94 public override byte[] Handle(string path, Stream requestData, 94 protected override byte[] ProcessRequest(string path, Stream requestData,
95 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 95 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
96 { 96 {
97 return OKResponse(httpResponse); 97 return OKResponse(httpResponse);
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
index df875af..f37f2f1 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -68,6 +68,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
68 { 68 {
69 return new ExtendedAgentDestinationData(); 69 return new ExtendedAgentDestinationData();
70 } 70 }
71
71 protected override void UnpackData(OSDMap args, AgentDestinationData d, Hashtable request) 72 protected override void UnpackData(OSDMap args, AgentDestinationData d, Hashtable request)
72 { 73 {
73 base.UnpackData(args, d, request); 74 base.UnpackData(args, d, request);
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
index 231e32f..e2c50fe 100644
--- a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
+++ b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Inventory
56 m_InventoryService = service; 56 m_InventoryService = service;
57 } 57 }
58 58
59 public override byte[] Handle(string path, Stream request, 59 protected override byte[] ProcessRequest(string path, Stream request,
60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
61 { 61 {
62 XmlSerializer xs = new XmlSerializer(typeof (List<InventoryItemBase>)); 62 XmlSerializer xs = new XmlSerializer(typeof (List<InventoryItemBase>));
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index 9d28dc3..0d7c136 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Server.Handlers.Asset
87 m_InventoryService = service; 87 m_InventoryService = service;
88 } 88 }
89 89
90 public override byte[] Handle(string path, Stream requestData, 90 protected override byte[] ProcessRequest(string path, Stream requestData,
91 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 91 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
92 { 92 {
93 StreamReader sr = new StreamReader(requestData); 93 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
index 4a61969..d438fc7 100644
--- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Server.Handlers.MapImage
99 m_Proxy = proxy; 99 m_Proxy = proxy;
100 } 100 }
101 101
102 public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 102 protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
103 { 103 {
104// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path); 104// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
105 StreamReader sr = new StreamReader(requestData); 105 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
index fb85d1c..7bb2f39 100644
--- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Server.Handlers.MapImage
80 m_MapService = service; 80 m_MapService = service;
81 } 81 }
82 82
83 public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 83 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
84 { 84 {
85 byte[] result = new byte[0]; 85 byte[] result = new byte[0];
86 86
diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
index 8a1f824..3525a01 100644
--- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
+++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Server.Handlers.Neighbour
58 // TODO: unused: m_AuthenticationService = authentication; 58 // TODO: unused: m_AuthenticationService = authentication;
59 } 59 }
60 60
61 public override byte[] Handle(string path, Stream request, 61 protected override byte[] ProcessRequest(string path, Stream request,
62 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 62 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
63 { 63 {
64 // Not implemented yet 64 // Not implemented yet
@@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.Neighbour
83 // TODO: unused: m_AllowForeignGuests = foreignGuests; 83 // TODO: unused: m_AllowForeignGuests = foreignGuests;
84 } 84 }
85 85
86 public override byte[] Handle(string path, Stream request, 86 protected override byte[] ProcessRequest(string path, Stream request,
87 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 87 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
88 { 88 {
89 byte[] result = new byte[0]; 89 byte[] result = new byte[0];
@@ -176,7 +176,7 @@ namespace OpenSim.Server.Handlers.Neighbour
176 // TODO: unused: m_AuthenticationService = authentication; 176 // TODO: unused: m_AuthenticationService = authentication;
177 } 177 }
178 178
179 public override byte[] Handle(string path, Stream request, 179 protected override byte[] ProcessRequest(string path, Stream request,
180 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 180 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
181 { 181 {
182 // Not implemented yet 182 // Not implemented yet
@@ -197,7 +197,7 @@ namespace OpenSim.Server.Handlers.Neighbour
197 // TODO: unused: m_AuthenticationService = authentication; 197 // TODO: unused: m_AuthenticationService = authentication;
198 } 198 }
199 199
200 public override byte[] Handle(string path, Stream request, 200 protected override byte[] ProcessRequest(string path, Stream request,
201 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 201 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
202 { 202 {
203 // Not implemented yet 203 // Not implemented yet
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
index 2d67c6d..abb4b19 100644
--- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Presence
56 m_PresenceService = service; 56 m_PresenceService = service;
57 } 57 }
58 58
59 public override byte[] Handle(string path, Stream requestData, 59 protected override byte[] ProcessRequest(string path, Stream requestData,
60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 60 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
61 { 61 {
62 StreamReader sr = new StreamReader(requestData); 62 StreamReader sr = new StreamReader(requestData);
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 71a9e6f..a9fd4ed 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -251,7 +251,7 @@ namespace OpenSim.Server.Handlers.Simulation
251 m_SimulationService = null; 251 m_SimulationService = null;
252 } 252 }
253 253
254 public override byte[] Handle(string path, Stream request, 254 protected override byte[] ProcessRequest(string path, Stream request,
255 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 255 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
256 { 256 {
257// m_log.DebugFormat("[SIMULATION]: Stream handler called"); 257// m_log.DebugFormat("[SIMULATION]: Stream handler called");
@@ -457,7 +457,7 @@ namespace OpenSim.Server.Handlers.Simulation
457 m_SimulationService = null; 457 m_SimulationService = null;
458 } 458 }
459 459
460 public override byte[] Handle(string path, Stream request, 460 protected override byte[] ProcessRequest(string path, Stream request,
461 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 461 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
462 { 462 {
463// m_log.DebugFormat("[SIMULATION]: Stream handler called"); 463// m_log.DebugFormat("[SIMULATION]: Stream handler called");
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
index 72551ef..24c9de6 100644
--- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
68 } 68 }
69 } 69 }
70 70
71 public override byte[] Handle(string path, Stream requestData, 71 protected override byte[] ProcessRequest(string path, Stream requestData,
72 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 72 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
73 { 73 {
74 StreamReader sr = new StreamReader(requestData); 74 StreamReader sr = new StreamReader(requestData);