"""A simplified HTTPSConnection class that supports HTTP/1.1."""

import ssl
from http.client import HTTPConnection, HTTPS_PORT

class HTTPSConnection(HTTPConnection):

    default_port = HTTPS_PORT

    def __init__(self, host, port=None, ssl_context=None, **kwds):
        if ssl_context is None:
            ssl_context = ssl.create_default_context()
            ssl_context.check_hostname = False
            ssl_context.verify_mode = ssl.CERT_NONE
        self.ssl_ctx = ssl_context
        HTTPConnection.__init__(self, host, port)

    def connect(self):
        HTTPConnection.connect(self)
        self.sock = self.ssl_ctx.wrap_socket(
            self.sock, server_hostname=self.host)
