Skip to content

Commit d75ca96

Browse files
committed
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
2 parents bc63628 + f638090 commit d75ca96

File tree

3 files changed

+11
-68
lines changed

3 files changed

+11
-68
lines changed

components/esp_http_client/esp_http_client.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,20 +1870,20 @@ esp_err_t esp_http_client_add_auth(esp_http_client_handle_t client)
18701870
client->auth_data->method = strdup(HTTP_METHOD_MAPPING[client->connection_info.method]);
18711871

18721872
client->auth_data->nc = 1;
1873-
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");
1874-
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");
1873+
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");
1874+
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");
18751875

18761876
if (client->auth_data->algorithm == NULL) {
1877-
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");
1877+
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");
18781878
}
18791879

18801880
if (client->auth_data->algorithm == NULL) {
18811881
client->auth_data->algorithm = strdup("MD5");
18821882
}
18831883

1884-
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");
1885-
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");
1886-
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");
1884+
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");
1885+
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");
1886+
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");
18871887
client->process_again = 1;
18881888

18891889
return ESP_OK;

components/esp_http_client/lib/http_utils.c

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -110,41 +110,7 @@ void http_utils_trim_whitespace(char **str)
110110
memmove(*str, start, strlen(start) + 1);
111111
}
112112

113-
char *http_utils_get_string_between(const char *str, const char *begin, const char *end)
114-
{
115-
char *found = strcasestr(str, begin);
116-
char *ret = NULL;
117-
if (found) {
118-
found += strlen(begin);
119-
char *found_end = strcasestr(found, end);
120-
if (found_end) {
121-
ret = calloc(1, found_end - found + 1);
122-
mem_check(ret);
123-
memcpy(ret, found, found_end - found);
124-
return ret;
125-
}
126-
}
127-
return NULL;
128-
}
129-
130-
char *http_utils_get_string_after(const char *str, const char *begin)
131-
{
132-
char *found = strcasestr(str, begin);
133-
char *ret = NULL;
134-
if (found) {
135-
found += strlen(begin);
136-
char *found_end = (char *)str + strlen(str);
137-
if (found_end) {
138-
ret = calloc(1, found_end - found + 1);
139-
mem_check(ret);
140-
memcpy(ret, found, found_end - found);
141-
return ret;
142-
}
143-
}
144-
return NULL;
145-
}
146-
147-
esp_err_t http_utils_get_substring_between(const char *str, const char *begin, const char *end, char **out)
113+
esp_err_t http_utils_get_string_between(const char *str, const char *begin, const char *end, char **out)
148114
{
149115
*out = NULL;
150116
char *found = strcasestr(str, begin);
@@ -160,7 +126,7 @@ esp_err_t http_utils_get_substring_between(const char *str, const char *begin, c
160126
return ESP_OK;
161127
}
162128

163-
esp_err_t http_utils_get_substring_after(const char *str, const char *begin, char **out)
129+
esp_err_t http_utils_get_string_after(const char *str, const char *begin, char **out)
164130
{
165131
*out = NULL;
166132
char *found = strcasestr(str, begin);

components/esp_http_client/lib/include/http_utils.h

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,6 @@ char *http_utils_append_string(char **str, const char *new_str, int len);
8080
*/
8181
void http_utils_trim_whitespace(char **str);
8282

83-
/**
84-
* @brief Gets the string between 2 string.
85-
* It will allocate a new memory space for this string, so you need to free it when no longer use
86-
*
87-
* @param[in] str The source string
88-
* @param[in] begin The begin string
89-
* @param[in] end The end string
90-
*
91-
* @return The string between begin and end
92-
*/
93-
char *http_utils_get_string_between(const char *str, const char *begin, const char *end) __attribute__((deprecated("Use http_utils_get_substring_between instead.")));;
94-
95-
/**
96-
* @brief Returns a string that contains the part after the search string till the end of the source string.
97-
* It will allocate a new memory space for this string, so you need to free it when no longer used
98-
*
99-
* @param[in] str The source string
100-
* @param[in] begin The search string
101-
*
102-
* @return The string between begin and the end of str
103-
*/
104-
char *http_utils_get_string_after(const char *str, const char *begin) __attribute__((deprecated("Use http_utils_get_substring_after instead.")));;
105-
10683
/**
10784
* @brief Extracts the substring between two specified delimiters.
10885
* 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
11794
* - ESP_OK: Operation succeeded (even if no substring is found).
11895
* - ESP_ERR_NO_MEM: Memory allocation failed.
11996
*/
120-
esp_err_t http_utils_get_substring_between(const char *str, const char *begin, const char *end, char **out);
97+
esp_err_t http_utils_get_string_between(const char *str, const char *begin, const char *end, char **out);
12198

12299
/**
123100
* @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
132109
* - ESP_OK: Operation succeeded (even if no substring is found).
133110
* - ESP_ERR_NO_MEM: Memory allocation failed.
134111
*/
135-
esp_err_t http_utils_get_substring_after(const char *str, const char *begin, char **out);
112+
esp_err_t http_utils_get_string_after(const char *str, const char *begin, char **out);
136113

137114
/**
138115
* @brief Join 2 strings to one

0 commit comments

Comments
 (0)