-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp.cpp
More file actions
77 lines (56 loc) · 1.36 KB
/
http.cpp
File metadata and controls
77 lines (56 loc) · 1.36 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "stdafx.h"
namespace malware {
namespace http {
Http* __gpHttp = nullptr;
Http::Http() {
Init();
}
Http::~Http() {
UnInit();
}
void Http::Init() {
do {
if (CURLcode::CURLE_OK != curl_global_init(CURL_GLOBAL_WIN32 | CURL_VERSION_THREADSAFE))
break;
} while (0);
}
void Http::UnInit() {
curl_global_cleanup();
}
bool Http::Open() {
bool result = false;
do {
result = true;
} while (0);
return result;
}
void Http::Close() {
}
IRequest* Http::CreateRequest() {
IRequest* result = nullptr;
std::lock_guard<std::mutex> lock{ *m_Mutex };
do {
auto identify = GenerateIdentify();
auto request = std::make_shared<Request>(identify);
auto create = m_Requests.emplace(identify, request).first->second;
result = dynamic_cast<decltype(result)>(create.get());
} while (0);
return result;
}
bool Http::Perform(const IRequest*) {
bool result = false;
std::lock_guard<std::mutex> lock{ *m_Mutex };
do {
} while (0);
return result;
}
/// GenerateIdentify() is class private methods are not allowed to be locked.
TypeIdentify Http::GenerateIdentify() const {
TypeIdentify identify = 0;
do {
identify = shared::Win::Time::TimeStamp<std::chrono::microseconds>();
} while (0);
return identify;
}
}///namespace http
}///namespace malware