mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-13 20:18:50 +03:00
start attachments (image paste and upload)
This commit is contained in:
15
src/http.hpp
15
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;
|
||||
|
||||
Reference in New Issue
Block a user