7 #ifndef PACKAGER_FILE_HTTP_H_
8 #define PACKAGER_FILE_HTTP_H_
13 #include "packager/base/synchronization/waitable_event.h"
14 #include "packager/file/file.h"
15 #include "packager/file/io_cache.h"
16 #include "packager/status.h"
23 enum class HttpMethod {
40 HttpFile(HttpMethod method,
const std::string& url);
42 const std::string& url,
43 const std::string& upload_content_type,
44 const std::vector<std::string>& headers,
45 uint32_t timeout_in_seconds);
54 bool Close()
override;
55 int64_t
Read(
void* buffer, uint64_t length)
override;
56 int64_t
Write(
const void* buffer, uint64_t length)
override;
57 int64_t
Size()
override;
58 bool Flush()
override;
59 bool Seek(uint64_t position)
override;
60 bool Tell(uint64_t* position)
override;
69 void operator()(CURL* curl);
70 void operator()(curl_slist* headers);
76 const std::string url_;
77 const std::string upload_content_type_;
78 const uint32_t timeout_in_seconds_;
79 const HttpMethod method_;
82 std::unique_ptr<CURL, CurlDelete> curl_;
84 std::unique_ptr<curl_slist, CurlDelete> request_headers_;
88 base::WaitableEvent task_exit_event_;
Define an abstract file interface.
bool Seek(uint64_t position) override
bool Open() override
Internal open. Should not be used directly.
int64_t Write(const void *buffer, uint64_t length) override
int64_t Read(void *buffer, uint64_t length) override
bool Tell(uint64_t *position) override
Declaration of class which implements a thread-safe circular buffer.
All the methods that are virtual are virtual for mocking.