Watch
1
0
Fork
You've already forked pkg-proxy
1
mirror of https://github.com/git-pkgs/proxy.git synced 2026-11-09 23:59:16 -05:00
Commit graph pkg-proxy/internal/handler/composer_rewrite_bench_test.go
Author SHA1 Message Date
simon chrzanowski
03c8e680cc
Withhold Composer archives still in cooldown
Cooldown only filtered the metadata. A composer.lock names the proxy's
/files URL directly, so `composer install` fetched versions still inside
the cooldown window without ever seeing the filtered metadata. npm already
checks the publish time on tarball downloads.

- Return the version's publish time with its dist URL, following the
  minified format's inheritance
- Answer 404 for a version in cooldown before fetching its archive
- Read the download lookup's metadata through ReadMetadata, so it has the
  same size limit as other metadata reads
2026-10-14 08:37:39 +02:00
Christian Heim
3c095235f3
Fetch the pinned commit for Composer branch downloads (#430)
* Fetch the pinned commit for Composer branch downloads

The download handler resolved a version's dist URL from the current metadata and cached the archive under whatever file name the client asked for. A lock file pinning an older commit of a branch like dev-master got the branch head, stored and served as that older commit.

Downloads now fetch the commit the file name stands for when the dist URL ends in a commit hash (GitHub zipballs, Bitbucket archives), and return 404 for other names the metadata no longer lists.

* Accept bare commit names from older Composer lock files

Proxy versions before the .zip suffix handed out GitHub zipball URLs ending in the bare commit hash. Lock files written back then still ask for those names, and the new file name check turned them into 404s.

* Rebuild Composer commit URLs only for branch versions

A tagged release lists one commit and lock files ask for that one. Rebuilding the URL for any requested commit let a client store another commit, even one from a fork, as the release, and the browse view could then show it.

* Note that the Composer cache key leaves out the query
2026-10-11 16:57:37 +01:00
simon chrzanowski
449683a676
Rewrite Composer metadata in place and keep it minified (#418)
- Walk version lists in place instead of decoding the document into
  map[string]any and expanding the minified format
- Keep minified metadata minified: each written version carries what differs
  from the client's expanded state, so changes made by versions dropped by
  cooldown fold into the next kept one; every version gets its own dist
- Copy everything else byte for byte; only dist values are written fresh
- Resolve download URLs by walking the list in place, tracking inherited
  fields, instead of decoding and expanding the whole document
- Add forEachJSONElement, rewriteJSONMembers and jsonStringIs to the scanner
2026-10-10 07:31:37 +01:00