HomePhorge

(maint) Update comment about request_* methods
6c55f762f938Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(maint) Update comment about request_* methods

The puppet connection class has request_get, etc methods that accept a
block. I tried to deprecate them, to eliminate the possibility that a
caller could borrow a connection from the pool indefinitely.

However, I found that we have to pass a block to ruby's request method
in order to stream the response body. If you don't pass a block, ruby
will always read the entire response body into memory. If you later
try to stream the body:

response.read_body { |chunk| yield uncompressor.uncompress(chunk) } }

It will fail with:

Net::HTTPOK#read_body called twice

This commit updates the comment so it's clear why these other
request_methods exist.

Details

Provenance
Josh Cooper <josh@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUbf71bff46e85: (maint) Add setting to write http debug out to stderr
Branches
Unknown
Tags
Unknown

Event Timeline

Josh Cooper <josh@puppetlabs.com> committed rPU6c55f762f938: (maint) Update comment about request_* methods (authored by Josh Cooper <josh@puppetlabs.com>).Jul 25 2014, 6:36 PM