MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / AsyncHttpClient

Class AsyncHttpClient

lib/AsyncHttpClient/src/AsyncHttpClient.h:71–662  ·  view source on GitHub ↗

* Asynchronous HTTP client * * Used RFCs: * - RFC2616 (obsolete, because of RFC7230) * - RFC7230 */

Source from the content-addressed store, hash-verified

69 * - RFC7230
70 */
71class AsyncHttpClient
72{
73public:
74
75 /**
76 * Prototype of HTTP response callback for a complete received response.
77 */
78 typedef std::function<void(const HttpResponse& rsp)> OnResponse;
79
80 /**
81 * Prototype of HTTP response callback for a closed connection.
82 */
83 typedef std::function<void()> OnClosed;
84
85 /**
86 * Prototype of HTTP response callback in case a error happened.
87 */
88 typedef std::function<void()> OnError;
89
90 /**
91 * Constructs a http client.
92 */
93 AsyncHttpClient();
94
95 /**
96 * Destroys the http client instance.
97 */
98 ~AsyncHttpClient();
99
100 /**
101 * Parse all necessary parameters from URL and prepare for sending requests.
102 * Note, calling this will clear user defined headers and URL encoded parameters.
103 *
104 * @param[in] url URL
105 *
106 * @return If successful parsed, it will return true otherwise false.
107 */
108 bool begin(const String& url);
109
110 /**
111 * Disconnect and clear all parameters.
112 */
113 void end();
114
115 /**
116 * Is connection established?
117 *
118 * @return If connection is established, it will return true otherwise false.
119 */
120 bool isConnected();
121
122 /**
123 * Use HTTP/1.0 instead of HTTP/1.1
124 *
125 * @param[in] useHttp10 Use HTTP/1.0 (true) or HTTP/1.1 (false)
126 */
127 void setHttpVersion(bool useHttp10);
128

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected