Fetching - Always record server software reply headers (will be used in the future) (#2143)

This commit is contained in:
dgtlmoon
2024-01-31 16:15:43 +01:00
committed by GitHub
parent fca40e4d5b
commit 7d96b4ba83
7 changed files with 50 additions and 21 deletions

View File

@@ -491,6 +491,16 @@ class update_worker(threading.Thread):
if self.datastore.data['watching'].get(uuid):
# Always record that we atleast tried
count = self.datastore.data['watching'][uuid].get('check_count', 0) + 1
# Record the 'server' header reply, can be used for actions in the future like cloudflare/akamai workarounds
try:
server_header = update_handler.fetcher.headers.get('server', '').strip().lower()[:255]
self.datastore.update_watch(uuid=uuid,
update_obj={'remote_server_reply': server_header}
)
except Exception as e:
pass
self.datastore.update_watch(uuid=uuid, update_obj={'fetch_time': round(time.time() - now, 3),
'last_checked': round(time.time()),
'check_count': count