HTTPS library pulls wrong characters?
Posted: Sat Aug 17, 2019 8:51 pm
I'm getting a strange error here. I have the following code to read a short HTTPS page.
The page is generated on my server using flask, and going to it in a web browser prints "test phrase True"
curl <test page url> gives the same output.
When I run the following code on the ESP32, it spits out:
"Data read: test phrase Tru@0"
What do I have wrong here?
The page is generated on my server using flask, and going to it in a web browser prints "test phrase True"
curl <test page url> gives the same output.
When I run the following code on the ESP32, it spits out:
"Data read: test phrase Tru@0"
What do I have wrong here?
- ESP_LOGI(TAG, "Checking Test Page");
- esp_http_client_config_t http_config = {
- .url = CHECK_URL,
- .event_handler = _http_event_handler,
- .cert_pem = (char *)server_cert_pem_start
- };
- esp_http_client_handle_t client = esp_http_client_init(&http_config);
- esp_err_t err = esp_http_client_perform(client);
- if (err == ESP_OK) {
- int statuscode = esp_http_client_get_status_code(client);
- int length = esp_http_client_get_content_length(client);
- ESP_LOGI(TAG, "Status = %d, content_length = %d",statuscode, length);
- char readbuffer[length];
- err = esp_http_client_read(client, readbuffer, length);
- ESP_LOGI(TAG, "Data read: %s", readbuffer);