Skip to content

Commit

Permalink
Merge branch 'contrib/github_pr_10130' into 'master'
Browse files Browse the repository at this point in the history
allow https server to accept and pass thru alpn protocols (GitHub PR)

Closes IDFGH-8686

See merge request espressif/esp-idf!21008
  • Loading branch information
mahavirj committed Nov 11, 2022
2 parents c093224 + 3223012 commit 5ac2bb7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/esp_https_server/include/esp_https_server.h
Expand Up @@ -99,6 +99,8 @@ struct httpd_ssl_config {

void *ssl_userdata; /*!< user data to add to the ssl context */
esp_tls_handshake_callback cert_select_cb; /*!< Certificate selection callback to use */

const char** alpn_protos; /*!< Application protocols the server supports in order of prefernece. Used for negotiating during the TLS handshake, first one the client supports is selected. The data structure must live as long as the https server itself! */
};

typedef struct httpd_ssl_config httpd_ssl_config_t;
Expand Down Expand Up @@ -149,7 +151,8 @@ typedef struct httpd_ssl_config httpd_ssl_config_t;
.use_secure_element = false, \
.user_cb = NULL, \
.ssl_userdata = NULL, \
.cert_select_cb = NULL \
.cert_select_cb = NULL, \
.alpn_protos = NULL, \
}

/**
Expand Down
3 changes: 3 additions & 0 deletions components/esp_https_server/src/https_server.c
Expand Up @@ -212,6 +212,9 @@ static httpd_ssl_ctx_t *create_secure_context(const struct httpd_ssl_config *con

cfg->userdata = config->ssl_userdata;


cfg->alpn_protos = config->alpn_protos;

#if defined(CONFIG_ESP_TLS_SERVER_CERT_SELECT_HOOK)
cfg->cert_select_cb = config->cert_select_cb;
#endif
Expand Down

0 comments on commit 5ac2bb7

Please sign in to comment.