Watch
1
0
Fork
You've already forked pkg-proxy
1
mirror of https://github.com/git-pkgs/proxy.git synced 2026-11-10 08:09:17 -05:00
Commit graph

1,145 commits

Author SHA1 Message Date
Andrew Nesbitt
560ad5cda2
Merge pull request #645 from simonchrz/feat/mirror-refresh
Refresh the most used packages in the background
2026-11-10 12:11:31 +00:00
Andrew Nesbitt
4fd3294e7c
Merge pull request #693 from simonchrz/fix/pypi-release-times
Read PyPI release times without building the whole document
2026-11-10 12:03:53 +00:00
Andrew Nesbitt
f515df3299
Merge pull request #682 from simonchrz/fix/metadata-cache-consistency
Fix metadata cache responses that don't belong together
2026-11-10 11:58:26 +00:00
Andrew Nesbitt
3476449d92
Limit refreshed index documents to the metadata size limit
InRelease, repomd.xml and APKINDEX.tar.gz are read into memory, so cap them at metadata_max_size as the metadata cache did.
2026-11-10 11:56:20 +00:00
Andrew Nesbitt
c419f828e0
Merge pull request #683 from simonchrz/chore/review-followups
Pick up the follow-ups from the #676 and #680 reviews
2026-11-10 11:36:42 +00:00
simon chrzanowski
2076e65210
Merge pull request #697 from montehurd/npm-profile-packument-format
Keep npm packuments in one format across cooldown profiles
2026-11-10 09:23:44 +01:00
simon chrzanowski
9e647ca2e2
Merge pull request #696 from milas/milas/oci-head-fix
Serve HEAD requests from cache in direct serve mode
2026-11-10 09:18:33 +01:00
montehurd
0fd4b5a83f Keep npm packuments in one format across cooldown profiles
Cooldown profiles and the unprefixed URLs share a packument's cache row,
but each chose its format by its own policy: abbreviated without
cooldown, full with it. With cooldown on for only some of them, a request
without cooldown that revalidated the row stored the abbreviated
packument. The next request under cooldown rejected it and fetched the
full one again, even within metadata_ttl, and had no stale copy to serve
when the upstream failed.

Cooldown in the global policy or in any profile now makes all of them
request the full packument, as upstream.npm_full_metadata does. URLs
without cooldown are then served full packuments too.
2026-11-09 18:13:48 -08:00
Milas Bowman
8e6a87a068
fix(oci): serve HEAD requests from cache 2026-11-09 19:39:45 -05:00
Simon Chrzanowski
da6a5b4027 Read PyPI release times without building the whole document
With cooldown on, every simple index request and every download reads
the package's JSON API document for its upload times. It was decoded
into a generic map, which for a package like botocore (4.4 MB) allocated
about 17 MB per request, also when everything was cached. The times are
now decoded into a struct that names only that field, so the rest of
the document is skipped.
2026-11-09 22:45:10 +01:00
Simon Chrzanowski
b719035424 Write Arch databases with their own validators
Arch wrote databases and signatures with the validators of the cache row
read at write time, which may describe other bytes once another instance
rewrote it. Its results now carry validators: fetchedResult for a fetched
database, describedBy for a stored one, and stale on the fallback after an
upstream failure, which also marks it with metadata_ttl 0. Nothing calls
writeMetadataCachedResponseWithEncoding or lookupCachedMeta any more.
2026-11-09 11:57:39 +01:00
Simon Chrzanowski
f8a24fdeeb Merge remote-tracking branch 'origin/main' into fix/metadata-cache-consistency 2026-11-09 11:52:37 +01:00
Andrew Nesbitt
b6e71f4d7a
Merge pull request #684 from simonchrz/perf/jsonstream-jsontext
Read jsonstream objects with jsontext
2026-11-09 09:32:19 +00:00
Andrew Nesbitt
4d9c87bd4b
Merge pull request #678 from simonchrz/fix/cache-key-collisions
Fix cache key collisions in RPM, Maven and the git cache
2026-11-09 09:04:19 +00:00
Simon Chrzanowski
d7399b1043 Say which Maven files get the 404 without listing name rules 2026-11-08 22:51:25 +01:00
Simon Chrzanowski
4ae55605b1 Send Maven coordinate files under odd groups to the 404
A file named {artifact}-{version} under a dotted group directory, such as
org.foo/bar/1.0/bar-1.0-linux.exe, was not recognised as a coordinate file
and so was proxied past the checks. isCoordinateFile no longer checks the
group, so handleDownload answers 404 for it. The docs say which files get
the 404, and the Range test covers a stale If-Range.
2026-11-08 22:18:14 +01:00
Simon Chrzanowski
3776366ba2 Document the 404 for Maven files outside the layout 2026-11-08 21:58:47 +01:00
Simon Chrzanowski
b61e35205c Answer 404 for Maven files outside the layout
A file whose group directories hold a dot or colon was proxied without
caching, which skipped the denylist, scan and cooldown. Such paths aren't
in the Maven layout, so they now get 404. Directory listings and catalogs
still go through proxyUpstream, which shares its error handling with
Proxy.ProxyUpstream in relayUpstream.
2026-11-08 21:49:48 +01:00
Simon Chrzanowski
2ac80bf76b Merge remote-tracking branch 'origin/main' into fix/cache-key-collisions
# Conflicts:
#	internal/gitcache/cache_test.go
2026-11-08 21:47:56 +01:00
Andrew Nesbitt
1c9509d125
Merge pull request #679 from simonchrz/fix/missing-routes
Fix missing routes and protocol gaps
2026-11-08 19:57:38 +00:00
Andrew Nesbitt
488acbea11
Merge pull request #674 from simonchrz/feat/mirror-git-tags-submodules
Mirror pkg:git tags and submodules
2026-11-08 19:41:53 +00:00
Simon Chrzanowski
79a0ae2dd0 Read the row again when stale metadata bytes don't match it
The fallback served replaced bytes with the old row's content type and
encoding, so a blob swapped from identity to gzip went out without its
Content-Encoding. It now reads the row once more and serves the blob
under the row that describes it, and treats the copy as unusable if
none does yet.
2026-11-08 19:14:18 +01:00
Simon Chrzanowski
23316c04d2 Accept object keys with invalid UTF-8 in jsonstream
AppendUnquote reports invalid UTF-8 after replacing it, which failed the
whole copy although the decoder allows it. Key now holds U+FFFD in its
place, as with encoding/json and ScanPackument, and the key is still
written with its original bytes.
2026-11-08 19:12:30 +01:00
Simon Chrzanowski
0efe54fd73 Let the submodule test add a ':' path on Windows
Git for Windows refuses it with core.protectNTFS on.
2026-11-08 19:11:36 +01:00
Simon Chrzanowski
44afe6997a Read jsonstream objects with jsontext
CopyObject takes the reader and decodes it with jsontext, accepting
repeated names and invalid UTF-8 as encoding/json did. Keys are written
with the bytes they were read with instead of being re-encoded. Member
gets Skip, which reads past a value without keeping it, and npm's
RewriteStream skips dropped versions and duplicates with it.

conda-forge noarch repodata.json (195 MB): filtering 0.89 to 0.62 s and
379 to 77 MB allocated, the timestamp index 0.84 to 0.61 s. The next
packument (32 MB): RewriteStream 69 to 34 ms and 38 to 3.5 MB.
2026-11-08 19:03:21 +01:00
Simon Chrzanowski
a330d68564 Use strings.CutLast for .gitmodules keys
Go 1.27 is on main now.
2026-11-08 18:58:40 +01:00
Simon Chrzanowski
3fdbe51ad5 Merge remote-tracking branch 'origin/main' into feat/mirror-git-tags-submodules 2026-11-08 18:56:36 +01:00
Simon Chrzanowski
c2f0345e18 Pick up the follow-ups from the #676 and #680 reviews
The repeated dist-tags name in the jsontext test now has a different
first value, so the test checks that the last one counts. Comments
that repeat the code go, and the upload-pack paragraph states its
check rule once.
2026-11-08 18:56:24 +01:00
Simon Chrzanowski
8ec60f940d Merge remote-tracking branch 'origin/main' into fix/metadata-cache-consistency
# Conflicts:
#	internal/handler/handler.go
#	internal/handler/npm.go
2026-11-08 18:53:58 +01:00
Simon Chrzanowski
140b70233a Move the PyPI root index replacement loop into its own method 2026-11-08 18:51:46 +01:00
Simon Chrzanowski
2ecdcced4c Search again only for the replacement just made in the PyPI root index
Each match searched the rest of the buffer for every replacement. The
root index has no single-quoted links, so after every double-quoted one
the other pattern scanned to the end again, making each chunk quadratic
in its links. Each replacement's next match is now kept and only
searched for again once a replacement passes it (50,000 links: 18.6 to
818 MB/s).
2026-11-08 18:51:00 +01:00
Andrew Nesbitt
43bd67fc13
Merge pull request #681 from simonchrz/fix/cooldown-denylist-gaps
Fix cooldown and denylist gaps
2026-11-08 17:31:53 +00:00
Andrew Nesbitt
1b22f79be2
Fail the conda timestamp test when the index is empty 2026-11-08 17:23:11 +00:00
Andrew Nesbitt
0829eae376
List only the gitlinks .gitmodules names
ls-tree -r read every path in the commit to find a few submodules.
2026-11-08 17:19:03 +00:00
Andrew Nesbitt
fe11f51ed7
Merge pull request #680 from simonchrz/fix/git-cache-gaps
Close two gaps in the git cache
2026-11-08 17:14:20 +00:00
Andrew Nesbitt
53c0fd9c51
Merge pull request #676 from simonchrz/perf/npm-jsontext
Skip discarded npm packument values with jsontext
2026-11-08 17:02:31 +00:00
Andrew Nesbitt
91e53e0445
Merge pull request #677 from simonchrz/fix/config-validation
Reject config mistakes instead of silently ignoring them
2026-11-08 15:59:53 +00:00
Andrew Nesbitt
9fb3119b87
Merge pull request #672 from milas/milas/deb-caching
fix(debian): route packages by filename rather than `/pool` prefix
2026-11-08 15:55:01 +00:00
Simon Chrzanowski
da090443ec Forward Range to upstream for Maven paths proxied uncached
Paths proxied without caching sent no request headers, so a resumed
download got the whole file back instead of the requested bytes.
2026-11-08 12:19:19 +01:00
Simon Chrzanowski
a5f014d64c Check a cached release file against its row before using it
The release listing read the cached InRelease, Release or repomd.xml
without comparing it with the row's digest, so bytes another instance had
replaced could decide which index is served. Such a file is now ignored,
and the index falls back to its own cache entry.
2026-11-08 10:58:43 +01:00
Simon Chrzanowski
0ff118b642 Try the Plugin Portal for Maven paths proxied uncached
Paths the proxy doesn't cache, such as ones with a dotted group
directory, went to the primary upstream only, so a file available only on
the Gradle Plugin Portal returned 404. They now try the Plugin Portal on a
404, as cached files do.
2026-11-08 10:57:38 +01:00
Simon Chrzanowski
5c42a6dab1 Seed the metadata test row without unused parameters
Every caller seeds the same v1 document, which the linter flags.
2026-11-08 10:12:39 +01:00
Simon Chrzanowski
64eb09e674 Warn when mirror.refresh runs without cache_metadata
The docs say refreshing Debian, Alpine and RPM packages needs
cache_metadata, but nothing said so when it was off. Rejecting the
setting would also stop the refresh of every other ecosystem, so the
server logs a warning from the new Config.Warnings at startup.
2026-11-08 10:12:37 +01:00
Simon Chrzanowski
60c899f1df Treat calendar versions as one line in the refresh
A version's first number was taken as its major line, so certifi
2024.8.30 and tzdata 2024.2 never got the next year's release. A first
number of 1000 or more is a year, and all such versions are one line.
2026-11-08 10:12:37 +01:00
Simon Chrzanowski
85dd891879 Recover from a panic mirroring one refreshed version
Refresh called mirrorOne on the scheduler's goroutine without the
recover Run puts around each item, so a panic took the proxy down.
Both now go through mirrorRecovered, which counts it as a failure and
carries on.
2026-11-08 10:12:37 +01:00
Simon Chrzanowski
e598c8e44e Read refreshed index documents without recording an access
The refresh read InRelease, APKINDEX and repomd.xml again through the
metadata cache, which marked them accessed, so every suite looked
fetched within since and never aged out. Read them straight from
upstream, as the Packages and primary indexes already are.
2026-11-08 10:12:37 +01:00
Simon Chrzanowski
b1875040de Leave the refresh's own downloads out of the most used packages
A file the refresh mirrored was fetched just now and never accessed,
which counted as recent use, so the refresh kept every package it had
refreshed in the most used list forever. Fetches under the new
handler.MirrorFetch context set mirrored_at, and a file whose last fetch
was a mirror's counts only once a client downloads it.
2026-11-08 10:12:37 +01:00
Simon Chrzanowski
0ececf3ffa Find the Debian component in the security archive's pool
security.debian.org keeps files under pool/updates/main while its
InRelease lists main/binary-*, so taking the first segment after pool/
as the component found no index and security suites were never
refreshed. Take the first or second segment, whichever the release
file lists indexes for.
2026-11-08 10:12:37 +01:00
Simon Chrzanowski
6d80291d22 Warn when mirroring a cached tag after a failed refresh
A tag found in the cache after the refresh failed was reported as
mirrored with no sign it might be stale, though tags can move. Keep
serving it, as a cached commit is, but log a warning naming the tag,
the commit and the refresh error.
2026-11-08 10:11:36 +01:00
Simon Chrzanowski
fede2463f7 Describe conda shard timestamps as condaTime reads them 2026-11-08 10:10:43 +01:00