From 27c892806b60233479471c4d4aaa5279a0912bcb Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Mon, 16 May 2022 11:19:45 +0100 Subject: [PATCH] Fix #1540 - case sensitive match in mg_is_chunked() --- mongoose.c | 4 ++-- src/http.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mongoose.c b/mongoose.c index f9e7d438..691123e4 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1804,9 +1804,9 @@ static void walkchunks(struct mg_connection *c, struct mg_http_message *hm, } static bool mg_is_chunked(struct mg_http_message *hm) { - struct mg_str needle = mg_str_n("chunked", 7); + const char *needle = "chunked"; struct mg_str *te = mg_http_get_header(hm, "Transfer-Encoding"); - return te != NULL && mg_strstr(*te, needle) != NULL; + return te != NULL && mg_vcasecmp(te, needle) == 0; } void mg_http_delete_chunk(struct mg_connection *c, struct mg_http_message *hm) { diff --git a/src/http.c b/src/http.c index 1c9eaa3e..59f3b3dd 100644 --- a/src/http.c +++ b/src/http.c @@ -810,9 +810,9 @@ static void walkchunks(struct mg_connection *c, struct mg_http_message *hm, } static bool mg_is_chunked(struct mg_http_message *hm) { - struct mg_str needle = mg_str_n("chunked", 7); + const char *needle = "chunked"; struct mg_str *te = mg_http_get_header(hm, "Transfer-Encoding"); - return te != NULL && mg_strstr(*te, needle) != NULL; + return te != NULL && mg_vcasecmp(te, needle) == 0; } void mg_http_delete_chunk(struct mg_connection *c, struct mg_http_message *hm) {