summaryrefslogtreecommitdiff
path: root/mirror.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-06-10 22:42:11 +0100
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-06-10 22:42:11 +0100
commit59eaebe0bae3d04d283be95de3837c243962461f (patch)
tree5f93365b739231356e48d4e8334708e8941c363a /mirror.php
parentf009176f861ef77feef551e8aa3640da4bd81fcc (diff)
mirror: Better HTTP debugging
Diffstat (limited to 'mirror.php')
-rw-r--r--mirror.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/mirror.php b/mirror.php
index cb48b43..ff463f4 100644
--- a/mirror.php
+++ b/mirror.php
@@ -36,6 +36,7 @@ if (!file_exists($root.'/'.$filename)) {
$mirror = $tier0_url;
if (!should_force_tier0($filename)) {
$ctime = lstat($root.'/'.$filename)['ctime'];
+ header('X-Repomirror-C-Time: '.$ctime);
// TODO: weight by GeoIP or quality or something?
$mirrors = array();
foreach ($mirrors_urls as $mirrors_url) {
@@ -43,11 +44,11 @@ if (!file_exists($root.'/'.$filename)) {
foreach ($json['urls'] as $urldata) {
if (!in_array($urldata['protocol'], ['http', 'https', 'ftp'])) { continue; }
if (strtotime($urldata['last_sync']) < $ctime) { continue; }
+ header('X-Repomirror-Mirror'.count($mirrors).': '.strtotime($urldata['last_sync']).' '.$urldata['url']);
$mirrors[] = $urldata['url'];
}
}
if (count($mirrors) > 0) {
- header('X-Repomirror-Mirrors: '.implode(' ', $mirrors));
$mirror = $mirrors[array_rand($mirrors)];
}
}