Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit 4a2d931

Browse files
committed
#769 Improved logic to handle second level domains
1 parent 2f8286b commit 4a2d931

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Titanium.Web.Proxy/Helpers/HttpHelper.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,17 @@ internal static string GetWildCardDomainName(string hostname)
148148
return hostname;
149149
}
150150

151-
if (hostname.Split(ProxyConstants.DotSplit).Length > 2)
151+
var split = hostname.Split(ProxyConstants.DotSplit);
152+
153+
if (split.Length > 2)
152154
{
153155
// issue #769
154-
// do not create wildcard if second level domain like: .ac.id, .co.id
155-
string[] prefix = hostname.Split(ProxyConstants.DotSplit);
156-
if (prefix[1].Length <= 3)
156+
// do not create wildcard if second level domain like: pay.vn.ua
157+
if (split.Length == 3 && split[1].Length <= 3)
157158
{
158159
return hostname;
159160
}
160-
161+
161162
int idx = hostname.IndexOf(ProxyConstants.DotSplit);
162163

163164
// issue #352

0 commit comments

Comments
 (0)