19 #include <curlpp/Easy.hpp>
20 #include <curlpp/Options.hpp>
26 enum class Method { kGet, kHead, kPost, kPut, kDelete };
29 constexpr
const char* MethodToString(Method& method)
throw() {
42 std::cerr <<
"ABORT: Unimplemented HTTP method. This should not happen."
51 std::string ExtractRegion(std::string host);
56 unsigned int port = 0;
58 bool aws_host =
false;
59 bool accelerate_host =
false;
60 bool dualstack_host =
false;
61 bool virtual_style =
false;
64 std::string GetHostHeaderValue();
67 std::string bucket_name =
"",
68 std::string object_name =
"");
69 operator bool()
const {
return !host.empty(); }
79 curlpp::Easy* handle = NULL;
84 void* user_arg = NULL;
91 std::string_view body =
"";
92 DataCallback data_callback = NULL;
93 void* user_arg = NULL;
95 bool ignore_cert_check =
false;
99 operator bool()
const {
100 if (method < Method::kGet || method > Method::kDelete)
return false;
110 DataCallback data_callback = NULL;
111 void* user_arg = NULL;
116 size_t ResponseCallback(curlpp::Easy* handle,
char* buffer,
size_t size,
118 operator bool()
const {
119 return error.empty() && status_code >= 200 && status_code <= 299;
123 std::string response_;
124 bool continue100_ =
false;
125 bool status_code_read_ =
false;
126 bool headers_read_ =
false;
128 size_t ReadStatusCode(
char* buffer,
size_t size,
size_t length);
129 size_t ReadHeaders(curlpp::Easy* handle,
char* buffer,
size_t size,