diff -r 23f8a511050a Doc/library/ssl.rst --- a/Doc/library/ssl.rst Sat Nov 22 14:41:21 2014 -0800 +++ b/Doc/library/ssl.rst Sun Nov 23 16:25:50 2014 -0500 @@ -680,8 +680,7 @@ .. data:: HAS_SNI Whether the OpenSSL library has built-in support for the *Server Name - Indication* extension (as defined in :rfc:`4366`). When true, you can - use the *server_hostname* argument to :meth:`SSLContext.wrap_socket`. + Indication* extension (as defined in :rfc:`4366`). .. versionadded:: 3.2 @@ -1259,11 +1258,12 @@ On client connections, the optional parameter *server_hostname* specifies the hostname of the service which we are connecting to. This allows a single server to host multiple SSL-based services with distinct certificates, - quite similarly to HTTP virtual hosts. Specifying *server_hostname* - will raise a :exc:`ValueError` if the OpenSSL library doesn't have support - for it (that is, if :data:`HAS_SNI` is :const:`False`). Specifying - *server_hostname* will also raise a :exc:`ValueError` if *server_side* - is true. + quite similarly to HTTP virtual hosts. Specifying *server_hostname* will + raise a :exc:`ValueError` if *server_side* is true. + + .. versionchanged:: 3.5 + Always allow a server_hostname to be passed, even if OpenSSL does not + have SNI. .. method:: SSLContext.wrap_bio(incoming, outgoing, server_side=False, \ server_hostname=None) diff -r 23f8a511050a Modules/_ssl.c --- a/Modules/_ssl.c Sat Nov 22 14:41:21 2014 -0800 +++ b/Modules/_ssl.c Sun Nov 23 16:25:50 2014 -0500 @@ -1542,7 +1542,7 @@ } PyDoc_STRVAR(PySSL_get_server_hostname_doc, -"The currently set server hostname (for SNI)."); +"The currently set server hostname."); static PyObject * PySSL_get_owner(PySSLSocket *self, void *c) @@ -2922,12 +2922,6 @@ &sock, &server_side, "idna", &hostname)) return NULL; -#if !HAVE_SNI - PyMem_Free(hostname); - PyErr_SetString(PyExc_ValueError, "server_hostname is not supported " - "by your OpenSSL library"); - return NULL; -#endif } res = (PyObject *) newPySSLSocket(self, sock, server_side, hostname, @@ -2955,14 +2949,8 @@ &server_side, &hostname_obj)) return NULL; if (hostname_obj != Py_None) { -#if HAVE_SNI if (!PyArg_Parse(hostname_obj, "et", "idna", &hostname)) return NULL; -#else - PyErr_SetString(PyExc_ValueError, "server_hostname is not supported " - "by your OpenSSL library"); - return NULL; -#endif } res = (PyObject *) newPySSLSocket(self, NULL, server_side, hostname,