Thank you, otakup0pe, for a patch that enables basic auth with LSL

trunk
Melanie Thielker 2009-07-18 20:10:19 +00:00
parent bb4b81d70f
commit 52f983613c
1 changed files with 17 additions and 1 deletions

View File

@ -31,6 +31,7 @@ using System.Collections.Generic;
using System.Runtime.Remoting.Lifetime;
using System.Text;
using System.Threading;
using System.Text.RegularExpressions;
using Nini.Config;
using log4net;
using OpenMetaverse;
@ -9018,6 +9019,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (userAgent != null)
httpHeaders["User-Agent"] = userAgent;
string authregex = @"^(https?:\/\/)(\w+):(\w+)@(.*)$";
Regex r = new Regex(authregex);
int[] gnums = r.GetGroupNumbers();
Match m = r.Match(url);
if ( m.Success ) {
for (int i = 1; i < gnums.Length; i++) {
System.Text.RegularExpressions.Group g = m.Groups[gnums[i]];
CaptureCollection cc = g.Captures;
}
if ( m.Groups.Count == 5 ) {
httpHeaders["Authorization"] = String.Format("Basic {0}", Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(m.Groups[2].ToString() + ":" + m.Groups[3].ToString())));
url = m.Groups[1].ToString() + m.Groups[4].ToString();
}
}
UUID reqID = httpScriptMod.
StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body);