#include "dynbuf.h"
#include "http1.h"
#include "select.h"
+#include "inet_pton.h"
#include "vquic.h"
#include "vquic_int.h"
#include "vtls/keylog.h"
struct cf_ngtcp2_ctx *ctx = cf->ctx;
const uint8_t *alpn = NULL;
size_t alpnlen = 0;
+ unsigned char checkip[16];
- (void)data;
DEBUGASSERT(!ctx->ssl);
ctx->ssl = SSL_new(ctx->sslctx);
SSL_set_alpn_protos(ctx->ssl, alpn, (int)alpnlen);
/* set SNI */
- SSL_set_tlsext_host_name(ctx->ssl, cf->conn->host.name);
+ if((0 == Curl_inet_pton(AF_INET, cf->conn->host.name, checkip))
+#ifdef ENABLE_IPV6
+ && (0 == Curl_inet_pton(AF_INET6, cf->conn->host.name, checkip))
+#endif
+ ) {
+ char *snihost = Curl_ssl_snihost(data, cf->conn->host.name, NULL);
+ if(!snihost || !SSL_set_tlsext_host_name(ctx->ssl, snihost)) {
+ failf(data, "Failed set SNI");
+ SSL_free(ctx->ssl);
+ ctx->ssl = NULL;
+ return CURLE_QUIC_CONNECT_ERROR;
+ }
+ }
return CURLE_OK;
}
#elif defined(USE_GNUTLS)
#include "vquic_int.h"
#include "curl_quiche.h"
#include "transfer.h"
+#include "inet_pton.h"
#include "vtls/openssl.h"
#include "vtls/keylog.h"
+#include "vtls/vtls.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
static CURLcode quic_ssl_setup(struct Curl_cfilter *cf, struct Curl_easy *data)
{
struct cf_quiche_ctx *ctx = cf->ctx;
+ unsigned char checkip[16];
- (void)data;
DEBUGASSERT(!ctx->sslctx);
ctx->sslctx = SSL_CTX_new(TLS_method());
if(!ctx->sslctx)
return CURLE_QUIC_CONNECT_ERROR;
SSL_set_app_data(ctx->ssl, cf);
- SSL_set_tlsext_host_name(ctx->ssl, cf->conn->host.name);
+
+ if((0 == Curl_inet_pton(AF_INET, cf->conn->host.name, checkip))
+#ifdef ENABLE_IPV6
+ && (0 == Curl_inet_pton(AF_INET6, cf->conn->host.name, checkip))
+#endif
+ ) {
+ char *snihost = Curl_ssl_snihost(data, cf->conn->host.name, NULL);
+ if(!snihost || !SSL_set_tlsext_host_name(ctx->ssl, snihost)) {
+ failf(data, "Failed set SNI");
+ SSL_free(ctx->ssl);
+ ctx->ssl = NULL;
+ return CURLE_QUIC_CONNECT_ERROR;
+ }
+ }
return CURLE_OK;
}