From 523a7e60a7a3b9184fc3ab1d062a5c8534bc9ac8 Mon Sep 17 00:00:00 2001 From: Edward Date: Thu, 15 Jun 2023 08:06:41 -0400 Subject: [PATCH] Make UpstreamSource intermediate specs from upstream As discovered in #336, the retirement of the v1 dependencies API revealed that UpstreamSource, when the dependencies API is unavailable, tells the client to go talk to rubygems directly for the spec files. This model does not work in general, because there is no guarantee that the client can access rubygems directly. This commit changes UpstreamSource to intermediate the connection --- lib/gemstash/gem_source/upstream_source.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/gemstash/gem_source/upstream_source.rb b/lib/gemstash/gem_source/upstream_source.rb index ce264bec..7e2b0ea7 100644 --- a/lib/gemstash/gem_source/upstream_source.rb +++ b/lib/gemstash/gem_source/upstream_source.rb @@ -128,6 +128,21 @@ def serve_gem(id) serve_cached(id, :gem) end + def serve_latest_specs + http_client = http_client_for(upstream) + http_client.get("latest_specs.4.8.gz") + end + + def serve_prerelease_specs + http_client = http_client_for(upstream) + http_client.get("prerelease_specs.4.8.gz") + end + + def serve_specs + http_client = http_client_for(upstream) + http_client.get("specs.4.8.gz") + end + private def serve_cached(id, resource_type)