From 36457c5757c295d91ea6d101159dbfa2d3bef326 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 8 Apr 2024 15:12:35 +0100 Subject: [PATCH] Tidying --- daemon_get.py | 4 +++- daemon_get_css.py | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/daemon_get.py b/daemon_get.py index 535ed3aba..a0ee14f8a 100644 --- a/daemon_get.py +++ b/daemon_get.py @@ -1292,7 +1292,9 @@ def daemon_http_get(self) -> None: if '/fonts/' in self.path: get_fonts(self, calling_domain, self.path, self.server.base_dir, self.server.debug, - getreq_start_time) + getreq_start_time, self.server.fitness, + self.server.fontsCache, + self.server.domain_full) return fitness_performance(getreq_start_time, self.server.fitness, diff --git a/daemon_get_css.py b/daemon_get_css.py index 78be56b1c..4159be5b5 100644 --- a/daemon_get_css.py +++ b/daemon_get_css.py @@ -63,7 +63,9 @@ def get_style_sheet(self, base_dir: str, calling_domain: str, path: str, def get_fonts(self, calling_domain: str, path: str, base_dir: str, debug: bool, - getreq_start_time) -> None: + getreq_start_time, fitness: {}, + fonts_cache: {}, + domain_full: str) -> None: """Returns a font """ font_str = path.split('/fonts/')[1] @@ -85,17 +87,17 @@ def get_fonts(self, calling_domain: str, path: str, # The file has not changed http_304(self) return - if self.server.fontsCache.get(font_str): - font_binary = self.server.fontsCache[font_str] + if fonts_cache.get(font_str): + font_binary = fonts_cache[font_str] set_headers_etag(self, font_filename, font_type, font_binary, None, - self.server.domain_full, False, None) + domain_full, False, None) write2(self, font_binary) if debug: print('font sent from cache: ' + path + ' ' + calling_domain) - fitness_performance(getreq_start_time, self.server.fitness, + fitness_performance(getreq_start_time, fitness, '_GET', '_get_fonts cache', debug) return @@ -110,14 +112,14 @@ def get_fonts(self, calling_domain: str, path: str, set_headers_etag(self, font_filename, font_type, font_binary, None, - self.server.domain_full, + domain_full, False, None) write2(self, font_binary) - self.server.fontsCache[font_str] = font_binary + fonts_cache[font_str] = font_binary if debug: print('font sent from file: ' + path + ' ' + calling_domain) - fitness_performance(getreq_start_time, self.server.fitness, + fitness_performance(getreq_start_time, fitness, '_GET', '_get_fonts', debug) return if debug: