aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/RestPlugin.cs16
1 files changed, 11 insertions, 5 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
index 199bff8..8c370ed 100644
--- a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
+++ b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
@@ -211,6 +211,7 @@ namespace OpenSim.ApplicationPlugins.Rest
211 211
212 // Retrieve GOD key value, if any. 212 // Retrieve GOD key value, if any.
213 _godkey = _config.GetString("god_key", String.Empty); 213 _godkey = _config.GetString("god_key", String.Empty);
214
214 // Retrive prefix if any. 215 // Retrive prefix if any.
215 _prefix = _config.GetString("prefix", "/admin"); 216 _prefix = _config.GetString("prefix", "/admin");
216 217
@@ -242,7 +243,7 @@ namespace OpenSim.ApplicationPlugins.Rest
242 243
243 private List<RestStreamHandler> _handlers = new List<RestStreamHandler>(); 244 private List<RestStreamHandler> _handlers = new List<RestStreamHandler>();
244 245
245 public void AddRestStreamHandler(string httpMethod, string path, RestMethod method) 246 public virtual void AddRestStreamHandler(string httpMethod, string path, RestMethod method)
246 { 247 {
247 if (!IsEnabled) return; 248 if (!IsEnabled) return;
248 249
@@ -258,13 +259,18 @@ namespace OpenSim.ApplicationPlugins.Rest
258 m_log.DebugFormat("{0} Added REST handler {1} {2}", MsgID, httpMethod, path); 259 m_log.DebugFormat("{0} Added REST handler {1} {2}", MsgID, httpMethod, path);
259 } 260 }
260 261
261 262 public bool AddAgentHandler(string agentname, IHttpAgentHandler handler)
262 protected bool VerifyGod(string key)
263 { 263 {
264 if (String.IsNullOrEmpty(key)) return false;
265 if (!IsEnabled) return false; 264 if (!IsEnabled) return false;
265 return _httpd.AddAgentHandler(agentname, handler);
266 }
266 267
267 return key == _godkey; 268 protected bool IsGod(OSHttpRequest request)
269 {
270 string[] keys = request.Headers.GetValues("x-opensim-godkey");
271 if (null == keys) return false;
272 // we take the last key supplied
273 return keys[keys.Length-1] == _godkey;
268 } 274 }
269 275
270 public virtual void Close() 276 public virtual void Close()