aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/hazmat/backends/openssl/decode_asn1.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2017-09-13 22:06:12 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2017-09-13 10:06:12 -0400
commit8c1f5edd12d755c770d1fd3a6dc8251c95588600 (patch)
treee8d9287d4660f26022b5775478bcd0d3549b38ff /src/cryptography/hazmat/backends/openssl/decode_asn1.py
parentfbfc36da2a4769045f2373b004ddf0aff906cf38 (diff)
downloadcryptography-8c1f5edd12d755c770d1fd3a6dc8251c95588600.tar.gz
cryptography-8c1f5edd12d755c770d1fd3a6dc8251c95588600.tar.bz2
cryptography-8c1f5edd12d755c770d1fd3a6dc8251c95588600.zip
fix a bug with URI value when parsing a string with no hostname (#3909)
strings of the form "scheme:///anything" would incorrectly have two slashes dropped. This is fixed in two code paths in this PR but one of those code paths will be entirely removed in a followup PR.
Diffstat (limited to 'src/cryptography/hazmat/backends/openssl/decode_asn1.py')
-rw-r--r--src/cryptography/hazmat/backends/openssl/decode_asn1.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/decode_asn1.py b/src/cryptography/hazmat/backends/openssl/decode_asn1.py
index 9c2d763e..f178af07 100644
--- a/src/cryptography/hazmat/backends/openssl/decode_asn1.py
+++ b/src/cryptography/hazmat/backends/openssl/decode_asn1.py
@@ -102,7 +102,8 @@ def _decode_general_name(backend, gn):
if parsed.hostname:
hostname = idna.decode(parsed.hostname)
else:
- hostname = ""
+ # There's no IDNA so we can immediately return
+ return x509.UniformResourceIdentifier(data)
if parsed.port:
netloc = hostname + u":" + six.text_type(parsed.port)
else: