Skip to content

Conversation

@tenderlove
Copy link
Member

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

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

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
@Edouard-chin
Copy link
Contributor

I think we'll need to modify this one too

def request(*args)
super do |req|
req.delete("User-Agent") if headers["User-Agent"]
yield req if block_given?

@colby-swandale colby-swandale self-assigned this Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants