消息列循环检测

This commit is contained in:
陈国伟 2021-08-04 09:10:53 +08:00
parent 049ea9812e
commit 89b66d4526
2 changed files with 3 additions and 3 deletions

View File

@ -97,8 +97,8 @@ namespace FastGithub.DomainResolve
throw new FastGithubException($"dns{dns}解析不到{domain}的ip"); throw new FastGithubException($"dns{dns}解析不到{domain}的ip");
} }
// 受干扰的dns常常返回127.0.0.1来阻断请求 // 不允许域名解析指向FastGithub自身造成消息死循环
if (address.Equals(IPAddress.Loopback)) if (LocalMachine.ContainsIPAddress(address) == true)
{ {
throw new FastGithubException($"dns{dns}被污染,解析{domain}为{address}"); throw new FastGithubException($"dns{dns}被污染,解析{domain}为{address}");
} }

View File

@ -193,7 +193,7 @@ namespace FastGithub.ReverseProxy
private static string GetSubjectName(X509Certificate cert) private static string GetSubjectName(X509Certificate cert)
{ {
var subject = cert.SubjectDN.ToString(); var subject = cert.SubjectDN.ToString();
if (subject.StartsWith("cn=", StringComparison.OrdinalIgnoreCase)) if (subject.StartsWith("CN=", StringComparison.OrdinalIgnoreCase))
{ {
subject = subject[3..]; subject = subject[3..];
} }