@@ -49,8 +49,8 @@ namespace snapshots
4949 // Make initial request, which returns a redirect response to specific
5050 // snapshot
5151 std::string snapshot_url;
52+ ccf::curl::UniqueCURL curl_easy;
5253 {
53- ccf::curl::UniqueCURL curl_easy;
5454 curl_easy.set_opt (CURLOPT_CAINFO , path_to_peer_cert.c_str ());
5555
5656 auto initial_url = fmt::format (
@@ -106,12 +106,12 @@ namespace snapshots
106106
107107 snapshot_url =
108108 fmt::format (" https://{}{}" , peer_address, location_it->second );
109+ curl_easy = std::move (request.get_easy_handle_ptr ());
109110 }
110111
111112 // Make follow-up request to redirected URL, to fetch total content size
112113 size_t content_size = 0 ;
113114 {
114- ccf::curl::UniqueCURL curl_easy;
115115 curl_easy.set_opt (CURLOPT_CAINFO , path_to_peer_cert.c_str ());
116116
117117 ccf::curl::UniqueSlist headers;
@@ -174,6 +174,7 @@ namespace snapshots
174174 snapshot_size_request.get_url (),
175175 ec));
176176 }
177+ curl_easy = std::move (snapshot_size_request.get_easy_handle_ptr ());
177178 }
178179
179180 // Fetch 4MB chunks at a time
@@ -192,7 +193,6 @@ namespace snapshots
192193
193194 while (true )
194195 {
195- ccf::curl::UniqueCURL curl_easy;
196196 curl_easy.set_opt (CURLOPT_CAINFO , path_to_peer_cert.c_str ());
197197
198198 ccf::curl::UniqueSlist headers;
@@ -236,6 +236,7 @@ namespace snapshots
236236
237237 snapshot_response =
238238 std::move (snapshot_range_request.get_response_ptr ());
239+ curl_easy = std::move (snapshot_range_request.get_easy_handle_ptr ());
239240
240241 if (range_end == content_size)
241242 {
0 commit comments