From af77fdc535cd62df87163b7710232f05c32718a1 Mon Sep 17 00:00:00 2001 From: Chaphasilor Date: Sun, 22 Aug 2021 15:58:43 +0200 Subject: [PATCH] only apply the Content-Length fix to The Eye ODs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - for some ODs the fix caused scans to take much longer, because the server never returned the Content-Length header for some files (e.g. .php, .html) - this should be fixed properly at some point 😅 --- src/OpenDirectoryDownloader/Helpers/UrlHeaderInfoHelper.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/OpenDirectoryDownloader/Helpers/UrlHeaderInfoHelper.cs b/src/OpenDirectoryDownloader/Helpers/UrlHeaderInfoHelper.cs index 3f962359..b7c28438 100644 --- a/src/OpenDirectoryDownloader/Helpers/UrlHeaderInfoHelper.cs +++ b/src/OpenDirectoryDownloader/Helpers/UrlHeaderInfoHelper.cs @@ -50,7 +50,10 @@ public static class UrlHeaderInfoHelper try { - if (httpResponseMessage.Content?.Headers.ContentLength == null) { + if ( + (new Uri(url)).Host == "the-eye.eu" && // workaround until we come up with a better way to fix this **without slowing down scans of ODs that don't report `Content-Length` at all for some files** (e.g. .php, .html) + httpResponseMessage.Content?.Headers.ContentLength == null + ) { throw new Exception("Missing Content-Length header!"); } return httpResponseMessage.Content?.Headers.ContentLength;