puppetlabs/puppet — pull request #251 by nicklewis (2011-12-07 21:47:19+00:00)
Title: Don't try to read the body of a file content response twice

Previously, get_file_from_source was calling Net::HTTP#request_get to
request file content, and yielding the response to
chunk_file_from_source, which would read the body. However, when called
without a block, request_get will read the body itself before returning
the response. This caused an error when chunk_file_from_source then
tried to read (and inflate if necessary) the body.

Now, get_file_from_source will pass its block along to request_get,
which will yield the unread response, rather than yielding the result of
request_get, which is a read response. This prevents a double read
error, and also allows us to properly inflate the body.

This fixes sourcing remote files.