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.
Diff: source/https_request.h
- Revision:
- 36:d46da03715db
- Parent:
- 32:fa4d71265625
- Child:
- 37:98d83ca14b7b
--- a/source/https_request.h Fri Aug 09 09:58:57 2019 +0200
+++ b/source/https_request.h Fri Aug 09 10:36:07 2019 +0200
@@ -87,6 +87,60 @@
_we_created_socket = false;
}
+ /**
+ * HttpsRequest Constructor
+ * Initializes the TCP socket, sets up event handlers and flags.
+ *
+ * @param[in] network The network interface
+ * @param[in] ssl_ca_pem String containing the trusted CAs
+ * @param[in] method HTTP method to use
+ * @param[in] url Parsed URL
+ * @param[in] body_callback Callback on which to retrieve chunks of the response body.
+ If not set, the complete body will be allocated on the HttpResponse object,
+ which might use lots of memory.
+ */
+ HttpsRequest(NetworkInterface* network,
+ const char* ssl_ca_pem,
+ http_method method,
+ ParsedUrl* url,
+ Callback<void(const char *at, uint32_t length)> body_callback = 0)
+ : HttpRequestBase(NULL, body_callback)
+ {
+ _parsed_url = url;
+ _request_builder = new HttpRequestBuilder(method, _parsed_url);
+ _response = NULL;
+
+ _socket = new TLSSocket();
+ ((TLSSocket*)_socket)->open(network);
+ ((TLSSocket*)_socket)->set_root_ca_cert(ssl_ca_pem);
+ _we_created_socket = true;
+ }
+
+ /**
+ * HttpsRequest Constructor
+ * Sets up event handlers and flags.
+ *
+ * @param[in] socket A connected TLSSocket
+ * @param[in] method HTTP method to use
+ * @param[in] url Parsed URL
+ * @param[in] body_callback Callback on which to retrieve chunks of the response body.
+ If not set, the complete body will be allocated on the HttpResponse object,
+ which might use lots of memory.
+ */
+ HttpsRequest(TLSSocket* socket,
+ http_method method,
+ ParsedUrl* url,
+ Callback<void(const char *at, uint32_t length)> body_callback = 0)
+ : HttpRequestBase(socket, body_callback)
+ {
+ _parsed_url = url;
+ _body_callback = body_callback;
+ _request_builder = new HttpRequestBuilder(method, _parsed_url);
+ _response = NULL;
+
+ _we_created_socket = false;
+ }
+
virtual ~HttpsRequest() {}
protected: