ssl client bit of work
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
|
||||
|
||||
class HttpClient {
|
||||
@@ -16,23 +17,30 @@ private:
|
||||
|
||||
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;
|
||||
std::map<std::string, std::string> headers_map;
|
||||
|
||||
public:
|
||||
HttpClient();
|
||||
HttpClient() = default;
|
||||
|
||||
std::pair<int, std::string>
|
||||
doGetRequest(const std::string &url, const std::unordered_map<std::string, std::string> &headers);
|
||||
std::pair<int, std::string> doRequest(const std::string &method, const std::string &url, const std::map<std::string, std::string> &headers, const std::string &request_body);
|
||||
|
||||
private:
|
||||
std::string inetAddress(std::string hostname);
|
||||
static std::string inetAddress(const std::string &hostname);
|
||||
|
||||
int sslRecvPacket();
|
||||
|
||||
int sslSendPacket(std::string buf);
|
||||
int sslSendPacket(const std::string &buf);
|
||||
|
||||
int sslRequest(const std::string &server_name, const std::string &request);
|
||||
|
||||
void log_ssl();
|
||||
void ShowCerts(SSL* ssl);
|
||||
static void logSSL();
|
||||
static void showCerts(SSL* ssl);
|
||||
|
||||
void parseURL(const std::string &url);
|
||||
|
||||
[[nodiscard]] static std::string createRequestHeaders(const std::map<std::string, std::string> &headers) ;
|
||||
|
||||
int responseStatusCode(const std::string &status_str) const;
|
||||
|
||||
void responseHeaders(const std::string &hdr);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user