)
                connectionError = True
                return connected

            DebugPrint(4, 'DEBUG: Attempting to connect to HTTPS')
            try:
                if ProxyUtil.findHTTPSProxy():
                    DebugPrint(0,
                               'WARNING: http_proxy is set but not supported')

                # __connection__ = ProxyUtil.HTTPSConnection(Config.get_SSLHost(),
                #                                        cert_file = pr_cert_file,
                #                                        key_file = pr_key_file,
                #                                        http_proxy = ProxyUtil.findHTTPSProxy())

                connection = httplib.HTTPSConnection(Config.get_SSLHost(),
                                                     cert_file=pr_cert_file,
                                                     key_file=pr_key_file)
            except KeyboardInterrupt:
                raise
            except SystemExit:
                raise
            except Exception, ex:
                DebugPrint(0, 'ERROR: could not initialize HTTPS connection')
                DebugPrintTraceback()
                connectionError = True
                return connected
            try:
                prev_handler = signal.signal(signal.SIGALRM,
                                             __handle_timeout__)
                signal.alarm(timeout)
Exemple #2
0
            if pr_cert_file == None:
                DebugPrint(0, 'Error: While trying to connect to HTTPS, no valid local certificate.')
                connectionError = True
                return connected

            DebugPrint(4, 'DEBUG: Attempting to connect to HTTPS')
            try:
                if ProxyUtil.findHTTPSProxy():
                    DebugPrint(0, 'WARNING: http_proxy is set but not supported')

                # __connection__ = ProxyUtil.HTTPSConnection(Config.get_SSLHost(),
                #                                        cert_file = pr_cert_file,
                #                                        key_file = pr_key_file,
                #                                        http_proxy = ProxyUtil.findHTTPSProxy())

                connection = httplib.HTTPSConnection(Config.get_SSLHost(), cert_file=pr_cert_file,
                                                       key_file=pr_key_file)
            except KeyboardInterrupt:
                raise
            except SystemExit:
                raise
            except Exception, ex:
                DebugPrint(0, 'ERROR: could not initialize HTTPS connection')
                DebugPrintTraceback()
                connectionError = True
                return connected
            try:
                prev_handler = signal.signal(signal.SIGALRM, __handle_timeout__)
                signal.alarm(timeout)
                DebugPrint(4, 'DEBUG: Connect')
                connection.connect()