aboutsummaryrefslogtreecommitdiffstats
path: root/pacredir.c
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-05-28 16:11:24 +0200
committerGravatar Christian Hesse <mail@eworm.de>2021-06-07 09:59:03 +0200
commit6a3e91262b53d13f90383ff2604cff1bbebe7c40 (patch)
tree2a4e518904511ee54c49b8dd1db8e6a60677fb7c /pacredir.c
parent4a4d07193cba5e07ba4c4d94d241cc438b8b2b7c (diff)
downloadpacredir-6a3e91262b53d13f90383ff2604cff1bbebe7c40.tar.gz
pacredir-6a3e91262b53d13f90383ff2604cff1bbebe7c40.tar.zst
do not redirect if database file is too old
The Arch repositories see regular updates... Consider a database file older than 24 hours out-of-date and do not redirect.
Diffstat (limited to 'pacredir.c')
-rw-r--r--pacredir.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pacredir.c b/pacredir.c
index bbb297c..82bba71 100644
--- a/pacredir.c
+++ b/pacredir.c
@@ -524,8 +524,9 @@ static mhd_result ahc_echo(void * cls,
}
if (request->http_code == MHD_HTTP_OK &&
- /* for db files choose the most recent server */
- ((dbfile == 1 && ((request->last_modified > last_modified) ||
+ /* for db files choose the most recent server when not too old */
+ ((dbfile == 1 && ((request->last_modified > last_modified &&
+ request->last_modified + 86400 > time(NULL)) ||
/* but use a faster server if available */
(url != NULL &&
request->last_modified >= last_modified &&