Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Warren <bmw@users.noreply.github.com>2017-01-17 23:13:10 +0300
committerGitHub <noreply@github.com>2017-01-17 23:13:10 +0300
commit16ed5bdd47ddfa581d24a063bab400af91f65c40 (patch)
tree99efcd333bbc3c32c912d7d25ffe22e6549b5087 /certbot-compatibility-test
parent7f3109f185704ff0547c39b38b256a50f90527c0 (diff)
encode to bytes as necessary in Validator.certificate (#4026)
Diffstat (limited to 'certbot-compatibility-test')
-rw-r--r--certbot-compatibility-test/certbot_compatibility_test/validator.py11
-rw-r--r--certbot-compatibility-test/setup.py1
2 files changed, 11 insertions, 1 deletions
diff --git a/certbot-compatibility-test/certbot_compatibility_test/validator.py b/certbot-compatibility-test/certbot_compatibility_test/validator.py
index 333b47296..62dd466a1 100644
--- a/certbot-compatibility-test/certbot_compatibility_test/validator.py
+++ b/certbot-compatibility-test/certbot_compatibility_test/validator.py
@@ -4,6 +4,8 @@ import socket
import requests
import zope.interface
+import six
+
from acme import crypto_util
from acme import errors as acme_errors
from certbot import interfaces
@@ -19,7 +21,14 @@ class Validator(object):
def certificate(self, cert, name, alt_host=None, port=443):
"""Verifies the certificate presented at name is cert"""
- host = alt_host if alt_host else socket.gethostbyname(name)
+ if alt_host is None:
+ host = socket.gethostbyname(name)
+ elif isinstance(alt_host, six.binary_type):
+ host = alt_host
+ else:
+ host = alt_host.encode()
+ name = name if isinstance(name, six.binary_type) else name.encode()
+
try:
presented_cert = crypto_util.probe_sni(name, host, port)
except acme_errors.Error as error:
diff --git a/certbot-compatibility-test/setup.py b/certbot-compatibility-test/setup.py
index fa49d9f3d..e515ede7b 100644
--- a/certbot-compatibility-test/setup.py
+++ b/certbot-compatibility-test/setup.py
@@ -9,6 +9,7 @@ version = '0.11.0.dev0'
install_requires = [
'certbot',
'certbot-apache',
+ 'six',
'requests',
'zope.interface',
]