diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Handlers/Friends/FriendServerConnector.cs | 4 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs | 22 |
2 files changed, 9 insertions, 17 deletions
diff --git a/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs b/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs index 5784bdf..b0e6c7d 100644 --- a/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs +++ b/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -55,7 +56,8 @@ namespace OpenSim.Server.Handlers.Friends | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args); | 57 | m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new FriendsServerPostHandler(m_FriendsService)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
60 | server.AddStreamHandler(new FriendsServerPostHandler(m_FriendsService, auth)); | ||
59 | } | 61 | } |
60 | } | 62 | } |
61 | } | 63 | } |
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index 47a8558..3aab30b 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Server.Base; | |||
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 41 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | using OpenSim.Framework.ServiceAuth; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | 44 | using OpenSim.Framework.Servers.HttpServer; |
44 | using OpenMetaverse; | 45 | using OpenMetaverse; |
45 | 46 | ||
@@ -51,13 +52,13 @@ namespace OpenSim.Server.Handlers.Friends | |||
51 | 52 | ||
52 | private IFriendsService m_FriendsService; | 53 | private IFriendsService m_FriendsService; |
53 | 54 | ||
54 | public FriendsServerPostHandler(IFriendsService service) : | 55 | public FriendsServerPostHandler(IFriendsService service, IServiceAuth auth) : |
55 | base("POST", "/friends") | 56 | base("POST", "/friends", auth) |
56 | { | 57 | { |
57 | m_FriendsService = service; | 58 | m_FriendsService = service; |
58 | } | 59 | } |
59 | 60 | ||
60 | public override byte[] Handle(string path, Stream requestData, | 61 | protected override byte[] ProcessRequest(string path, Stream requestData, |
61 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 62 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
62 | { | 63 | { |
63 | StreamReader sr = new StreamReader(requestData); | 64 | StreamReader sr = new StreamReader(requestData); |
@@ -228,7 +229,7 @@ namespace OpenSim.Server.Handlers.Friends | |||
228 | 229 | ||
229 | rootElement.AppendChild(result); | 230 | rootElement.AppendChild(result); |
230 | 231 | ||
231 | return DocToBytes(doc); | 232 | return Util.DocToBytes(doc); |
232 | } | 233 | } |
233 | 234 | ||
234 | private byte[] FailureResult() | 235 | private byte[] FailureResult() |
@@ -260,18 +261,7 @@ namespace OpenSim.Server.Handlers.Friends | |||
260 | 261 | ||
261 | rootElement.AppendChild(message); | 262 | rootElement.AppendChild(message); |
262 | 263 | ||
263 | return DocToBytes(doc); | 264 | return Util.DocToBytes(doc); |
264 | } | ||
265 | |||
266 | private byte[] DocToBytes(XmlDocument doc) | ||
267 | { | ||
268 | MemoryStream ms = new MemoryStream(); | ||
269 | XmlTextWriter xw = new XmlTextWriter(ms, null); | ||
270 | xw.Formatting = Formatting.Indented; | ||
271 | doc.WriteTo(xw); | ||
272 | xw.Flush(); | ||
273 | |||
274 | return ms.ToArray(); | ||
275 | } | 265 | } |
276 | 266 | ||
277 | void FromKeyValuePairs(Dictionary<string, object> kvp, out string principalID, out string friend, out int flags) | 267 | void FromKeyValuePairs(Dictionary<string, object> kvp, out string principalID, out string friend, out int flags) |