Refactor mg_http_reply and mg_http_printf_chunk to use less allocs and mem copies

This commit is contained in:
Sergey Lyubka committed 2022-08-01 21:07:42 +01:00
1 parent 17e2fdd4cb
commit bd7ee0d1e8
4 files changed
+55 -35

No files matched your search

+1 -1
View File
@@ -1870,7 +1870,7 @@ static void eh2(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
mg_http_printf_chunk(c, LONG_CHUNK);
c->label[0] = 1;
} else if (ev == MG_EV_POLL) {
if (c->label[0] > 0 && c->send.len == 0) c->label[0]++;
if (c->label[0] > 0 && c->label[0] != 'x') c->label[0]++;
if (c->label[0] > 10 && c->label[0] != 'x') {
mg_http_printf_chunk(c, "chunk 1");
mg_http_printf_chunk(c, "chunk 2");