rubygems icon indicating copy to clipboard operation
rubygems copied to clipboard

Pass headers down instead of using a block

Open tenderlove opened this issue 6 months ago • 2 comments

Right now we are buffering entire gems in memory when we download them.

  • https://github.com/rubygems/rubygems/blob/66c94f65c8a05484f2d12cb0bccd8513da5c65ef/lib/rubygems/request.rb#L208-L216

I would like to open the possibility of streaming assets rather than storing the entire asset in memory. In order to accomplish this, I would like to allow callers to pass a block to indicate that they "want to stream".

Before this commit, we would use the block to set headers on the request object. This commit passes the headers down to construct the request object. Callers know the headers they want to set before calling the method, so it makes sense to pass them in via parameters rather than as a block

tenderlove avatar Oct 16 '25 17:10 tenderlove

I think we'll need to modify this one too https://github.com/ruby/rubygems/blob/48272fb44a2c0f298beef0cf463b05d7bc7356e9/bundler/lib/bundler/fetcher/gem_remote_fetcher.rb#L8-L11

Edouard-chin avatar Oct 17 '25 16:10 Edouard-chin

I believe this method will also need updating

https://github.com/ruby/rubygems/blob/da4a28903b84698c62c32a99dcb39e2b3669fdb6/lib/rubygems/gemcutter_utilities.rb#L249-L258

colby-swandale avatar Oct 24 '25 06:10 colby-swandale