Merge branch 'fix/revert_and_update_depricated_marked_private_api' into 'master'

fix(esp_http_client): Revert Deprecated Tag on Previously Marked Private API

See merge request espressif/esp-idf!36451
This commit is contained in:
Mahavir Jain 2025-01-21 14:02:19 +08:00
commit d75ca966c3
3 changed files with 11 additions and 68 deletions

View File

@ -1870,20 +1870,20 @@ esp_err_t esp_http_client_add_auth(esp_http_client_handle_t client)
client->auth_data->method = strdup(HTTP_METHOD_MAPPING[client->connection_info.method]);
client->auth_data->nc = 1;
HTTP_RET_ON_ERR_DBG(http_utils_get_substring_between(auth_header, "realm=\"", "\"", &client->auth_data->realm), TAG, "Unable to extract substring between specified strings");
HTTP_RET_ON_ERR_DBG(http_utils_get_substring_between(auth_header, "algorithm=", ",", &client->auth_data->algorithm), TAG, "Unable to extract substring between specified strings");
HTTP_RET_ON_ERR_DBG(http_utils_get_string_between(auth_header, "realm=\"", "\"", &client->auth_data->realm), TAG, "Unable to extract substring between specified strings");
HTTP_RET_ON_ERR_DBG(http_utils_get_string_between(auth_header, "algorithm=", ",", &client->auth_data->algorithm), TAG, "Unable to extract substring between specified strings");
if (client->auth_data->algorithm == NULL) {
HTTP_RET_ON_ERR_DBG(http_utils_get_substring_after(auth_header, "algorithm=", &client->auth_data->algorithm), TAG, "Unable to extract substring after specified string");
HTTP_RET_ON_ERR_DBG(http_utils_get_string_after(auth_header, "algorithm=", &client->auth_data->algorithm), TAG, "Unable to extract substring after specified string");
}
if (client->auth_data->algorithm == NULL) {
client->auth_data->algorithm = strdup("MD5");
}
HTTP_RET_ON_ERR_DBG(http_utils_get_substring_between(auth_header, "qop=\"", "\"", &client->auth_data->qop), TAG, "Unable to extract substring between specified strings");
HTTP_RET_ON_ERR_DBG(http_utils_get_substring_between(auth_header, "nonce=\"", "\"", &client->auth_data->nonce), TAG, "Unable to extract substring between specified strings");
HTTP_RET_ON_ERR_DBG(http_utils_get_substring_between(auth_header, "opaque=\"", "\"", &client->auth_data->opaque), TAG, "Unable to extract substring between specified strings");
HTTP_RET_ON_ERR_DBG(http_utils_get_string_between(auth_header, "qop=\"", "\"", &client->auth_data->qop), TAG, "Unable to extract substring between specified strings");
HTTP_RET_ON_ERR_DBG(http_utils_get_string_between(auth_header, "nonce=\"", "\"", &client->auth_data->nonce), TAG, "Unable to extract substring between specified strings");
HTTP_RET_ON_ERR_DBG(http_utils_get_string_between(auth_header, "opaque=\"", "\"", &client->auth_data->opaque), TAG, "Unable to extract substring between specified strings");
client->process_again = 1;
return ESP_OK;

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -110,41 +110,7 @@ void http_utils_trim_whitespace(char **str)
memmove(*str, start, strlen(start) + 1);
}
char *http_utils_get_string_between(const char *str, const char *begin, const char *end)
{
char *found = strcasestr(str, begin);
char *ret = NULL;
if (found) {
found += strlen(begin);
char *found_end = strcasestr(found, end);
if (found_end) {
ret = calloc(1, found_end - found + 1);
mem_check(ret);
memcpy(ret, found, found_end - found);
return ret;
}
}
return NULL;
}
char *http_utils_get_string_after(const char *str, const char *begin)
{
char *found = strcasestr(str, begin);
char *ret = NULL;
if (found) {
found += strlen(begin);
char *found_end = (char *)str + strlen(str);
if (found_end) {
ret = calloc(1, found_end - found + 1);
mem_check(ret);
memcpy(ret, found, found_end - found);
return ret;
}
}
return NULL;
}
esp_err_t http_utils_get_substring_between(const char *str, const char *begin, const char *end, char **out)
esp_err_t http_utils_get_string_between(const char *str, const char *begin, const char *end, char **out)
{
*out = NULL;
char *found = strcasestr(str, begin);
@ -160,7 +126,7 @@ esp_err_t http_utils_get_substring_between(const char *str, const char *begin, c
return ESP_OK;
}
esp_err_t http_utils_get_substring_after(const char *str, const char *begin, char **out)
esp_err_t http_utils_get_string_after(const char *str, const char *begin, char **out)
{
*out = NULL;
char *found = strcasestr(str, begin);

View File

@ -80,29 +80,6 @@ char *http_utils_append_string(char **str, const char *new_str, int len);
*/
void http_utils_trim_whitespace(char **str);
/**
* @brief Gets the string between 2 string.
* It will allocate a new memory space for this string, so you need to free it when no longer use
*
* @param[in] str The source string
* @param[in] begin The begin string
* @param[in] end The end string
*
* @return The string between begin and end
*/
char *http_utils_get_string_between(const char *str, const char *begin, const char *end) __attribute__((deprecated("Use http_utils_get_substring_between instead.")));;
/**
* @brief Returns a string that contains the part after the search string till the end of the source string.
* It will allocate a new memory space for this string, so you need to free it when no longer used
*
* @param[in] str The source string
* @param[in] begin The search string
*
* @return The string between begin and the end of str
*/
char *http_utils_get_string_after(const char *str, const char *begin) __attribute__((deprecated("Use http_utils_get_substring_after instead.")));;
/**
* @brief Extracts the substring between two specified delimiters.
* Allocates memory for the extracted substring and stores it in `out`.
@ -117,7 +94,7 @@ char *http_utils_get_string_after(const char *str, const char *begin) __attribut
* - ESP_OK: Operation succeeded (even if no substring is found).
* - ESP_ERR_NO_MEM: Memory allocation failed.
*/
esp_err_t http_utils_get_substring_between(const char *str, const char *begin, const char *end, char **out);
esp_err_t http_utils_get_string_between(const char *str, const char *begin, const char *end, char **out);
/**
* @brief Extracts the substring starting after a specified delimiter until the end of the source string.
@ -132,7 +109,7 @@ esp_err_t http_utils_get_substring_between(const char *str, const char *begin, c
* - ESP_OK: Operation succeeded (even if no substring is found).
* - ESP_ERR_NO_MEM: Memory allocation failed.
*/
esp_err_t http_utils_get_substring_after(const char *str, const char *begin, char **out);
esp_err_t http_utils_get_string_after(const char *str, const char *begin, char **out);
/**
* @brief Join 2 strings to one