diff --git a/examples/protocols/esp_http_client/esp_http_client_test.py b/examples/protocols/esp_http_client/esp_http_client_test.py index c5da056933..2bdf6b5b24 100644 --- a/examples/protocols/esp_http_client/esp_http_client_test.py +++ b/examples/protocols/esp_http_client/esp_http_client_test.py @@ -36,7 +36,6 @@ def test_examples_protocol_esp_http_client(env, extra_data): dut1.expect(re.compile(r'HTTP Digest Auth Status = 200, content_length = (\d)')) dut1.expect(re.compile(r'HTTP Relative path redirect Status = 200, content_length = (\d)')) dut1.expect(re.compile(r'HTTP Absolute path redirect Status = 200, content_length = (\d)')) - dut1.expect(re.compile(r'HTTP Absolute path redirect \(manual\) Status = 200, content_length = (\d)')) dut1.expect(re.compile(r'HTTPS Status = 200, content_length = (\d)')) dut1.expect(re.compile(r'HTTPS Status = 200, content_length = (\d)')) dut1.expect(re.compile(r'HTTP redirect to HTTPS Status = 200, content_length = (\d)')) @@ -78,7 +77,6 @@ def test_examples_protocol_esp_http_client(env, extra_data): dut1.expect(re.compile(r'HTTP Digest Auth Status = 200, content_length = (\d)')) dut1.expect(re.compile(r'HTTP Relative path redirect Status = 200, content_length = (\d)')) dut1.expect(re.compile(r'HTTP Absolute path redirect Status = 200, content_length = (\d)')) - dut1.expect(re.compile(r'HTTP Absolute path redirect \(manual\) Status = 200, content_length = (\d)')) dut1.expect(re.compile(r'HTTPS Status = 200, content_length = (\d)')) dut1.expect(re.compile(r'HTTPS Status = 200, content_length = (\d)')) dut1.expect(re.compile(r'HTTP redirect to HTTPS Status = 200, content_length = (\d)')) diff --git a/examples/protocols/esp_http_client/main/CMakeLists.txt b/examples/protocols/esp_http_client/main/CMakeLists.txt index d4f2d0ce06..1b140afc46 100644 --- a/examples/protocols/esp_http_client/main/CMakeLists.txt +++ b/examples/protocols/esp_http_client/main/CMakeLists.txt @@ -4,4 +4,5 @@ idf_component_register(SRCS "esp_http_client_example.c" INCLUDE_DIRS "." EMBED_TXTFILES howsmyssl_com_root_cert.pem - dl_espressif_com_root_cert.pem) + dl_espressif_com_root_cert.pem + postman_echo_com_root_cert.pem) diff --git a/examples/protocols/esp_http_client/main/component.mk b/examples/protocols/esp_http_client/main/component.mk index ec82632f92..a96255ef4f 100644 --- a/examples/protocols/esp_http_client/main/component.mk +++ b/examples/protocols/esp_http_client/main/component.mk @@ -5,4 +5,4 @@ # embed files from the "certs" directory as binary data symbols # in the app -COMPONENT_EMBED_TXTFILES := howsmyssl_com_root_cert.pem dl_espressif_com_root_cert.pem +COMPONENT_EMBED_TXTFILES := howsmyssl_com_root_cert.pem dl_espressif_com_root_cert.pem postman_echo_com_root_cert.pem diff --git a/examples/protocols/esp_http_client/main/esp_http_client_example.c b/examples/protocols/esp_http_client/main/esp_http_client_example.c index fe8d455220..d53b297a02 100644 --- a/examples/protocols/esp_http_client/main/esp_http_client_example.c +++ b/examples/protocols/esp_http_client/main/esp_http_client_example.c @@ -41,6 +41,9 @@ extern const char howsmyssl_com_root_cert_pem_end[] asm("_binary_howsmyssl_com extern const char dl_espressif_com_root_cert_pem_start[] asm("_binary_dl_espressif_com_root_cert_pem_start"); extern const char dl_espressif_com_root_cert_pem_end[] asm("_binary_dl_espressif_com_root_cert_pem_end"); +extern const char postman_echo_com_root_cert_pem_start[] asm("_binary_postman_echo_com_root_cert_pem_start"); +extern const char postman_echo_com_root_cert_pem_end[] asm("_binary_postman_echo_com_root_cert_pem_end"); + esp_err_t _http_event_handler(esp_http_client_event_t *evt) { static char *output_buffer; // Buffer to store response of http request from event handler @@ -525,6 +528,7 @@ static void https_async(void) .event_handler = _http_event_handler, .is_async = true, .timeout_ms = 5000, + .cert_pem = postman_echo_com_root_cert_pem_start, }; esp_http_client_handle_t client = esp_http_client_init(&config); esp_err_t err; @@ -622,7 +626,7 @@ static void http_native_request(void) } int data_read = esp_http_client_read_response(client, output_buffer, MAX_HTTP_OUTPUT_BUFFER); if (data_read >= 0) { - ESP_LOGI(TAG, "HTTP GET Status = %d, content_length = %d", + ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %d", esp_http_client_get_status_code(client), esp_http_client_get_content_length(client)); ESP_LOG_BUFFER_HEX(TAG, output_buffer, strlen(output_buffer)); diff --git a/examples/protocols/esp_http_client/main/postman_echo_com_root_cert.pem b/examples/protocols/esp_http_client/main/postman_echo_com_root_cert.pem new file mode 100644 index 0000000000..4bb70093a9 --- /dev/null +++ b/examples/protocols/esp_http_client/main/postman_echo_com_root_cert.pem @@ -0,0 +1,26 @@ +-----BEGIN CERTIFICATE----- +MIIEdTCCA12gAwIBAgIJAKcOSkw0grd/MA0GCSqGSIb3DQEBCwUAMGgxCzAJBgNV +BAYTAlVTMSUwIwYDVQQKExxTdGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTIw +MAYDVQQLEylTdGFyZmllbGQgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0 +eTAeFw0wOTA5MDIwMDAwMDBaFw0zNDA2MjgxNzM5MTZaMIGYMQswCQYDVQQGEwJV +UzEQMA4GA1UECBMHQXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTElMCMGA1UE +ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjE7MDkGA1UEAxMyU3RhcmZp +ZWxkIFNlcnZpY2VzIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IC0gRzIwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDVDDrEKvlO4vW+GZdfjohTsR8/ +y8+fIBNtKTrID30892t2OGPZNmCom15cAICyL1l/9of5JUOG52kbUpqQ4XHj2C0N +Tm/2yEnZtvMaVq4rtnQU68/7JuMauh2WLmo7WJSJR1b/JaCTcFOD2oR0FMNnngRo +Ot+OQFodSk7PQ5E751bWAHDLUu57fa4657wx+UX2wmDPE1kCK4DMNEffud6QZW0C +zyyRpqbn3oUYSXxmTqM6bam17jQuug0DuDPfR+uxa40l2ZvOgdFFRjKWcIfeAg5J +Q4W2bHO7ZOphQazJ1FTfhy/HIrImzJ9ZVGif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