Added HttpsClient.
This commit is contained in:
parent
6812d22d63
commit
c823c54f9b
5 changed files with 272 additions and 20 deletions
|
@ -41,15 +41,22 @@ class String;
|
|||
class HttpClient : public HttpContext, public IDnsListener
|
||||
{
|
||||
public:
|
||||
HttpClient(const String &host, uint16_t port, int method, const String &url, IHttpListener *listener, const char *data = nullptr, size_t size = 0);
|
||||
~HttpClient();
|
||||
HttpClient(int method, const String &url, IHttpListener *listener, const char *data = nullptr, size_t size = 0);
|
||||
~HttpClient() override;
|
||||
|
||||
inline uint16_t port() const { return m_port; }
|
||||
|
||||
bool connect(const String &host, uint16_t port);
|
||||
const String &host() const;
|
||||
|
||||
protected:
|
||||
void onResolved(const Dns &dns, int status);
|
||||
void onResolved(const Dns &dns, int status) override;
|
||||
|
||||
virtual void handshake();
|
||||
virtual void read(const char *data, size_t size);
|
||||
virtual void write(const std::string &header);
|
||||
|
||||
private:
|
||||
void send();
|
||||
|
||||
static void onConnect(uv_connect_t *req, int status);
|
||||
|
||||
Dns *m_dns;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue