From 40e0f8f5d8c3e480f01a2d71b6a493247adcb77f Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 21 Sep 2020 03:49:17 +0200 Subject: Initial matrix support --- src/DownloadUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/DownloadUtils.cpp') diff --git a/src/DownloadUtils.cpp b/src/DownloadUtils.cpp index deb5c29..b7636d8 100644 --- a/src/DownloadUtils.cpp +++ b/src/DownloadUtils.cpp @@ -21,7 +21,7 @@ namespace QuickMedia { std::vector args; if(use_tor) args.push_back("torsocks"); - args.insert(args.end(), { "curl", "-f", "-H", "Accept-Language: en-US,en;q=0.5", "--compressed", "-s", "-L" }); + args.insert(args.end(), { "curl", "-f", "-H", "Accept-Language: en-US,en;q=0.5", "-H", "Connection: keep-alive", "--compressed", "-s", "-L" }); for(const CommandArg &arg : additional_args) { args.push_back(arg.option.c_str()); args.push_back(arg.value.c_str()); @@ -49,7 +49,6 @@ namespace QuickMedia { DownloadResult download_to_string_cache(const std::string &url, std::string &result, const std::vector &additional_args, bool use_tor, bool use_browser_useragent) { Path media_dir = get_cache_dir().join("media"); Path media_file_path = Path(media_dir).join(base64_url::encode(url)); - Path media_file_path_tmp(media_file_path.data + ".tmp"); if(get_file_type(media_file_path) == FileType::REGULAR) { if(file_get_content(media_file_path, result) == 0) { fprintf(stderr, "Loaded %s from cache\n", url.c_str()); @@ -61,6 +60,7 @@ namespace QuickMedia { } else { DownloadResult download_result = download_to_string(url, result, additional_args, use_tor, use_browser_useragent); if(download_result == DownloadResult::OK) { + Path media_file_path_tmp(media_file_path.data + ".tmp"); if(create_directory_recursive(media_dir) == 0 && file_overwrite(media_file_path_tmp, result) == 0) { if(rename(media_file_path_tmp.data.c_str(), media_file_path.data.c_str()) != 0) { perror("rename"); -- cgit v1.2.3