diff --git a/_http_request_8h_source.html b/_http_request_8h_source.html index 77d83c610..3075c8c0d 100644 --- a/_http_request_8h_source.html +++ b/_http_request_8h_source.html @@ -121,290 +121,294 @@
62  void end() override {
63  if (connected()) {
64  // write final 0 chunk if necessary
-
65  if (is_chunked_output_active) client_ptr->println(0, HEX);
-
66  client_ptr->flush();
-
67  LOGI("stop");
-
68  client_ptr->stop();
-
69  }
-
70  }
-
71 
-
72  virtual void stop() {
-
73  end();
+
65  if (is_chunked_output_active) {
+
66  client_ptr->println(0, HEX);
+
67  client_ptr->println();
+
68  client_ptr->flush();
+
69  is_chunked_output_active = false;
+
70  }
+
71  LOGI("stop");
+
72  client_ptr->stop();
+
73  }
74  }
75 
-
77  virtual int post(Url &url, const char *mime, const char *data, int len = -1) {
-
78  LOGI("post %s", url.url());
-
79  return process(POST, url, mime, data, len);
-
80  }
-
81 
-
83  virtual int post(Url &url, const char *mime, Stream &data, int len = -1) {
-
84  LOGI("post %s", url.url());
-
85  return process(POST, url, mime, data, len);
-
86  }
-
87 
-
89  virtual int put(Url &url, const char *mime, const char *data, int len = -1) {
-
90  LOGI("put %s", url.url());
-
91  return process(PUT, url, mime, data, len);
-
92  }
-
93 
-
95  virtual int put(Url &url, const char *mime, Stream &data, int len = -1) {
-
96  LOGI("put %s", url.url());
-
97  return process(PUT, url, mime, data, len);
-
98  }
-
99 
-
101  virtual int del(Url &url, const char *mime = nullptr,
-
102  const char *data = nullptr, int len = -1) {
-
103  LOGI("del %s", url.url());
-
104  return process(DELETE, url, mime, data, len);
-
105  }
-
106 
-
108  virtual int get(Url &url, const char *acceptMime = nullptr,
-
109  const char *data = nullptr, int len = -1) {
-
110  LOGI("get %s", url.url());
-
111  this->accept = acceptMime;
-
112  return process(GET, url, nullptr, data, len);
-
113  }
-
114 
-
116  virtual int head(Url &url, const char *acceptMime = nullptr,
-
117  const char *data = nullptr, int len = -1) {
-
118  LOGI("head %s", url.url());
-
119  this->accept = acceptMime;
-
120  return process(HEAD, url, nullptr, data, len);
-
121  }
-
122 
-
123  // reads the reply data
-
124  virtual int read(uint8_t *str, int len) {
-
125  TRACED();
-
126  if (reply_header.isChunked()) {
-
127  return chunk_reader.read(*client_ptr, str, len);
-
128  } else {
-
129  return client_ptr->read(str, len);
-
130  }
-
131  }
-
132 
-
133  size_t readBytes(uint8_t *str, size_t len) override {
-
134  return read(str, len);
+
76  virtual void stop() {
+
77  end();
+
78  }
+
79 
+
81  virtual int post(Url &url, const char *mime, const char *data, int len = -1) {
+
82  LOGI("post %s", url.url());
+
83  return process(POST, url, mime, data, len);
+
84  }
+
85 
+
87  virtual int post(Url &url, const char *mime, Stream &data, int len = -1) {
+
88  LOGI("post %s", url.url());
+
89  return process(POST, url, mime, data, len);
+
90  }
+
91 
+
93  virtual int put(Url &url, const char *mime, const char *data, int len = -1) {
+
94  LOGI("put %s", url.url());
+
95  return process(PUT, url, mime, data, len);
+
96  }
+
97 
+
99  virtual int put(Url &url, const char *mime, Stream &data, int len = -1) {
+
100  LOGI("put %s", url.url());
+
101  return process(PUT, url, mime, data, len);
+
102  }
+
103 
+
105  virtual int del(Url &url, const char *mime = nullptr,
+
106  const char *data = nullptr, int len = -1) {
+
107  LOGI("del %s", url.url());
+
108  return process(DELETE, url, mime, data, len);
+
109  }
+
110 
+
112  virtual int get(Url &url, const char *acceptMime = nullptr,
+
113  const char *data = nullptr, int len = -1) {
+
114  LOGI("get %s", url.url());
+
115  this->accept = acceptMime;
+
116  return process(GET, url, nullptr, data, len);
+
117  }
+
118 
+
120  virtual int head(Url &url, const char *acceptMime = nullptr,
+
121  const char *data = nullptr, int len = -1) {
+
122  LOGI("head %s", url.url());
+
123  this->accept = acceptMime;
+
124  return process(HEAD, url, nullptr, data, len);
+
125  }
+
126 
+
127  // reads the reply data
+
128  virtual int read(uint8_t *str, int len) {
+
129  TRACED();
+
130  if (reply_header.isChunked()) {
+
131  return chunk_reader.read(*client_ptr, str, len);
+
132  } else {
+
133  return client_ptr->read(str, len);
+
134  }
135  }
136 
-
137  size_t readBytesUntil(char terminator, char *buffer, size_t length) {
-
138  TRACED();
-
139  return client_ptr->readBytesUntil(terminator, buffer, length);
-
140  }
-
141 
-
142  // read the reply data up to the next new line. For Chunked data we provide
-
143  // the full chunk!
-
144  virtual int readln(uint8_t *str, int len, bool incl_nl = true) {
-
145  TRACED();
-
146  if (reply_header.isChunked()) {
-
147  return chunk_reader.readln(*client_ptr, str, len);
-
148  } else {
-
149  return chunk_reader.readlnInternal(*client_ptr, str, len, incl_nl);
-
150  }
-
151  }
-
152 
-
153  // provides the head information of the reply
-
154  virtual HttpReplyHeader &reply() { return reply_header; }
-
155 
-
157  virtual HttpRequestHeader &header() { return request_header; }
-
158 
-
160  virtual void setAgent(const char *agent) { this->agent = agent; }
-
161 
-
162  virtual void setConnection(const char *connection) {
-
163  this->connection = connection;
-
164  }
+
137  size_t readBytes(uint8_t *str, size_t len) override {
+
138  return read(str, len);
+
139  }
+
140 
+
141  size_t readBytesUntil(char terminator, char *buffer, size_t length) {
+
142  TRACED();
+
143  return client_ptr->readBytesUntil(terminator, buffer, length);
+
144  }
+
145 
+
146  // read the reply data up to the next new line. For Chunked data we provide
+
147  // the full chunk!
+
148  virtual int readln(uint8_t *str, int len, bool incl_nl = true) {
+
149  TRACED();
+
150  if (reply_header.isChunked()) {
+
151  return chunk_reader.readln(*client_ptr, str, len);
+
152  } else {
+
153  return chunk_reader.readlnInternal(*client_ptr, str, len, incl_nl);
+
154  }
+
155  }
+
156 
+
157  // provides the head information of the reply
+
158  virtual HttpReplyHeader &reply() { return reply_header; }
+
159 
+
161  virtual HttpRequestHeader &header() { return request_header; }
+
162 
+
164  virtual void setAgent(const char *agent) { this->agent = agent; }
165 
-
166  virtual void setAcceptsEncoding(const char *enc) {
-
167  this->accept_encoding = enc;
+
166  virtual void setConnection(const char *connection) {
+
167  this->connection = connection;
168  }
169 
-
170  virtual void setAcceptMime(const char *mime) { this->accept = mime; }
-
171 
-
172  size_t contentLength() {
-
173  const char *len_str = reply().get(CONTENT_LENGTH);
-
174  int len = 0;
-
175  if (len_str != nullptr) {
-
176  len = atoi(len_str);
-
177  } else {
-
178  LOGI("no CONTENT_LENGTH found in reply");
-
179  }
-
180  return len;
-
181  }
-
182 
-
185  bool isReady() { return is_ready; }
+
170  virtual void setAcceptsEncoding(const char *enc) {
+
171  this->accept_encoding = enc;
+
172  }
+
173 
+
174  virtual void setAcceptMime(const char *mime) { this->accept = mime; }
+
175 
+
176  size_t contentLength() {
+
177  const char *len_str = reply().get(CONTENT_LENGTH);
+
178  int len = 0;
+
179  if (len_str != nullptr) {
+
180  len = atoi(len_str);
+
181  } else {
+
182  LOGI("no CONTENT_LENGTH found in reply");
+
183  }
+
184  return len;
+
185  }
186 
-
188  void addRequestHeader(const char *header, const char *value) {
-
189  request_header.put(header, value);
-
190  }
-
191 
-
192  Client &client() { return *client_ptr; }
-
193 
-
194  // process http request and reads the reply_header from the server
-
195  virtual int process(MethodID action, Url &url, const char *mime,
-
196  const char *data, int lenData = -1) {
-
197  int len = lenData;
-
198  if (data != nullptr && len <= 0) {
-
199  len = strlen(data);
-
200  }
-
201  processBegin(action, url, mime, len);
-
202  // posting data parameter
-
203  if (len > 0 && data != nullptr) {
-
204  LOGI("Writing data: %d bytes", len);
-
205  client_ptr->write((const uint8_t *)data, len);
-
206  LOGD("%s", data);
-
207  }
-
208  return processEnd();
-
209  }
-
210 
-
211  // process http request and reads the reply_header from the server
-
212  virtual int process(MethodID action, Url &url, const char *mime,
-
213  Stream &stream, int len = -1) {
-
214  if (!processBegin(action, url, mime, len))
-
215  return -1;
-
216  processWrite(stream);
-
217  return processEnd();
-
218  }
-
219 
-
221  virtual bool processBegin(MethodID action, Url &url, const char *mime,
-
222  int lenData = -1) {
-
223  TRACED();
-
224  int len = lenData;
-
225  is_ready = false;
-
226  if (client_ptr == nullptr) {
-
227  LOGE("The client has not been defined");
-
228  return false;
-
229  }
-
230  if (http_connect_callback) {
-
231  http_connect_callback(*this, url, request_header);
-
232  }
-
233  if (!this->connected()) {
-
234  LOGI("process connecting to host %s port %d", url.host(), url.port());
-
235  int is_connected = connect(url.host(), url.port(), clientTimeout);
-
236  if (!is_connected) {
-
237  LOGE("Connect failed");
-
238  return false;
-
239  }
-
240  } else {
-
241  LOGI("process is already connected");
-
242  }
-
243 
-
244 #if defined(ESP32) && defined(ARDUINO)
-
245  LOGI("Free heap: %u", (unsigned)ESP.getFreeHeap());
-
246 #endif
+
189  bool isReady() { return is_ready; }
+
190 
+
192  void addRequestHeader(const char *header, const char *value) {
+
193  request_header.put(header, value);
+
194  }
+
195 
+
196  Client &client() { return *client_ptr; }
+
197 
+
198  // process http request and reads the reply_header from the server
+
199  virtual int process(MethodID action, Url &url, const char *mime,
+
200  const char *data, int lenData = -1) {
+
201  int len = lenData;
+
202  if (data != nullptr && len <= 0) {
+
203  len = strlen(data);
+
204  }
+
205  processBegin(action, url, mime, len);
+
206  // posting data parameter
+
207  if (len > 0 && data != nullptr) {
+
208  LOGI("Writing data: %d bytes", len);
+
209  client_ptr->write((const uint8_t *)data, len);
+
210  LOGD("%s", data);
+
211  }
+
212  return processEnd();
+
213  }
+
214 
+
215  // process http request and reads the reply_header from the server
+
216  virtual int process(MethodID action, Url &url, const char *mime,
+
217  Stream &stream, int len = -1) {
+
218  if (!processBegin(action, url, mime, len))
+
219  return -1;
+
220  processWrite(stream);
+
221  return processEnd();
+
222  }
+
223 
+
225  virtual bool processBegin(MethodID action, Url &url, const char *mime,
+
226  int lenData = -1) {
+
227  TRACED();
+
228  int len = lenData;
+
229  is_ready = false;
+
230  if (client_ptr == nullptr) {
+
231  LOGE("The client has not been defined");
+
232  return false;
+
233  }
+
234  if (http_connect_callback) {
+
235  http_connect_callback(*this, url, request_header);
+
236  }
+
237  if (!this->connected()) {
+
238  LOGI("process connecting to host %s port %d", url.host(), url.port());
+
239  int is_connected = connect(url.host(), url.port(), clientTimeout);
+
240  if (!is_connected) {
+
241  LOGE("Connect failed");
+
242  return false;
+
243  }
+
244  } else {
+
245  LOGI("process is already connected");
+
246  }
247 
-
248  reply_header.setProcessed();
-
249 
-
250  host_name = url.host();
-
251  request_header.setValues(action, url.path());
-
252  if (lenData > 0) {
-
253  request_header.put(CONTENT_LENGTH, lenData);
-
254  }
-
255  request_header.put(HOST_C, host_name);
-
256  request_header.put(CONNECTION, connection);
-
257  request_header.put(USER_AGENT, agent);
-
258  request_header.put(ACCEPT_ENCODING, accept_encoding);
-
259  request_header.put(ACCEPT, accept);
-
260  request_header.put(CONTENT_TYPE, mime);
-
261  request_header.write(*client_ptr);
-
262 
-
263  return true;
-
264  }
-
265 
-
267  virtual void processWrite(Stream &stream) {
-
268  uint8_t buffer[CHUNK_SIZE];
-
269  int total = 0;
-
270  int total_written = 0;
-
271  while (*client_ptr && stream.available() > 0) {
-
272  int result_len = stream.readBytes(buffer, CHUNK_SIZE);
-
273  total += result_len;
-
274  int written = write(buffer, result_len);
-
275  total_written += written;
-
276  LOGI("--> Bytes read %d vs written %d", result_len, written);
-
277  delay(1);
-
278  }
-
279  client_ptr->flush();
-
280  LOGI("Total bytes read %d vs written %d", total, total_written);
-
281  }
-
282 
-
285  size_t write(const uint8_t *data, size_t len) override {
-
286  TRACED();
-
287  size_t result = 0;
-
288  if (isChunked()) {
-
289  if (len > 0) {
-
290  is_chunked_output_active = true;
-
291  client_ptr->println(len, HEX);
-
292  result = client_ptr->write(data, len);
-
293  client_ptr->println();
-
294  }
-
295  } else {
-
296  result = client_ptr->write(data, len);
-
297  }
-
298  return result;
-
299  }
-
300 
-
302  virtual int processEnd() {
-
303  TRACED();
-
304  // if sending is chunked we terminate with an empty chunk
-
305  if (isChunked()) {
-
306  if (is_chunked_output_active) client_ptr->println(0, HEX);
-
307  client_ptr->println();
-
308  is_chunked_output_active = false;
-
309  }
-
310  LOGI("Request written ... waiting for reply");
-
311  // Commented out because this breaks the RP2040 W
-
312  // client_ptr->flush();
-
313  reply_header.read(*client_ptr);
-
314 
-
315  // if we use chunked tranfer we need to read the first chunked length
-
316  if (reply_header.isChunked()) {
-
317  chunk_reader.open(*client_ptr);
-
318  };
-
319 
-
320  // wait for data
-
321  is_ready = true;
-
322  return reply_header.statusCode();
-
323  }
-
324 
-
326  void setOnConnectCallback(void (*callback)(
-
327  HttpRequest &request, Url &url, HttpRequestHeader &request_header)) {
-
328  http_connect_callback = callback;
-
329  }
-
330 
-
332  void setTimeout(int timeoutMs) { clientTimeout = timeoutMs; }
-
333 
-
335  bool isChunked() { return request_header.isChunked(); }
-
336 
-
337  protected:
-
338  Client *client_ptr = nullptr;
-
339  Url url;
-
340  HttpRequestHeader request_header;
-
341  HttpReplyHeader reply_header;
-
342  HttpChunkReader chunk_reader = HttpChunkReader(reply_header);
-
343  const char *agent = nullptr;
-
344  const char *host_name = nullptr;
-
345  const char *connection = CON_KEEP_ALIVE;
-
346  const char *accept = ACCEPT_ALL;
-
347  const char *accept_encoding = IDENTITY;
-
348  bool is_ready = false;
-
349  int32_t clientTimeout = URL_CLIENT_TIMEOUT; // 60000;
-
350  void (*http_connect_callback)(HttpRequest &request, Url &url,
-
351  HttpRequestHeader &request_header) = nullptr;
-
352  bool is_chunked_output_active = false;
-
353 
-
354  // opens a connection to the indicated host
-
355  virtual int connect(const char *ip, uint16_t port, int32_t timeout) {
-
356  TRACED();
-
357  client_ptr->setTimeout(timeout / 1000); // client timeout is in seconds!
-
358  request_header.setTimeout(timeout);
-
359  reply_header.setTimeout(timeout);
-
360  int is_connected = this->client_ptr->connect(ip, port);
-
361  LOGI("is connected %s with timeout %d", is_connected ? "true" : "false", (int)timeout);
-
362  return is_connected;
-
363  }
-
364 };
-
365 
-
366 } // namespace audio_tools
-
367 
-
368 #endif
+
248 #if defined(ESP32) && defined(ARDUINO)
+
249  LOGI("Free heap: %u", (unsigned)ESP.getFreeHeap());
+
250 #endif
+
251 
+
252  reply_header.setProcessed();
+
253 
+
254  host_name = url.host();
+
255  request_header.setValues(action, url.path());
+
256  if (lenData > 0) {
+
257  request_header.put(CONTENT_LENGTH, lenData);
+
258  }
+
259  request_header.put(HOST_C, host_name);
+
260  request_header.put(CONNECTION, connection);
+
261  request_header.put(USER_AGENT, agent);
+
262  request_header.put(ACCEPT_ENCODING, accept_encoding);
+
263  request_header.put(ACCEPT, accept);
+
264  request_header.put(CONTENT_TYPE, mime);
+
265  request_header.write(*client_ptr);
+
266 
+
267  return true;
+
268  }
+
269 
+
271  virtual void processWrite(Stream &stream) {
+
272  uint8_t buffer[CHUNK_SIZE];
+
273  int total = 0;
+
274  int total_written = 0;
+
275  while (*client_ptr && stream.available() > 0) {
+
276  int result_len = stream.readBytes(buffer, CHUNK_SIZE);
+
277  total += result_len;
+
278  int written = write(buffer, result_len);
+
279  total_written += written;
+
280  LOGI("--> Bytes read %d vs written %d", result_len, written);
+
281  delay(1);
+
282  }
+
283  client_ptr->flush();
+
284  LOGI("Total bytes read %d vs written %d", total, total_written);
+
285  }
+
286 
+
289  size_t write(const uint8_t *data, size_t len) override {
+
290  TRACED();
+
291  size_t result = 0;
+
292  if (isChunked()) {
+
293  if (len > 0) {
+
294  is_chunked_output_active = true;
+
295  client_ptr->println(len, HEX);
+
296  result = client_ptr->write(data, len);
+
297  client_ptr->println();
+
298  }
+
299  } else {
+
300  result = client_ptr->write(data, len);
+
301  }
+
302  return result;
+
303  }
+
304 
+
306  virtual int processEnd() {
+
307  TRACED();
+
308  // if sending is chunked we terminate with an empty chunk
+
309  if (isChunked()) {
+
310  if (is_chunked_output_active) client_ptr->println(0, HEX);
+
311  client_ptr->println();
+
312  is_chunked_output_active = false;
+
313  }
+
314  LOGI("Request written ... waiting for reply");
+
315  // Commented out because this breaks the RP2040 W
+
316  // client_ptr->flush();
+
317  reply_header.read(*client_ptr);
+
318 
+
319  // if we use chunked tranfer we need to read the first chunked length
+
320  if (reply_header.isChunked()) {
+
321  chunk_reader.open(*client_ptr);
+
322  };
+
323 
+
324  // wait for data
+
325  is_ready = true;
+
326  return reply_header.statusCode();
+
327  }
+
328 
+
330  void setOnConnectCallback(void (*callback)(
+
331  HttpRequest &request, Url &url, HttpRequestHeader &request_header)) {
+
332  http_connect_callback = callback;
+
333  }
+
334 
+
336  void setTimeout(int timeoutMs) { clientTimeout = timeoutMs; }
+
337 
+
339  bool isChunked() { return request_header.isChunked(); }
+
340 
+
341  protected:
+
342  Client *client_ptr = nullptr;
+
343  Url url;
+
344  HttpRequestHeader request_header;
+
345  HttpReplyHeader reply_header;
+
346  HttpChunkReader chunk_reader = HttpChunkReader(reply_header);
+
347  const char *agent = nullptr;
+
348  const char *host_name = nullptr;
+
349  const char *connection = CON_KEEP_ALIVE;
+
350  const char *accept = ACCEPT_ALL;
+
351  const char *accept_encoding = IDENTITY;
+
352  bool is_ready = false;
+
353  int32_t clientTimeout = URL_CLIENT_TIMEOUT; // 60000;
+
354  void (*http_connect_callback)(HttpRequest &request, Url &url,
+
355  HttpRequestHeader &request_header) = nullptr;
+
356  bool is_chunked_output_active = false;
+
357 
+
358  // opens a connection to the indicated host
+
359  virtual int connect(const char *ip, uint16_t port, int32_t timeout) {
+
360  TRACED();
+
361  client_ptr->setTimeout(timeout / 1000); // client timeout is in seconds!
+
362  request_header.setTimeout(timeout);
+
363  reply_header.setTimeout(timeout);
+
364  int is_connected = this->client_ptr->connect(ip, port);
+
365  LOGI("is connected %s with timeout %d", is_connected ? "true" : "false", (int)timeout);
+
366  return is_connected;
+
367  }
+
368 };
+
369 
+
370 } // namespace audio_tools
+
371 
+
372 #endif
audio_tools::BaseStream
Base class for all Streams. It relies on write(const uint8_t *buffer, size_t size) and readBytes(uint...
Definition: BaseStream.h:34
audio_tools::Client
Definition: NoArduino.h:139
audio_tools::HttpChunkReader
Http might reply with chunks. So we need to dechunk the data. see https://en.wikipedia....
Definition: HttpChunkReader.h:14
@@ -415,25 +419,25 @@
audio_tools::HttpReplyHeader
Reading and Writing of Http Replys.
Definition: HttpHeader.h:448
audio_tools::HttpRequestHeader
Reading and writing of Http Requests.
Definition: HttpHeader.h:389
audio_tools::HttpRequest
Simple API to process get, put, post, del http requests I tried to use Arduino HttpClient,...
Definition: HttpRequest.h:26
-
audio_tools::HttpRequest::setTimeout
void setTimeout(int timeoutMs)
Defines the client timeout in ms.
Definition: HttpRequest.h:332
-
audio_tools::HttpRequest::isChunked
bool isChunked()
we are sending the data chunked
Definition: HttpRequest.h:335
-
audio_tools::HttpRequest::post
virtual int post(Url &url, const char *mime, Stream &data, int len=-1)
http post
Definition: HttpRequest.h:83
-
audio_tools::HttpRequest::get
virtual int get(Url &url, const char *acceptMime=nullptr, const char *data=nullptr, int len=-1)
http get
Definition: HttpRequest.h:108
-
audio_tools::HttpRequest::processEnd
virtual int processEnd()
Ends the http request processing and returns the status code.
Definition: HttpRequest.h:302
-
audio_tools::HttpRequest::header
virtual HttpRequestHeader & header()
provides access to the request header
Definition: HttpRequest.h:157
-
audio_tools::HttpRequest::put
virtual int put(Url &url, const char *mime, const char *data, int len=-1)
http put
Definition: HttpRequest.h:89
-
audio_tools::HttpRequest::processWrite
virtual void processWrite(Stream &stream)
Writes (Posts) the data of the indicated stream after calling processBegin.
Definition: HttpRequest.h:267
-
audio_tools::HttpRequest::setAgent
virtual void setAgent(const char *agent)
Defines the agent.
Definition: HttpRequest.h:160
+
audio_tools::HttpRequest::setTimeout
void setTimeout(int timeoutMs)
Defines the client timeout in ms.
Definition: HttpRequest.h:336
+
audio_tools::HttpRequest::isChunked
bool isChunked()
we are sending the data chunked
Definition: HttpRequest.h:339
+
audio_tools::HttpRequest::post
virtual int post(Url &url, const char *mime, Stream &data, int len=-1)
http post
Definition: HttpRequest.h:87
+
audio_tools::HttpRequest::get
virtual int get(Url &url, const char *acceptMime=nullptr, const char *data=nullptr, int len=-1)
http get
Definition: HttpRequest.h:112
+
audio_tools::HttpRequest::processEnd
virtual int processEnd()
Ends the http request processing and returns the status code.
Definition: HttpRequest.h:306
+
audio_tools::HttpRequest::header
virtual HttpRequestHeader & header()
provides access to the request header
Definition: HttpRequest.h:161
+
audio_tools::HttpRequest::put
virtual int put(Url &url, const char *mime, const char *data, int len=-1)
http put
Definition: HttpRequest.h:93
+
audio_tools::HttpRequest::processWrite
virtual void processWrite(Stream &stream)
Writes (Posts) the data of the indicated stream after calling processBegin.
Definition: HttpRequest.h:271
+
audio_tools::HttpRequest::setAgent
virtual void setAgent(const char *agent)
Defines the agent.
Definition: HttpRequest.h:164
audio_tools::HttpRequest::end
void end() override
same as end()
Definition: HttpRequest.h:62
-
audio_tools::HttpRequest::write
size_t write(const uint8_t *data, size_t len) override
Definition: HttpRequest.h:285
-
audio_tools::HttpRequest::processBegin
virtual bool processBegin(MethodID action, Url &url, const char *mime, int lenData=-1)
starts http request processing
Definition: HttpRequest.h:221
-
audio_tools::HttpRequest::put
virtual int put(Url &url, const char *mime, Stream &data, int len=-1)
http put
Definition: HttpRequest.h:95
-
audio_tools::HttpRequest::head
virtual int head(Url &url, const char *acceptMime=nullptr, const char *data=nullptr, int len=-1)
http head
Definition: HttpRequest.h:116
-
audio_tools::HttpRequest::post
virtual int post(Url &url, const char *mime, const char *data, int len=-1)
http post
Definition: HttpRequest.h:77
-
audio_tools::HttpRequest::setOnConnectCallback
void setOnConnectCallback(void(*callback)(HttpRequest &request, Url &url, HttpRequestHeader &request_header))
Callback which allows you to add additional paramters dynamically.
Definition: HttpRequest.h:326
-
audio_tools::HttpRequest::isReady
bool isReady()
Definition: HttpRequest.h:185
-
audio_tools::HttpRequest::addRequestHeader
void addRequestHeader(const char *header, const char *value)
Adds/Updates a request header.
Definition: HttpRequest.h:188
-
audio_tools::HttpRequest::del
virtual int del(Url &url, const char *mime=nullptr, const char *data=nullptr, int len=-1)
http del
Definition: HttpRequest.h:101
+
audio_tools::HttpRequest::write
size_t write(const uint8_t *data, size_t len) override
Definition: HttpRequest.h:289
+
audio_tools::HttpRequest::processBegin
virtual bool processBegin(MethodID action, Url &url, const char *mime, int lenData=-1)
starts http request processing
Definition: HttpRequest.h:225
+
audio_tools::HttpRequest::put
virtual int put(Url &url, const char *mime, Stream &data, int len=-1)
http put
Definition: HttpRequest.h:99
+
audio_tools::HttpRequest::head
virtual int head(Url &url, const char *acceptMime=nullptr, const char *data=nullptr, int len=-1)
http head
Definition: HttpRequest.h:120
+
audio_tools::HttpRequest::post
virtual int post(Url &url, const char *mime, const char *data, int len=-1)
http post
Definition: HttpRequest.h:81
+
audio_tools::HttpRequest::setOnConnectCallback
void setOnConnectCallback(void(*callback)(HttpRequest &request, Url &url, HttpRequestHeader &request_header))
Callback which allows you to add additional paramters dynamically.
Definition: HttpRequest.h:330
+
audio_tools::HttpRequest::isReady
bool isReady()
Definition: HttpRequest.h:189
+
audio_tools::HttpRequest::addRequestHeader
void addRequestHeader(const char *header, const char *value)
Adds/Updates a request header.
Definition: HttpRequest.h:192
+
audio_tools::HttpRequest::del
virtual int del(Url &url, const char *mime=nullptr, const char *data=nullptr, int len=-1)
http del
Definition: HttpRequest.h:105
audio_tools::Stream
Definition: NoArduino.h:125
audio_tools::URLStream
Represents the content of a URL as Stream. We use the WiFi.h API.
Definition: URLStream.h:26
audio_tools::Url
URL parser which breaks a full url string up into its individual parts.
Definition: Url.h:22
diff --git a/_i_c_y_stream_8h_source.html b/_i_c_y_stream_8h_source.html index 722e0b519..03c3952d3 100644 --- a/_i_c_y_stream_8h_source.html +++ b/_i_c_y_stream_8h_source.html @@ -206,7 +206,7 @@
audio_tools::AbstractURLStream
Abstract Base class for all URLStream implementations.
Definition: AbstractURLStream.h:11
audio_tools::Client
Definition: NoArduino.h:139
audio_tools::HttpRequest
Simple API to process get, put, post, del http requests I tried to use Arduino HttpClient,...
Definition: HttpRequest.h:26
-
audio_tools::HttpRequest::header
virtual HttpRequestHeader & header()
provides access to the request header
Definition: HttpRequest.h:157
+
audio_tools::HttpRequest::header
virtual HttpRequestHeader & header()
provides access to the request header
Definition: HttpRequest.h:161
audio_tools::ICYStream
Icecast/Shoutcast Audio Stream which splits the data into metadata and audio data....
Definition: ICYStream.h:22
audio_tools::ICYStream::httpRequest
virtual HttpRequest & httpRequest() override
provides access to the HttpRequest
Definition: ICYStream.h:131
audio_tools::ICYStream::readBytes
virtual size_t readBytes(uint8_t *data, size_t len) override
reads the audio bytes
Definition: ICYStream.h:90
diff --git a/_u_r_l_stream_8h_source.html b/_u_r_l_stream_8h_source.html index 2d698f5ce..6244779a1 100644 --- a/_u_r_l_stream_8h_source.html +++ b/_u_r_l_stream_8h_source.html @@ -477,9 +477,9 @@
audio_tools::HttpHeader::clear
HttpHeader & clear()
clears the data
Definition: HttpHeader.h:94
audio_tools::HttpRequestHeader
Reading and writing of Http Requests.
Definition: HttpHeader.h:389
audio_tools::HttpRequest
Simple API to process get, put, post, del http requests I tried to use Arduino HttpClient,...
Definition: HttpRequest.h:26
-
audio_tools::HttpRequest::header
virtual HttpRequestHeader & header()
provides access to the request header
Definition: HttpRequest.h:157
-
audio_tools::HttpRequest::setOnConnectCallback
void setOnConnectCallback(void(*callback)(HttpRequest &request, Url &url, HttpRequestHeader &request_header))
Callback which allows you to add additional paramters dynamically.
Definition: HttpRequest.h:326
-
audio_tools::HttpRequest::isReady
bool isReady()
Definition: HttpRequest.h:185
+
audio_tools::HttpRequest::header
virtual HttpRequestHeader & header()
provides access to the request header
Definition: HttpRequest.h:161
+
audio_tools::HttpRequest::setOnConnectCallback
void setOnConnectCallback(void(*callback)(HttpRequest &request, Url &url, HttpRequestHeader &request_header))
Callback which allows you to add additional paramters dynamically.
Definition: HttpRequest.h:330
+
audio_tools::HttpRequest::isReady
bool isReady()
Definition: HttpRequest.h:189
audio_tools::StrView::c_str
virtual const char * c_str()
provides the string value as const char*
Definition: StrView.h:379
audio_tools::Stream
Definition: NoArduino.h:125
audio_tools::URLStream
Represents the content of a URL as Stream. We use the WiFi.h API.
Definition: URLStream.h:26