added read-url
This commit is contained in:
32
clib/sslclient.h
Normal file
32
clib/sslclient.h
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
class HttpClient {
|
||||
// TODO at this moment only https is implemented
|
||||
|
||||
private:
|
||||
SSL *ssl;
|
||||
int sock;
|
||||
|
||||
std::string full_url, proto, server, port, uri, params, href;
|
||||
std::basic_string<char> ssl_read_packet;
|
||||
std::unordered_map<std::string, std::string> headers_map;
|
||||
|
||||
public:
|
||||
HttpClient();
|
||||
|
||||
std::pair<int, std::string> doGetRequest(const std::string &url, const std::unordered_map<std::string, std::string> &headers);
|
||||
|
||||
private:
|
||||
std::string inetAddress(std::string hostname);
|
||||
|
||||
int sslRecvPacket();
|
||||
int sslSendPacket(std::string buf);
|
||||
int sslRequest(const std::string &server_name, const std::string &request);
|
||||
void log_ssl();
|
||||
};
|
||||
Reference in New Issue
Block a user