-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequest_tools.hpp
54 lines (38 loc) · 1002 Bytes
/
request_tools.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// Created by kouta on 4/6/21.
//
#ifndef VITANET_REQUEST_TOOLS_HPP
#define VITANET_REQUEST_TOOLS_HPP
void netInit();
void netTerm();
void httpInit();
void httpTerm();
struct curlResponse {
std::vector<char> body;
std::map<std::string, std::string> headers;
long responseCode;
};
class curlRequest {
std::vector<char> responseBody;
std::map<std::string, std::string> headerMap;
protected:
cURLpp::Easy easyHandle;
public:
curlRequest(std::string url);
virtual curlResponse performRequest();
};
class curlGetRequest : public curlRequest {
protected:
virtual void init();
public:
curlGetRequest(const std::string &url);
};
class curlPostRequest : public curlRequest {
protected:
virtual void init();;
public:
curlPostRequest(const std::string &url, const std::string &bodyContent);
};
curlResponse curlSendFile(std::string url, std::string bodyContent);
curlResponse curlDownloadFile(std::string url);
#endif //VITANET_REQUEST_TOOLS_HPP