mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
Add const char* content to ESP8266WebServer::send() (#6797)
* Add const char* content to ESP8266WebSerer::send() Supercedes #3492 Allow sending raw binary data or strings directly without conversion to a String to reduce memory overhead when possible. From original @timw1971 PR #3492 Added public functions to allow content to be uploaded using const char*. For some cases, this can remove the need for content to be copied into a String, and thus can be considerably more space-efficient. * Fix example formatting * Make GIF example use static const array * Make the example really need to use const char* Make the generated GIF dynamic in the example and move the original to PROGMEM (since that's where const arrays like this belong).
This commit is contained in:
committed by
Develo
parent
919c753563
commit
36f903443b
@ -127,6 +127,15 @@ public:
|
||||
void send(int code, const char* content_type = NULL, const String& content = String(""));
|
||||
void send(int code, char* content_type, const String& content);
|
||||
void send(int code, const String& content_type, const String& content);
|
||||
void send(int code, const char *content_type, const char *content, size_t content_length = 0) {
|
||||
if (content_length == 0) {
|
||||
content_length = strlen_P(content);
|
||||
}
|
||||
send_P(code, content_type, content, content_length);
|
||||
}
|
||||
void send(int code, const char *content_type, const uint8_t *content, size_t content_length) {
|
||||
send_P(code, content_type, (const char *)content, content_length);
|
||||
}
|
||||
void send_P(int code, PGM_P content_type, PGM_P content);
|
||||
void send_P(int code, PGM_P content_type, PGM_P content, size_t contentLength);
|
||||
|
||||
|
Reference in New Issue
Block a user