summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2022-01-23 00:14:05 +0100
committerDaniel Stenberg <daniel@haxx.se>2022-01-23 11:59:55 +0100
commit19ac2f640c6485caf9c85230b23db5320864b7ff (patch)
tree1f07d22427de0f2ce8ae74c0b10ca5c8057ec88f
parentadcddc214e452d3bfeb3c93bceb775a5ccd3f519 (diff)
downloadcurl-19ac2f640c6485caf9c85230b23db5320864b7ff.tar.gz
rustls: set the right SNI name
-rw-r--r--lib/vtls/rustls.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/vtls/rustls.c b/lib/vtls/rustls.c
index 51230b196..d419dfb0e 100644
--- a/lib/vtls/rustls.c
+++ b/lib/vtls/rustls.c
@@ -368,7 +368,12 @@ cr_init_backend(struct Curl_easy *data, struct connectdata *conn,
backend->config = rustls_client_config_builder_build(config_builder);
DEBUGASSERT(rconn == NULL);
- result = rustls_client_connection_new(backend->config, hostname, &rconn);
+ {
+ char *snihost = Curl_ssl_snihost(data, hostname, NULL);
+ if(!snihost)
+ return CURLE_SSL_CONNECT_ERROR;
+ result = rustls_client_connection_new(backend->config, snihost, &rconn);
+ }
if(result != RUSTLS_RESULT_OK) {
rustls_error(result, errorbuf, sizeof(errorbuf), &errorlen);
failf(data, "rustls_client_connection_new: %.*s", errorlen, errorbuf);