@@ -256,7 +256,7 @@ static int http_on_header_field(http_parser *parser, const char *at, size_t leng
256256{
257257 esp_http_client_t * client = parser -> data ;
258258 http_on_header_event (client );
259- ESP_RETURN_ON_FALSE_DEBUG (http_utils_append_string (& client -> current_header_key , at , length ), -1 , TAG , "Failed to append string" );
259+ HTTP_RET_ON_FALSE_DBG (http_utils_append_string (& client -> current_header_key , at , length ), -1 , TAG , "Failed to append string" );
260260
261261 return 0 ;
262262}
@@ -268,14 +268,14 @@ static int http_on_header_value(http_parser *parser, const char *at, size_t leng
268268 return 0 ;
269269 }
270270 if (strcasecmp (client -> current_header_key , "Location" ) == 0 ) {
271- ESP_RETURN_ON_FALSE_DEBUG (http_utils_append_string (& client -> location , at , length ), -1 , TAG , "Failed to append string" );
271+ HTTP_RET_ON_FALSE_DBG (http_utils_append_string (& client -> location , at , length ), -1 , TAG , "Failed to append string" );
272272 } else if (strcasecmp (client -> current_header_key , "Transfer-Encoding" ) == 0
273273 && memcmp (at , "chunked" , length ) == 0 ) {
274274 client -> response -> is_chunked = true;
275275 } else if (strcasecmp (client -> current_header_key , "WWW-Authenticate" ) == 0 ) {
276- ESP_RETURN_ON_FALSE_DEBUG (http_utils_append_string (& client -> auth_header , at , length ), -1 , TAG , "Failed to append string" );
276+ HTTP_RET_ON_FALSE_DBG (http_utils_append_string (& client -> auth_header , at , length ), -1 , TAG , "Failed to append string" );
277277 }
278- ESP_RETURN_ON_FALSE_DEBUG (http_utils_append_string (& client -> current_header_value , at , length ), -1 , TAG , "Failed to append string" );
278+ HTTP_RET_ON_FALSE_DBG (http_utils_append_string (& client -> current_header_value , at , length ), -1 , TAG , "Failed to append string" );
279279 return 0 ;
280280}
281281
@@ -555,12 +555,12 @@ static esp_err_t _set_config(esp_http_client_handle_t client, const esp_http_cli
555555 }
556556
557557 if (config -> transport_type == HTTP_TRANSPORT_OVER_SSL ) {
558- ESP_GOTO_ON_FALSE_DEBUG (http_utils_assign_string (& client -> connection_info .scheme , "https" , -1 ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
558+ HTTP_GOTO_ON_FALSE_DBG (http_utils_assign_string (& client -> connection_info .scheme , "https" , -1 ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
559559 if (client -> connection_info .port == 0 ) {
560560 client -> connection_info .port = DEFAULT_HTTPS_PORT ;
561561 }
562562 } else {
563- ESP_GOTO_ON_FALSE_DEBUG (http_utils_assign_string (& client -> connection_info .scheme , "http" , -1 ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
563+ HTTP_GOTO_ON_FALSE_DBG (http_utils_assign_string (& client -> connection_info .scheme , "http" , -1 ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
564564 if (client -> connection_info .port == 0 ) {
565565 client -> connection_info .port = DEFAULT_HTTP_PORT ;
566566 }
@@ -640,11 +640,11 @@ static esp_err_t esp_http_client_prepare_digest_auth(esp_http_client_handle_t cl
640640 // Freeing the allocated memory for auth_data->uri and setting it to NULL to prevent potential memory leaks
641641 free (client -> auth_data -> uri );
642642 client -> auth_data -> uri = NULL ;
643- ESP_GOTO_ON_FALSE_DEBUG (http_utils_assign_string (& client -> auth_data -> uri , client -> connection_info .path , -1 ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
643+ HTTP_GOTO_ON_FALSE_DBG (http_utils_assign_string (& client -> auth_data -> uri , client -> connection_info .path , -1 ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
644644
645645 if (client -> connection_info .query ) {
646- ESP_GOTO_ON_FALSE_DEBUG (http_utils_append_string (& client -> auth_data -> uri , "?" , -1 ), ESP_ERR_NO_MEM , error , TAG , "Failed to append string" );
647- ESP_GOTO_ON_FALSE_DEBUG (http_utils_append_string (& client -> auth_data -> uri , client -> connection_info .query , -1 ), ESP_ERR_NO_MEM , error , TAG , "Failed to append string" );
646+ HTTP_GOTO_ON_FALSE_DBG (http_utils_append_string (& client -> auth_data -> uri , "?" , -1 ), ESP_ERR_NO_MEM , error , TAG , "Failed to append string" );
647+ HTTP_GOTO_ON_FALSE_DBG (http_utils_append_string (& client -> auth_data -> uri , client -> connection_info .query , -1 ), ESP_ERR_NO_MEM , error , TAG , "Failed to append string" );
648648 }
649649
650650 client -> auth_data -> cnonce = ((uint64_t )esp_random () << 32 ) + esp_random ();
@@ -1121,7 +1121,7 @@ esp_err_t esp_http_client_set_url(esp_http_client_handle_t client, const char *u
11211121 old_port = client -> connection_info .port ;
11221122
11231123 if (purl .field_data [UF_HOST ].len ) {
1124- ESP_GOTO_ON_FALSE_DEBUG (http_utils_assign_string (& client -> connection_info .host , url + purl .field_data [UF_HOST ].off , purl .field_data [UF_HOST ].len ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
1124+ HTTP_GOTO_ON_FALSE_DBG (http_utils_assign_string (& client -> connection_info .host , url + purl .field_data [UF_HOST ].off , purl .field_data [UF_HOST ].len ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
11251125 }
11261126 // Close the connection if host was changed
11271127 if (old_host && client -> connection_info .host
@@ -1142,7 +1142,7 @@ esp_err_t esp_http_client_set_url(esp_http_client_handle_t client, const char *u
11421142 }
11431143
11441144 if (purl .field_data [UF_SCHEMA ].len ) {
1145- ESP_GOTO_ON_FALSE_DEBUG (http_utils_assign_string (& client -> connection_info .scheme , url + purl .field_data [UF_SCHEMA ].off , purl .field_data [UF_SCHEMA ].len ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
1145+ HTTP_GOTO_ON_FALSE_DBG (http_utils_assign_string (& client -> connection_info .scheme , url + purl .field_data [UF_SCHEMA ].off , purl .field_data [UF_SCHEMA ].len ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
11461146
11471147 if (strcasecmp (client -> connection_info .scheme , "http" ) == 0 ) {
11481148 client -> connection_info .port = DEFAULT_HTTP_PORT ;
@@ -1163,16 +1163,16 @@ esp_err_t esp_http_client_set_url(esp_http_client_handle_t client, const char *u
11631163
11641164 if (purl .field_data [UF_USERINFO ].len ) {
11651165 char * user_info = NULL ;
1166- ESP_GOTO_ON_FALSE_DEBUG (http_utils_assign_string (& user_info , url + purl .field_data [UF_USERINFO ].off , purl .field_data [UF_USERINFO ].len ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
1166+ HTTP_GOTO_ON_FALSE_DBG (http_utils_assign_string (& user_info , url + purl .field_data [UF_USERINFO ].off , purl .field_data [UF_USERINFO ].len ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
11671167 if (user_info ) {
11681168 char * username = user_info ;
11691169 char * password = strchr (user_info , ':' );
11701170 if (password ) {
11711171 * password = 0 ;
11721172 password ++ ;
1173- ESP_GOTO_ON_FALSE_DEBUG (http_utils_assign_string (& client -> connection_info .password , password , -1 ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
1173+ HTTP_GOTO_ON_FALSE_DBG (http_utils_assign_string (& client -> connection_info .password , password , -1 ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
11741174 }
1175- ESP_GOTO_ON_FALSE_DEBUG (http_utils_assign_string (& client -> connection_info .username , username , -1 ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
1175+ HTTP_GOTO_ON_FALSE_DBG (http_utils_assign_string (& client -> connection_info .username , username , -1 ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
11761176 free (user_info );
11771177 } else {
11781178 return ESP_ERR_NO_MEM ;
@@ -1181,13 +1181,13 @@ esp_err_t esp_http_client_set_url(esp_http_client_handle_t client, const char *u
11811181
11821182 //Reset path and query if there are no information
11831183 if (purl .field_data [UF_PATH ].len ) {
1184- ESP_GOTO_ON_FALSE_DEBUG (http_utils_assign_string (& client -> connection_info .path , url + purl .field_data [UF_PATH ].off , purl .field_data [UF_PATH ].len ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
1184+ HTTP_GOTO_ON_FALSE_DBG (http_utils_assign_string (& client -> connection_info .path , url + purl .field_data [UF_PATH ].off , purl .field_data [UF_PATH ].len ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
11851185 } else {
1186- ESP_GOTO_ON_FALSE_DEBUG (http_utils_assign_string (& client -> connection_info .path , "/" , -1 ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
1186+ HTTP_GOTO_ON_FALSE_DBG (http_utils_assign_string (& client -> connection_info .path , "/" , -1 ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
11871187 }
11881188
11891189 if (purl .field_data [UF_QUERY ].len ) {
1190- ESP_GOTO_ON_FALSE_DEBUG (http_utils_assign_string (& client -> connection_info .query , url + purl .field_data [UF_QUERY ].off , purl .field_data [UF_QUERY ].len ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
1190+ HTTP_GOTO_ON_FALSE_DBG (http_utils_assign_string (& client -> connection_info .query , url + purl .field_data [UF_QUERY ].off , purl .field_data [UF_QUERY ].len ), ESP_ERR_NO_MEM , error , TAG , "failed to assign string" );
11911191 } else if (client -> connection_info .query ) {
11921192 free (client -> connection_info .query );
11931193 client -> connection_info .query = NULL ;
@@ -1812,7 +1812,7 @@ esp_err_t esp_http_client_set_auth_data(esp_http_client_handle_t client, const c
18121812 if (client == NULL || auth_data == NULL || len <= 0 ) {
18131813 return ESP_ERR_INVALID_ARG ;
18141814 }
1815- ESP_RETURN_ON_FALSE_DEBUG (http_utils_append_string (& client -> auth_header , auth_data , len ), ESP_ERR_NO_MEM , TAG , "Failed to append string" );
1815+ HTTP_RET_ON_FALSE_DBG (http_utils_append_string (& client -> auth_header , auth_data , len ), ESP_ERR_NO_MEM , TAG , "Failed to append string" );
18161816 return ESP_OK ;
18171817}
18181818
@@ -1861,20 +1861,20 @@ esp_err_t esp_http_client_add_auth(esp_http_client_handle_t client)
18611861 client -> auth_data -> method = strdup (HTTP_METHOD_MAPPING [client -> connection_info .method ]);
18621862
18631863 client -> auth_data -> nc = 1 ;
1864- ESP_RETURN_ON_ERROR_DEBUG (http_utils_get_substring_between (auth_header , "realm=\"" , "\"" , & client -> auth_data -> realm ), TAG , "Unable to extract substring between specified strings" );
1865- ESP_RETURN_ON_ERROR_DEBUG (http_utils_get_substring_between (auth_header , "algorithm=" , "," , & client -> auth_data -> algorithm ), TAG , "Unable to extract substring between specified strings" );
1864+ 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" );
1865+ 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" );
18661866
18671867 if (client -> auth_data -> algorithm == NULL ) {
1868- ESP_RETURN_ON_ERROR_DEBUG (http_utils_get_substring_after (auth_header , "algorithm=" , & client -> auth_data -> algorithm ), TAG , "Unable to extract substring after specified string" );
1868+ 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" );
18691869 }
18701870
18711871 if (client -> auth_data -> algorithm == NULL ) {
18721872 client -> auth_data -> algorithm = strdup ("MD5" );
18731873 }
18741874
1875- ESP_RETURN_ON_ERROR_DEBUG (http_utils_get_substring_between (auth_header , "qop=\"" , "\"" , & client -> auth_data -> qop ), TAG , "Unable to extract substring between specified strings" );
1876- ESP_RETURN_ON_ERROR_DEBUG (http_utils_get_substring_between (auth_header , "nonce=\"" , "\"" , & client -> auth_data -> nonce ), TAG , "Unable to extract substring between specified strings" );
1877- ESP_RETURN_ON_ERROR_DEBUG (http_utils_get_substring_between (auth_header , "opaque=\"" , "\"" , & client -> auth_data -> opaque ), TAG , "Unable to extract substring between specified strings" );
1875+ 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" );
1876+ 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" );
1877+ 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" );
18781878 client -> process_again = 1 ;
18791879
18801880 return ESP_OK ;
0 commit comments