diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-07 04:48:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-07 04:48:35 +0000 |
commit | 207df6fc406e81bfeebdff7f404bd242ff3f099f (patch) | |
tree | a1a796b056909dd0a04ffec163db9363a8757808 /src/url_loader.hh | |
parent | Releasing progress-linux version 0.11.2-1~progress7.99u1. (diff) | |
download | lnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.tar.xz lnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.zip |
Merging upstream version 0.12.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/url_loader.hh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/url_loader.hh b/src/url_loader.hh index 799d1a2..bbe582f 100644 --- a/src/url_loader.hh +++ b/src/url_loader.hh @@ -37,20 +37,23 @@ # include <paths.h> # include "base/fs_util.hh" +# include "base/paths.hh" # include "curl_looper.hh" class url_loader : public curl_request { public: url_loader(const std::string& url) : curl_request(url) { - auto tmp_res = lnav::filesystem::open_temp_file( - ghc::filesystem::temp_directory_path() / "lnav.url.XXXXXX"); + std::error_code errc; + ghc::filesystem::create_directories(lnav::paths::workdir(), errc); + auto tmp_res = lnav::filesystem::open_temp_file(lnav::paths::workdir() + / "url.XXXXXX"); if (tmp_res.isErr()) { return; } auto tmp_pair = tmp_res.unwrap(); - ghc::filesystem::remove(tmp_pair.first); + this->ul_path = tmp_pair.first; this->ul_fd = std::move(tmp_pair.second); curl_easy_setopt(this->cr_handle, CURLOPT_URL, this->cr_name.c_str()); @@ -60,9 +63,7 @@ public: curl_easy_setopt(this->cr_handle, CURLOPT_BUFFERSIZE, 128L * 1024L); } - int get_fd() const { return this->ul_fd.get(); } - - auto_fd copy_fd() const { return this->ul_fd.dup(); } + ghc::filesystem::path get_path() const { return this->ul_path; } long complete(CURLcode result) { @@ -93,7 +94,8 @@ public: time(¤t_time); if (file_time == -1 - || (current_time - file_time) < FOLLOW_IF_MODIFIED_SINCE) { + || (current_time - file_time) < FOLLOW_IF_MODIFIED_SINCE) + { char range[64]; struct stat st; off_t start; @@ -142,6 +144,7 @@ private: return retval; } + ghc::filesystem::path ul_path; auto_fd ul_fd; off_t ul_resume_offset{0}; }; |