From 19024671ea23d65a4df225d3f25811ec52a58182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Henne?= Date: Thu, 8 Apr 2021 18:11:21 +0530 Subject: [PATCH] esp_http_client: Make http_utils_get_string_between and http_utils_str_starts_with case insensitive Closes: https://github.com/espressif/esp-idf/pull/6841 Closes: https://github.com/espressif/esp-idf/issues/6840 Signed-off-by: Shubham Kulkarni --- components/esp_http_client/lib/http_utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/esp_http_client/lib/http_utils.c b/components/esp_http_client/lib/http_utils.c index 174be8764c..adf47ac91a 100644 --- a/components/esp_http_client/lib/http_utils.c +++ b/components/esp_http_client/lib/http_utils.c @@ -116,11 +116,11 @@ void http_utils_trim_whitespace(char **str) char *http_utils_get_string_between(const char *str, const char *begin, const char *end) { - char *found = strstr(str, begin); + char *found = strcasestr(str, begin); char *ret = NULL; if (found) { found += strlen(begin); - char *found_end = strstr(found, end); + char *found_end = strcasestr(found, end); if (found_end) { ret = calloc(1, found_end - found + 1); mem_check(ret); @@ -141,7 +141,7 @@ int http_utils_str_starts_with(const char *str, const char *start) return -1; } for (i = 0; i < start_len; i++) { - if (str[i] != start[i]) { + if (tolower(str[i]) != tolower(start[i])) { return 1; } }