summaryrefslogtreecommitdiff
path: root/src/http.hpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-06-05 21:41:57 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2022-06-05 21:41:57 -0400
commit270730d9b36c8fc3a221da7e565632c1432d41c6 (patch)
treeed67d9fcec4df6287f3dd13cb997297d6af50ec8 /src/http.hpp
parent4ec5c1dfccaa5ce3bce5dc22a95e91d781262345 (diff)
downloadabaddon-portaudio-270730d9b36c8fc3a221da7e565632c1432d41c6.tar.gz
abaddon-portaudio-270730d9b36c8fc3a221da7e565632c1432d41c6.zip
start attachments (image paste and upload)
Diffstat (limited to 'src/http.hpp')
-rw-r--r--src/http.hpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/http.hpp b/src/http.hpp
index 4220a6e..0c570db 100644
--- a/src/http.hpp
+++ b/src/http.hpp
@@ -1,4 +1,5 @@
#pragma once
+#include <array>
#include <string>
#include <curl/curl.h>
@@ -98,13 +99,24 @@ struct response {
struct request {
request(EMethod method, std::string url);
+ request(request &&other) noexcept;
~request();
+ request(const request &) = delete;
+ request &operator=(const request &) = delete;
+ request &operator=(request &&) noexcept = delete;
+
+ const std::string &get_url() const;
+ const char *get_method() const;
+
void set_verify_ssl(bool verify);
void set_proxy(const std::string &proxy);
void set_header(const std::string &name, const std::string &value);
void set_body(const std::string &data);
void set_user_agent(const std::string &data);
+ void make_form();
+ void add_file(std::string_view name, std::string_view file_path, std::string_view filename);
+ void add_field(std::string_view name, const char *data, size_t size);
response execute();
@@ -115,7 +127,8 @@ private:
std::string m_url;
const char *m_method;
curl_slist *m_header_list = nullptr;
- char m_error_buf[CURL_ERROR_SIZE] = { 0 };
+ std::array<char, CURL_ERROR_SIZE> m_error_buf = { 0 };
+ curl_mime *m_form = nullptr;
};
using response_type = response;