curl: Introduce concept of getting/putting handles from a common pool
Introduce the concept of a pool of curl handles from which the main
code has to take a handle (get_handle()), and later return it to the
pool (put_handle()). When a handle is taken from the pool it can be
used exclusively by the main code until it is returned.
The "pool" only has at most one handle, so this is actually a
pessimization from the situation before because all NBD connections
share a single curl handle. In a future commit we will add support
for multiple handles in the pool.
A note about the change to tests/test-retry-request-mirror.c: This
test depended implicitly on a new NBD connection opening a new libcurl
handle (this no longer happens), and when opening a new libcurl handle
that causes a HEAD request to be made. We have to adjust the test to
remove this assumption.