HomePhorge

Don't try to read the body of a file content response twice
803e92f38aa9Unpublished

Unpublished Commit · Learn More

Repository Importing: This repository is still importing.

Description

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.

Details

Provenance
Nick Lewis <nick@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU814323ec3175: Merge remote-tracking branch 'daniel-pittman/feature/master/9508-auth-any…
Branches
Unknown
Tags
Unknown

Event Timeline

Nick Lewis <nick@puppetlabs.com> committed rPU803e92f38aa9: Don't try to read the body of a file content response twice (authored by Nick Lewis <nick@puppetlabs.com>).Dec 8 2011, 8:11 PM