Do simpler things to create wildcard domains
This commit is contained in:
parent
5a1d6c7390
commit
f98cc4a863
|
@ -288,21 +288,16 @@ function wildcard_domain(domain)
|
||||||
{
|
{
|
||||||
var parts = domain.split(".");
|
var parts = domain.split(".");
|
||||||
|
|
||||||
if (parts.length >= 3)
|
// Standard root domain (zzz.xxx.com) or more
|
||||||
|
if (parts.length > 2)
|
||||||
{
|
{
|
||||||
// Seems to be a two level root domain (ie zzz.xxx.co.uk ...)
|
res = "*.";
|
||||||
if (parts[parts.length-2].lenght <= 3)
|
for (i=1; i<parts.length; i++)
|
||||||
{
|
res += parts[i];
|
||||||
if (parts.length > 3)
|
|
||||||
return "*" + "." + parts[parts.length-3] + "." + parts[parts.length-2] + "." + parts[parts.length-1];
|
|
||||||
}
|
|
||||||
// Standard root domain (zzz.xxx.com)
|
|
||||||
else
|
|
||||||
return "*" + "." + parts[parts.length-2] + "." + parts[parts.length-1];
|
|
||||||
}
|
}
|
||||||
// Simple xxx.com
|
// Simple xxx.com
|
||||||
else if (parts.length == 2)
|
else if (parts.length == 2)
|
||||||
return "*" + "." + parts[0] + "." + parts[1];
|
return "*." + domain;
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
15
cli/main.c
15
cli/main.c
|
@ -297,20 +297,13 @@ static char* wildcard_domain(char* domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Final level
|
// Final level
|
||||||
level_length[cur_level] = tmp - level_ptr[cur_level-1];
|
level_length[cur_level-1] = tmp - level_ptr[cur_level-1];
|
||||||
|
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
if (cur_level >= 3)
|
if (cur_level > 2)
|
||||||
{
|
{
|
||||||
// Seems to be a two level root domain (ie zzz.xxx.co.uk ...)
|
// Standard root domain (zzz.xxx.com) or more
|
||||||
if (level_length[cur_level-2] <= 3)
|
tmp = level_ptr[1];
|
||||||
{
|
|
||||||
if (cur_level > 3)
|
|
||||||
tmp = level_ptr[cur_level-3];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
// Standard root domain (zzz.xxx.com)
|
|
||||||
tmp = level_ptr[cur_level-2];
|
|
||||||
}
|
}
|
||||||
// Simple xxx.com
|
// Simple xxx.com
|
||||||
else if (cur_level == 2)
|
else if (cur_level == 2)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user