From c6777547f69022df9b600b09a076bf4481ac9bf3 Mon Sep 17 00:00:00 2001 From: Mike Kleshov Date: Fri, 1 Jan 2021 11:26:30 +0300 Subject: [PATCH] Make sure tag insertion is complete when tag is followed by EOF. See bug #59728. Signed-off-by: Mike Kleshov --- src/apps/http/httpd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/apps/http/httpd.c b/src/apps/http/httpd.c index 2b9baf88..d844d9f5 100644 --- a/src/apps/http/httpd.c +++ b/src/apps/http/httpd.c @@ -1610,6 +1610,11 @@ http_send(struct altcp_pcb *pcb, struct http_state *hs) } #endif /* LWIP_HTTPD_DYNAMIC_HEADERS */ +#if LWIP_HTTPD_SSI + if (hs->ssi && (hs->ssi->tag_state == TAG_SENDING)) { + /* do not check the condition below */ + } else +#endif /* Have we run out of file data to send? If so, we need to read the next * block from the file. */ if (hs->left == 0) { @@ -1621,6 +1626,9 @@ http_send(struct altcp_pcb *pcb, struct http_state *hs) #if LWIP_HTTPD_SSI if (hs->ssi) { data_to_send = http_send_data_ssi(pcb, hs); + if (hs->ssi->tag_state == TAG_SENDING) { + return data_to_send; + } } else #endif /* LWIP_HTTPD_SSI */ {