From: Assaf Inbal Date: Sat, 22 Sep 2018 16:47:20 +0000 (+0300) Subject: Remove Content-Length from chunked encoding X-Git-Tag: v3.2-beta1~64^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4e867a148dc82197f02954b753ad30fb0a0f531;p=esp-idf Remove Content-Length from chunked encoding Content-Length header should not be included when using chunked encoding. Some browsers will close the socket after seeing the 0 sized response instead of reading the chunks. Merges https://github.com/espressif/esp-idf/pull/2458 --- diff --git a/components/http_server/src/httpd_txrx.c b/components/http_server/src/httpd_txrx.c index 25bda8fd53..5cf95b351d 100644 --- a/components/http_server/src/httpd_txrx.c +++ b/components/http_server/src/httpd_txrx.c @@ -296,7 +296,7 @@ esp_err_t httpd_resp_send_chunk(httpd_req_t *r, const char *buf, size_t buf_len) } struct httpd_req_aux *ra = r->aux; - const char *httpd_chunked_hdr_str = "HTTP/1.1 %s\r\nContent-Type: %s\r\nContent-Length: 0\r\nTransfer-Encoding: chunked\r\n"; + const char *httpd_chunked_hdr_str = "HTTP/1.1 %s\r\nContent-Type: %s\r\nTransfer-Encoding: chunked\r\n"; const char *colon_separator = ": "; const char *cr_lf_seperator = "\r\n";