Added support for server name indication (RFC 4366).
Patch submitted by Kaspar Brand.
This commit is contained in:
15
lib/gtls.c
15
lib/gtls.c
@@ -43,6 +43,7 @@
|
||||
|
||||
#include "urldata.h"
|
||||
#include "sendf.h"
|
||||
#include "inet_pton.h"
|
||||
#include "gtls.h"
|
||||
#include "sslgen.h"
|
||||
#include "parsedate.h"
|
||||
@@ -229,6 +230,11 @@ Curl_gtls_connect(struct connectdata *conn,
|
||||
const char *ptr;
|
||||
void *ssl_sessionid;
|
||||
size_t ssl_idsize;
|
||||
#ifdef ENABLE_IPV6
|
||||
struct in6_addr addr;
|
||||
#else
|
||||
struct in_addr addr;
|
||||
#endif
|
||||
|
||||
if(!gtls_inited)
|
||||
_Curl_gtls_init();
|
||||
@@ -275,6 +281,15 @@ Curl_gtls_connect(struct connectdata *conn,
|
||||
/* convenient assign */
|
||||
session = conn->ssl[sockindex].session;
|
||||
|
||||
if ((0 == Curl_inet_pton(AF_INET, conn->host.name, &addr)) &&
|
||||
#ifdef ENABLE_IPV6
|
||||
(0 == Curl_inet_pton(AF_INET6, conn->host.name, &addr)) &&
|
||||
#endif
|
||||
(gnutls_server_name_set(session, GNUTLS_NAME_DNS, conn->host.name,
|
||||
strlen(conn->host.name)) < 0))
|
||||
infof(data, "WARNING: failed to configure server name indication (SNI) "
|
||||
"TLS extension\n");
|
||||
|
||||
/* Use default priorities */
|
||||
rc = gnutls_set_default_priority(session);
|
||||
if(rc < 0)
|
||||
|
||||
Reference in New Issue
Block a user