Skip to content

Commit

Permalink
Use querystring for HTTP caches
Browse files Browse the repository at this point in the history
Improve HTTP compliancy: use query string instead of HTTP custom header.
  • Loading branch information
DavidePrincipi committed Jul 24, 2024
1 parent 59271df commit 51e41eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,17 @@ Center page, which needs the Distfeed content. On the other hand the
nightly cluster update procedure wants to install managed updates
automatically for both the base Rocky Linux OS and NS8 applications.

Web clients can send an optional `X-Repo-View` header, with value `latest`
or `managed`. Any other value is considered like `latest`, but this
behavior may change in the future.
Web clients can send an optional `view` querystring parameter, with value
`latest` or `managed`. Any other value is considered like `latest`, but
this behavior may change in the future.

Header codes:

- `A` Authenticated
- `U` Anonymous
- `M` Managed repo view
- `L` Latest repo view
- `X` X-Repo-View header not sent
- `X` querystring `view` parameter not present

Request types:

Expand Down
6 changes: 3 additions & 3 deletions imageroot/script/snapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function serve_from_snapshots() {
}

function main() {
$repo_view = isset($_SERVER['HTTP_X_REPO_VIEW']) ? $_SERVER['HTTP_X_REPO_VIEW'] : "unknown";
$repo_view = isset($_GET['view']) ? $_GET['view'] : "unknown";
$username = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : "";
$password = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : "";

Expand All @@ -94,8 +94,8 @@ function main() {
//

if($repo_view == "unknown") {
// Core <2.10 does not send the X-Repo-View header. We implement
// the initial update policy for backward compatibility.
// Core <2.10 does not send the querystring "view" parameter. We
// implement the initial update policy for backward compatibility.
if($is_authenticated) {
$prefix = serve_from_snapshots(); // AX => SS
} else {
Expand Down

0 comments on commit 51e41eb

Please sign in to comment.