22 const char* str1 =
nullptr,
int len1 = 0) {
24 client.println(len + len1, HEX);
25 int result = client.write((
const uint8_t*)str, len);
26 if (str1 !=
nullptr) {
27 result += client.write((
const uint8_t*)str1, len1);
34 int len = strlen(str);
60 size_t write(uint8_t ch)
override {
66 size_t write(
const uint8_t* buffer,
size_t size)
override {
67 if (size == 0)
return 0;
74 int len = strlen(str);
77 if (len == 0)
return 0;
84 int len = strlen(str);
85 if (len == 0)
return 0;
86 int max_len = len * 3 + 1;
88 char* buffer =
new char[max_len];
90 strncpy(buffer, str, max_len - 1);
91 buffer[max_len - 1] =
'\0';
92 StrView str_view{buffer, max_len, (int)strlen(buffer)};
94 str_view.replaceAll(
"<",
"<");
95 str_view.replaceAll(
">",
">");
96 int new_len = str_view.length();
103 int len = strlen(str);
105 char* tmp =
new char[len + 3];
122 int n = vsnprintf(buf,
sizeof(buf), fmt, ap);
124 if (n <= 0)
return 0;
125 if (n >= (
int)
sizeof(buf)) n = (int)
sizeof(buf) - 1;
Print implementation for HTTP chunked transfer encoding.
Definition: HttpChunkWriter.h:56
size_t printf(const char *fmt,...)
Definition: HttpChunkWriter.h:118
size_t print(const char *str)
Definition: HttpChunkWriter.h:72
ChunkPrint(Client &client)
Definition: HttpChunkWriter.h:58
HttpChunkWriter chunk_writer
Definition: HttpChunkWriter.h:134
size_t printEscaped(const char *str)
Definition: HttpChunkWriter.h:82
size_t println(const char *str)
Definition: HttpChunkWriter.h:102
size_t write(uint8_t ch) override
Definition: HttpChunkWriter.h:60
size_t write(const uint8_t *buffer, size_t size) override
Definition: HttpChunkWriter.h:66
Client * client_ptr
Definition: HttpChunkWriter.h:133
void end()
Definition: HttpChunkWriter.h:130
size_t println()
Definition: HttpChunkWriter.h:113
Writes the data chunked to the actual client.
Definition: HttpChunkWriter.h:19
int writeChunk(Client &client, const char *str, int len, const char *str1=nullptr, int len1=0)
Definition: HttpChunkWriter.h:21
int writeChunk(Client &client, const char *str)
Definition: HttpChunkWriter.h:33
void writeEnd(Client &client)
Definition: HttpChunkWriter.h:38
A simple wrapper to provide string functions on char*. If the underlying char* is a const we do not a...
Definition: StrView.h:18
virtual bool replaceAll(const char *toReplace, const char *replaced)
Replaces all instances of toReplace with replaced.
Definition: StrView.h:437
#define MAX_PRINTF_SIZE
Max printf buffer size.
Definition: dlna_config.h:50
Definition: Allocator.h:13