Pass headers down instead of using a block
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
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
I believe this method will also need updating
https://github.com/ruby/rubygems/blob/da4a28903b84698c62c32a99dcb39e2b3669fdb6/lib/rubygems/gemcutter_utilities.rb#L249-L258