diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2013-11-29 21:13:30 +0000 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2013-11-29 21:13:30 +0000 |
commit | b8eaeebf2188092b22b7009fc07b019b5cf12622 (patch) | |
tree | dc0d863544dddc2301549075ce9e8c86eed42f3b /lib/libfetch | |
parent | 8769ca55002aa8fd27b5e64c0e1d78f54b0bbfdd (diff) | |
download | FreeBSD-src-b8eaeebf2188092b22b7009fc07b019b5cf12622.zip FreeBSD-src-b8eaeebf2188092b22b7009fc07b019b5cf12622.tar.gz |
MFC r258347,r258349:
Support SNI in libfetch
SNI is Server Name Indentification which is a protocol for TLS that
indicates the host that is being connected to at the start of the
handshake. It allows to use Virtual Hosts on HTTPS.
PR: kern/183583
Approved by: bapt (implicit)
Approved by: re (gjb)
Diffstat (limited to 'lib/libfetch')
-rw-r--r-- | lib/libfetch/common.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index 15d5a25..49d268c 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -829,6 +829,16 @@ fetch_ssl(conn_t *conn, const struct url *URL, int verbose) return (-1); } SSL_set_fd(conn->ssl, conn->sd); + +#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) + if (!SSL_set_tlsext_host_name(conn->ssl, + __DECONST(struct url *, URL)->host)) { + fprintf(stderr, + "TLS server name indication extension failed for host %s\n", + URL->host); + return (-1); + } +#endif while ((ret = SSL_connect(conn->ssl)) == -1) { ssl_err = SSL_get_error(conn->ssl, ret); if (ssl_err != SSL_ERROR_WANT_READ && |