Merge branch 'feat/add_alpn_for_esp_http_client' into 'master'

feat(esp_http_client): Added alpn feature in esp_http_client

Closes IDF-10729

See merge request espressif/esp-idf!34708
This commit is contained in:
Mahavir Jain
2024-11-18 13:14:24 +08:00
2 changed files with 9 additions and 0 deletions

View File

@@ -691,6 +691,11 @@ static bool init_common_tcp_transport(esp_http_client_handle_t client, const esp
}
esp_transport_tcp_set_interface_name(transport, client->if_name);
}
#if CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS
if (config->alpn_protos) {
esp_transport_ssl_set_alpn_protocol(transport, config->alpn_protos);
}
#endif
return true;
}

View File

@@ -178,6 +178,10 @@ typedef struct {
int keep_alive_interval; /*!< Keep-alive interval time. Default is 5 (second) */
int keep_alive_count; /*!< Keep-alive packet retry send count. Default is 3 counts */
struct ifreq *if_name; /*!< The name of interface for data to go through. Use the default interface without setting */
#if CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS
const char **alpn_protos; /*!< Application protocols required for HTTP2. If HTTP2/ALPN support is required, a list of protocols that should be negotiated. The format is length followed by protocol
name. For the most common cases the following is ok: const char **alpn_protos = { "h2", NULL }; - where 'h2' is the protocol name */
#endif
#if CONFIG_ESP_TLS_USE_SECURE_ELEMENT
bool use_secure_element; /*!< Enable this option to use secure element */
#endif