7 #ifndef PACKAGER_FILE_HTTP_H_
8 #define PACKAGER_FILE_HTTP_H_
13 #include <absl/synchronization/notification.h>
15 #include <packager/file.h>
16 #include <packager/file/io_cache.h>
23 enum class HttpMethod {
41 HttpFile(HttpMethod method,
const std::string& url);
43 const std::string& url,
44 const std::string& upload_content_type,
45 const std::vector<std::string>& headers,
46 int32_t timeout_in_seconds);
51 static bool Delete(
const std::string& url);
53 Status CloseWithStatus();
57 bool Close()
override;
58 int64_t Read(
void* buffer, uint64_t length)
override;
59 int64_t Write(
const void* buffer, uint64_t length)
override;
60 void CloseForWriting()
override;
61 int64_t Size()
override;
62 bool Flush()
override;
63 bool Seek(uint64_t position)
override;
64 bool Tell(uint64_t* position)
override;
73 void operator()(CURL* curl);
74 void operator()(curl_slist* headers);
80 const std::string url_;
81 const std::string upload_content_type_;
82 const int32_t timeout_in_seconds_;
83 const HttpMethod method_;
87 std::unique_ptr<CURL, CurlDelete> curl_;
89 std::unique_ptr<curl_slist, CurlDelete> request_headers_;
91 std::string user_agent_;
93 std::string client_cert_file_;
94 std::string client_cert_private_key_file_;
95 std::string client_cert_private_key_password_;
98 absl::Notification task_exit_event_;
Declaration of class which implements a thread-safe circular buffer.
All the methods that are virtual are virtual for mocking.