File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -373,7 +373,7 @@ class File {
373373 return out;
374374 }
375375
376- ~File () {
376+ void close () {
377377 if (fd >= 0 ) {
378378# ifdef _WIN32
379379 if (hFile != INVALID_HANDLE_VALUE) {
@@ -388,6 +388,13 @@ class File {
388388 if (file) {
389389 fclose (file);
390390 }
391+
392+ fd = -1 ;
393+ file = nullptr ;
394+ }
395+
396+ ~File () {
397+ close ();
391398 }
392399
393400 private:
@@ -439,6 +446,8 @@ class HttpClient {
439446 return 1 ;
440447 }
441448 if (!output_file.empty ()) {
449+ // Explicitly close file in order to release lock
450+ out.close ();
442451 std::filesystem::rename (output_file_partial, output_file);
443452 }
444453
@@ -507,6 +516,9 @@ class HttpClient {
507516 curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L );
508517 curl_easy_setopt (curl, CURLOPT_DEFAULT_PROTOCOL, " https" );
509518 curl_easy_setopt (curl, CURLOPT_FAILONERROR, 1L );
519+ #ifdef _WIN32
520+ curl_easy_setopt (curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
521+ #endif
510522 return curl_easy_perform (curl);
511523 }
512524
You can’t perform that action at this time.
0 commit comments