(PUP-744) Retrieve Net::HTTP objects from the current pool
Previously, the puppet connection owned a ruby http connection, and
could create it lazily in a number of different ways, e.g. #address.
If an HTTP request resulted in a redirect, the @connection instance
variable would be overwritten with a new ruby http object. This made
it difficult to reason about the lifecycle of ruby http objects.
The commit associates a site with each puppet connection. As a result
it is trivial to ask the puppet connection what its #address is and
do so without creating a ruby http object.
This commit also removes the @connection instance variable. Instead
connections are obtained from the pool for the duration of the request,
e.g. Connection#get.
The Connection#connection private method is retained for now, as a
number of tests rely on it, via send(:connection). Currently it
delegates to the factory to return a new connection, but will be deleted
in a future commit.
Finally, the redirect loop relied on a non-local jump. This exposed a
bug in the pool implementation, because the connection wasn't returned
to the pool. That bug was fixed in a preceding commit, but to ensure
these sorts of things don't happen in the future, this commit returns
the response outside of the with_connection block.