Author: bdrewery (ports committer)
Date: Mon Dec  2 10:59:41 2013
New Revision: 258844
URL: http://svnweb.freebsd.org/changeset/base/258844

Log:
  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)

Modified:
  stable/9/lib/libfetch/common.c
Directory Properties:
  stable/9/lib/libfetch/   (props changed)

Modified: stable/9/lib/libfetch/common.c
==============================================================================
--- stable/9/lib/libfetch/common.c      Mon Dec  2 10:18:25 2013        
(r258843)
+++ stable/9/lib/libfetch/common.c      Mon Dec  2 10:59:41 2013        
(r258844)
@@ -829,6 +829,16 @@ fetch_ssl(conn_t *conn, const struct url
                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 &&
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "[email protected]"

Reply via email to