fix(esp_http_client): updated API esp_http_client_get_url to get URL in correct format

This commit updates the API to include the port number in the URL,
which was previously missing.
This commit is contained in:
nilesh.kale
2025-01-13 11:14:48 +05:30
parent 81bce81a18
commit 51c668f2b9
2 changed files with 23 additions and 3 deletions
+1 -1
View File
@@ -1776,7 +1776,7 @@ esp_err_t esp_http_client_get_url(esp_http_client_handle_t client, char *url, co
return ESP_ERR_INVALID_ARG;
}
if (client->connection_info.host && client->connection_info.scheme && client->connection_info.path) {
snprintf(url, len, "%s://%s%s", client->connection_info.scheme, client->connection_info.host, client->connection_info.path);
snprintf(url, len, "%s://%s:%d%s", client->connection_info.scheme, client->connection_info.host, client->connection_info.port, client->connection_info.path);
return ESP_OK;
} else {
ESP_LOGE(TAG, "Failed to get URL");