Open Nickobellic15X opened 2 years ago
Hi! I had the same issue. I had to replace the
esp_http_client_perform(client);
with
esp_http_client_open(client, 0);
here's the entire function:
void http_client(void)
{
esp_http_client_config_t clientConfig = {
.url = "http://worldtimeapi.org/api/timezone/Europe/London/",
};
esp_http_client_handle_t client = esp_http_client_init(&clientConfig);
esp_err_t err = esp_http_client_open(client, 0); //esp_http_client_perform(client);
if (err == ESP_OK)
{
// int length = esp_http_client_get_content_length(client);
char buffer[512];
memset(buffer, 0, sizeof(buffer));
int content_length = esp_http_client_fetch_headers(client);
int read_len = esp_http_client_read(client, buffer, content_length);
buffer[read_len] = 0;
ESP_LOGI("test", "len: %d", read_len);
printf("%s\n", buffer);
}
else
{
ESP_LOGE(TAG, "HTTP GET request failed: %s", esp_err_to_name(err));
}
esp_http_client_close(client);
I hope this helps!
Board: ESP32 Cam (AI Thinker) with PSRAM. ESP-IDF version: 4.4.2 Other details in the first few lines of the log output.
Issue: There is no response from the HTTPS server from the _https_client.c example. Possible explanation: :(
I added some additional debug statements to ensure the task is being created. As to my observation the function https_client() is being executed, but the buffer being printed out is empty and it's just the \n that is being printed in the printf() statement at line 28.
Here is the (not all that much) modified main.c:
here is the _3_https_client.c
and here is my log output: