Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
HTTPSClient.h
00001 #ifndef HTTPSCLIENT_H 00002 #define HTTPSCLIENT_H 00003 00004 #include "Socket/Socket.h" 00005 #include "Socket/Endpoint.h" 00006 #include "axTLS/ssl/ssl.h" 00007 #include "HTTPHeader.h" 00008 00009 /** 00010 TCP socket connection 00011 */ 00012 class HTTPSClient : public Socket, public Endpoint { 00013 00014 public: 00015 /** TCP socket connection 00016 */ 00017 HTTPSClient(); 00018 00019 00020 virtual ~HTTPSClient(); 00021 00022 /** Connects this TCP socket to the server 00023 \param host The host to connect to. It can either be an IP Address or a hostname that will be resolved with DNS. 00024 \param port The host's port to connect to. 00025 \return 0 on success, -1 on failure. 00026 */ 00027 int connect(const char* host); 00028 00029 /** Check if the socket is connected 00030 \return true if connected, false otherwise. 00031 */ 00032 bool is_connected(void); 00033 00034 // Returns the size of the body 00035 HTTPHeader get(char *path); 00036 00037 int read(char *data, int len); 00038 00039 00040 void close(); 00041 00042 private: 00043 00044 00045 int send(char* data, int length); 00046 00047 uint8_t read_line(); 00048 HTTPHeader read_header(); 00049 00050 bool _is_connected; 00051 SSL_CTX _ssl_ctx; 00052 SSL _ssl; 00053 std::string _host; 00054 }; 00055 00056 #endif
Generated on Tue Jul 12 2022 12:28:32 by
