Merge branch 'bugfix/ota_and_http_client' into 'master'

Fix counters for POST request in OTA and compare auth string in case insensitive fashion

Closes IDFGH-5059, IDFGH-5055, and IDFGH-5056

See merge request espressif/esp-idf!13069
This commit is contained in:
Mahavir Jain
2021-04-09 07:40:59 +00:00
2 changed files with 5 additions and 5 deletions

View File

@@ -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 *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; char *ret = NULL;
if (found) { if (found) {
found += strlen(begin); found += strlen(begin);
char *found_end = strstr(found, end); char *found_end = strcasestr(found, end);
if (found_end) { if (found_end) {
ret = calloc(1, found_end - found + 1); ret = calloc(1, found_end - found + 1);
mem_check(ret); mem_check(ret);
@@ -141,7 +141,7 @@ int http_utils_str_starts_with(const char *str, const char *start)
return -1; return -1;
} }
for (i = 0; i < start_len; i++) { for (i = 0; i < start_len; i++) {
if (str[i] != start[i]) { if (tolower(str[i]) != tolower(start[i])) {
return 1; return 1;
} }
} }

View File

@@ -123,9 +123,9 @@ static esp_err_t _http_connect(esp_http_client_handle_t http_client)
ESP_LOGE(TAG, "Write failed"); ESP_LOGE(TAG, "Write failed");
return ESP_FAIL; return ESP_FAIL;
} }
post_len -= write_len;
post_data += write_len;
} }
post_len -= write_len;
post_data += write_len;
} }
header_ret = esp_http_client_fetch_headers(http_client); header_ret = esp_http_client_fetch_headers(http_client);
if (header_ret < 0) { if (header_ret < 0) {