def shutdown_request(self, request: Union[socket.socket, Tuple[bytes, socket.socket]]) -> None:
        """Shut down a request to the REST API.

        Wrapper for :func:`http.server.HTTPServer.shutdown_request` that additionally:

            * Perform SSL shutdown handshake (if a SSL socket).

        :param request: socket to handle the client request.
        """
        if hasattr(request, 'context'):  # SSLSocket
            try:
                from ssl import SSLSocket
                if isinstance(request, SSLSocket):  # pyright
                    request.unwrap()
            except Exception as e:
                logger.debug('Failed to shutdown SSL connection: %r', e)
        super(RestApiServer, self).shutdown_request(request)
Shut down a request to the REST API.

        Wrapper for :func:`http.server.HTTPServer.shutdown_request` that additionally:

            * Perform SSL shutdown handshake (if a SSL socket).

        :param request: socket to handle the client request.
        
patroni/api.py