Skip to content

Commit

Permalink
Fix snapshot policy for legacy clients
Browse files Browse the repository at this point in the history
For core <2.10, serve updates from snapshots as before (repo_view is
"unknown").

Only HTTP clients sending X-Repo-View header receive the repo view as
the new feature 6970 says (repo_view is "managed" or "latest").
  • Loading branch information
DavidePrincipi committed Jul 15, 2024
1 parent fd1feb3 commit 3ed36ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions imageroot/script/snapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function main() {
echo "Not found\n";
}

$repo_view = isset($_SERVER['HTTP_X_REPO_VIEW']) ? $_SERVER['HTTP_X_REPO_VIEW'] : "latest";
$repo_view = isset($_SERVER['HTTP_X_REPO_VIEW']) ? $_SERVER['HTTP_X_REPO_VIEW'] : "unknown";
$username = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : "";
$password = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : "";

Expand All @@ -70,13 +70,13 @@ function main() {
}
$snapshot = array_pop($lsnapshots);
}
} else if (substr($_SERVER['DOCUMENT_URI'], 0, 10) == "/distfeed/") {
} else if ($repo_view != "unknown" && substr($_SERVER['DOCUMENT_URI'], 0, 10) == "/distfeed/") {
// Access to latest metadata (distfeed) if client is not
// authenticated, or if the request comes from the user through
// the Software Center APIs.
$snapshot = 'head';
} else {
// Access to latest DNF mirror contents.
// Access to snapshot contents.
$snapshot = array_pop($lsnapshots);
}

Expand Down

0 comments on commit 3ed36ad

Please sign in to comment.