Handle checking of line starting "*" wildcard for whitelist patterns
A line starting * can only be applied to the domain, not the pathprebuild-update
parent
664cbe2357
commit
cd985ab71b
|
@ -458,24 +458,38 @@ namespace OpenSim.Region.CoreModules.Media.Moap
|
|||
{
|
||||
Uri url = new Uri(rawUrl);
|
||||
|
||||
foreach (string rawWlUrl in whitelist)
|
||||
foreach (string origWlUrl in whitelist)
|
||||
{
|
||||
string wlUrl = rawWlUrl;
|
||||
string wlUrl = origWlUrl;
|
||||
|
||||
// Deal with a line-ending wildcard
|
||||
if (wlUrl.EndsWith("*"))
|
||||
wlUrl = wlUrl.Remove(wlUrl.Length - 1);
|
||||
|
||||
m_log.DebugFormat("[MOAP]: Checking whitelist URL {0}", wlUrl);
|
||||
m_log.DebugFormat("[MOAP]: Checking whitelist URL pattern {0}", origWlUrl);
|
||||
|
||||
// Handle a line starting wildcard slightly differently since this can only match the domain, not the path
|
||||
if (wlUrl.StartsWith("*"))
|
||||
{
|
||||
wlUrl = wlUrl.Substring(1);
|
||||
|
||||
if (url.Host.Contains(wlUrl))
|
||||
{
|
||||
m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string urlToMatch = url.Authority + url.AbsolutePath;
|
||||
|
||||
if (urlToMatch.StartsWith(wlUrl))
|
||||
{
|
||||
m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", wlUrl, urlToMatch);
|
||||
m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue