Merge branch 'bugfix/http_client_ci_v4.3' into 'release/v4.3'

esp_http_client example: Use dl.espressif.com URL for performing request with Range header (v4.3)

See merge request espressif/esp-idf!17317
This commit is contained in:
Mahavir Jain
2022-03-04 11:10:10 +08:00
5 changed files with 43 additions and 3 deletions

View File

@ -34,6 +34,9 @@ def test_examples_protocol_esp_http_client(env, extra_data):
# content-len for chunked encoding is typically -1, could be a positive length in some cases
dut1.expect(re.compile(r'HTTP Stream reader Status = 200, content_length = (\d)'))
dut1.expect(re.compile(r'Last esp error code: 0x8001'))
dut1.expect(re.compile(r'HTTP Status = 206, content_length = (\d)'))
dut1.expect(re.compile(r'HTTP Status = 206, content_length = 10'))
dut1.expect(re.compile(r'HTTP Status = 206, content_length = 10'))
dut1.expect('Finish http example')
# test mbedtls dynamic resource
@ -60,6 +63,9 @@ def test_examples_protocol_esp_http_client(env, extra_data):
# content-len for chunked encoding is typically -1, could be a positive length in some cases
dut1.expect(re.compile(r'HTTP Stream reader Status = 200, content_length = (\d)'))
dut1.expect(re.compile(r'Last esp error code: 0x8001'))
dut1.expect(re.compile(r'HTTP Status = 206, content_length = (\d)'))
dut1.expect(re.compile(r'HTTP Status = 206, content_length = 10'))
dut1.expect(re.compile(r'HTTP Status = 206, content_length = 10'))
dut1.expect('Finish http example')

View File

@ -3,4 +3,5 @@
# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.)
idf_component_register(SRCS "esp_http_client_example.c"
INCLUDE_DIRS "."
EMBED_TXTFILES howsmyssl_com_root_cert.pem)
EMBED_TXTFILES howsmyssl_com_root_cert.pem
dl_espressif_com_root_cert.pem)

View File

@ -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
COMPONENT_EMBED_TXTFILES := howsmyssl_com_root_cert.pem dl_espressif_com_root_cert.pem

View File

@ -0,0 +1,29 @@
-----BEGIN CERTIFICATE-----
MIIE6jCCA9KgAwIBAgIQCjUI1VwpKw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XJ0R2xvYmFsUm9vdENBLmNydDB7BgNV
HR8EdDByMDegNaAzhjFodHRwOi8vY3JsMy5kaWdpY2VydC5jb20vRGlnaUNlcnRH
bG9iYWxSb290Q0EuY3JsMDegNaAzhjFodHRwOi8vY3JsNC5kaWdpY2VydC5jb20v
RGlnaUNlcnRHbG9iYWxSb290Q0EuY3JsMDAGA1UdIAQpMCcwBwYFZ4EMAQEwCAYG
Z4EMAQIBMAgGBmeBDAECAjAIBgZngQwBAgMwDQYJKoZIhvcNAQELBQADggEBAHer
t3onPa679n/gWlbJhKrKW3EX3SJH/E6f7tDBpATho+vFScH90cnfjK+URSxGKqNj
OSD5nkoklEHIqdninFQFBstcHL4AGw+oWv8Zu2XHFq8hVt1hBcnpj5h232sb0HIM
ULkwKXq/YFkQZhM6LawVEWwtIwwCPgU7/uWhnOKK24fXSuhe50gG66sSmvKvhMNb
g0qZgYOrAKHKCjxMoiWJKiKnpPMzTFuMLhoClw+dj20tlQj7T9rxkTgl4ZxuYRiH
as6xuwAwapu3r9rxxZf+ingkquqTgLozZXq8oXfpf2kUCwA/d5KxTVtzhwoT0JzI
8ks5T1KESaZMkE4f97Q=
-----END CERTIFICATE-----

View File

@ -38,6 +38,9 @@ static const char *TAG = "HTTP_CLIENT";
extern const char howsmyssl_com_root_cert_pem_start[] asm("_binary_howsmyssl_com_root_cert_pem_start");
extern const char howsmyssl_com_root_cert_pem_end[] asm("_binary_howsmyssl_com_root_cert_pem_end");
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");
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
@ -632,8 +635,9 @@ static void http_native_request(void)
static void http_partial_download(void)
{
esp_http_client_config_t config = {
.url = "http://jigsaw.w3.org/HTTP/TE/foo.txt",
.url = "https://dl.espressif.com/dl/esp-idf/ci/esp_http_client_demo.txt",
.event_handler = _http_event_handler,
.cert_pem = dl_espressif_com_root_cert_pem_start,
};
esp_http_client_handle_t client = esp_http_client_init(&config);