From 9d488ba45e14e2fcc69854dab3bd08ac011bcb3b Mon Sep 17 00:00:00 2001 From: Brenton Cleeland Date: Sun, 25 Feb 2024 13:01:26 +1100 Subject: [PATCH] fix: remove 'parse error' from output in successful Cache-Control response Fixes #27 --- ready/checks/html.py | 3 ++- ready/ready.py | 2 +- setup.cfg | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ready/checks/html.py b/ready/checks/html.py index 23118bd..356f380 100644 --- a/ready/checks/html.py +++ b/ready/checks/html.py @@ -252,12 +252,13 @@ def check_html_should_not_be_cached_for_more_than_24_hours(responses, **kwargs): if "max-age=" in cc_header: max_age = re.search("max-age=(?P\d+)", cc_header) + if max_age: try: age = int(max_age.group("age")) return result( age <= 86400, - f"Cache-Control max-age should be <= 86400 for HTML documents (parse error: {cc_header})", + f"Cache-Control max-age should be <= 86400 for HTML documents ({cc_header})", "html_cache_duration", **kwargs, ) diff --git a/ready/ready.py b/ready/ready.py index 7564859..4d20c6f 100644 --- a/ready/ready.py +++ b/ready/ready.py @@ -7,7 +7,7 @@ from importlib import resources from . import checks as checks_module -VERSION = "1.2.3" +VERSION = "1.2.4" from ready.checks.bad_response import ( check_bad_response_cloudflare, diff --git a/setup.cfg b/setup.cfg index 0c5b7a8..5dc2e98 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = ready-check -version = 1.2.3 +version = 1.2.4 author = Brenton Cleeland author_email = brenton@brntn.me description = A developer-friendly web scanning tool