From 73bd06beedd2b1b0d1efeaa599659f45c1bbf40c Mon Sep 17 00:00:00 2001 From: xljiulang <366193849@qq.com> Date: Sat, 19 Jun 2021 14:39:22 +0800 Subject: [PATCH] =?UTF-8?q?https=E5=A2=9E=E5=8A=A0=E7=9F=AD=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E6=89=AB=E6=8F=8F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.Scanner/ScanMiddlewares/HttpsScanMiddleware.cs | 1 + FastGithub.Scanner/ScanMiddlewares/HttpsScanOptions.cs | 5 +++++ FastGithub/appsettings.json | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/FastGithub.Scanner/ScanMiddlewares/HttpsScanMiddleware.cs b/FastGithub.Scanner/ScanMiddlewares/HttpsScanMiddleware.cs index 534f216..64ac325 100644 --- a/FastGithub.Scanner/ScanMiddlewares/HttpsScanMiddleware.cs +++ b/FastGithub.Scanner/ScanMiddlewares/HttpsScanMiddleware.cs @@ -58,6 +58,7 @@ namespace FastGithub.Scanner.ScanMiddlewares request.Method = new HttpMethod(rule.Method); request.RequestUri = new Uri(new Uri($"https://{context.Address}"), rule.Path); request.Headers.Host = context.Domain; + request.Headers.ConnectionClose = setting.ConnectionClose; var timeout = this.options.CurrentValue.Timeout; using var timeoutTokenSource = new CancellationTokenSource(timeout); diff --git a/FastGithub.Scanner/ScanMiddlewares/HttpsScanOptions.cs b/FastGithub.Scanner/ScanMiddlewares/HttpsScanOptions.cs index 6acadc4..f5af2b6 100644 --- a/FastGithub.Scanner/ScanMiddlewares/HttpsScanOptions.cs +++ b/FastGithub.Scanner/ScanMiddlewares/HttpsScanOptions.cs @@ -14,6 +14,11 @@ namespace FastGithub.Scanner.ScanMiddlewares /// public TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(5d); + /// + /// 是否使用短连接 + /// + public bool ConnectionClose { get; set; } = false; + /// /// 各域名扫描规则 /// diff --git a/FastGithub/appsettings.json b/FastGithub/appsettings.json index 09b598c..9108f66 100644 --- a/FastGithub/appsettings.json +++ b/FastGithub/appsettings.json @@ -13,14 +13,18 @@ }, "HttpsScan": { "Timeout": "00:00:05", // httpsɨ賬ʱʱ + "ConnectionClose": false, // Ƿʹö "Rules": { "github.githubassets.com": { + "Method": "HEAD", "Path": "/favicons/favicon.png" }, "avatars.githubusercontent.com": { + "Method": "HEAD", "Path": "/u/8308014?s=40&v=4" }, "raw.githubusercontent.com": { + "Method": "HEAD", "Path": "/xljiulang/FastGithub/master/README.md" } }