diff options
author | Melanie Thielker | 2009-07-18 20:10:19 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-07-18 20:10:19 +0000 |
commit | 52f983613c5eac211edb4ab1b166a261e04ceed9 (patch) | |
tree | 4b472e7b10deb6e939cda5a3803057fc3edb5bb8 /OpenSim/Region/ScriptEngine | |
parent | * patch from jonc (diff) | |
download | opensim-SC-52f983613c5eac211edb4ab1b166a261e04ceed9.zip opensim-SC-52f983613c5eac211edb4ab1b166a261e04ceed9.tar.gz opensim-SC-52f983613c5eac211edb4ab1b166a261e04ceed9.tar.bz2 opensim-SC-52f983613c5eac211edb4ab1b166a261e04ceed9.tar.xz |
Thank you, otakup0pe, for a patch that enables basic auth with LSL
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c74a41b..37d82d0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Runtime.Remoting.Lifetime; | 31 | using System.Runtime.Remoting.Lifetime; |
32 | using System.Text; | 32 | using System.Text; |
33 | using System.Threading; | 33 | using System.Threading; |
34 | using System.Text.RegularExpressions; | ||
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using log4net; | 36 | using log4net; |
36 | using OpenMetaverse; | 37 | using OpenMetaverse; |
@@ -66,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
66 | /// </summary> | 67 | /// </summary> |
67 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi | 68 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi |
68 | { | 69 | { |
69 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 70 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
70 | protected IScriptEngine m_ScriptEngine; | 71 | protected IScriptEngine m_ScriptEngine; |
71 | protected SceneObjectPart m_host; | 72 | protected SceneObjectPart m_host; |
72 | protected uint m_localID; | 73 | protected uint m_localID; |
@@ -9018,6 +9019,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9018 | if (userAgent != null) | 9019 | if (userAgent != null) |
9019 | httpHeaders["User-Agent"] = userAgent; | 9020 | httpHeaders["User-Agent"] = userAgent; |
9020 | 9021 | ||
9022 | string authregex = @"^(https?:\/\/)(\w+):(\w+)@(.*)$"; | ||
9023 | Regex r = new Regex(authregex); | ||
9024 | int[] gnums = r.GetGroupNumbers(); | ||
9025 | Match m = r.Match(url); | ||
9026 | if ( m.Success ) { | ||
9027 | for (int i = 1; i < gnums.Length; i++) { | ||
9028 | System.Text.RegularExpressions.Group g = m.Groups[gnums[i]]; | ||
9029 | CaptureCollection cc = g.Captures; | ||
9030 | } | ||
9031 | if ( m.Groups.Count == 5 ) { | ||
9032 | httpHeaders["Authorization"] = String.Format("Basic {0}", Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(m.Groups[2].ToString() + ":" + m.Groups[3].ToString()))); | ||
9033 | url = m.Groups[1].ToString() + m.Groups[4].ToString(); | ||
9034 | } | ||
9035 | } | ||
9036 | |||
9021 | UUID reqID = httpScriptMod. | 9037 | UUID reqID = httpScriptMod. |
9022 | StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body); | 9038 | StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body); |
9023 | 9039 | ||