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

Commit 17a4efe

Browse files
committed
do not create wilcard certificate for ip addresses, #594
1 parent c9bbbd1 commit 17a4efe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Net;
23
using System.Text;
34
using System.Text.RegularExpressions;
45
using System.Threading;
@@ -99,7 +100,13 @@ internal static string GetWildCardDomainName(string hostname)
99100
{
100101
// only for subdomains we need wild card
101102
// example www.google.com or gstatic.google.com
102-
// but NOT for google.com
103+
// but NOT for google.com or IP address
104+
105+
if (IPAddress.TryParse(hostname, out _))
106+
{
107+
return hostname;
108+
}
109+
103110
if (hostname.Split(ProxyConstants.DotSplit).Length > 2)
104111
{
105112
int idx = hostname.IndexOf(ProxyConstants.DotSplit);

0 commit comments

Comments
 (0)