author | Augie Fackler <augie@google.com> |
Fri, 27 Apr 2018 11:06:49 -0400 | |
changeset 37898 | 2ae6a3134362 |
parent 37875 | 078c3eec2d5c |
child 37955 | d088810c496e |
permissions | -rw-r--r-- |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
1 |
# coding=utf-8 |
28914
63fe5ddb8715
tests: make test-url use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28677
diff
changeset
|
2 |
from __future__ import absolute_import, print_function |
63fe5ddb8715
tests: make test-url use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28677
diff
changeset
|
3 |
|
63fe5ddb8715
tests: make test-url use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28677
diff
changeset
|
4 |
import doctest |
15398
474279be5add
tests: fix readline escape characters in heredoctest.py/test-url.py
Brodie Rao <brodie@bitheap.org>
parents:
15018
diff
changeset
|
5 |
import os |
12592
f2937d6492c5
url: verify correctness of https server certificates (issue2407)
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
6 |
|
f2937d6492c5
url: verify correctness of https server certificates (issue2407)
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
7 |
def check(a, b): |
f2937d6492c5
url: verify correctness of https server certificates (issue2407)
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
8 |
if a != b: |
28677
2903558a6991
py3: make test-url use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
26421
diff
changeset
|
9 |
print((a, b)) |
12592
f2937d6492c5
url: verify correctness of https server certificates (issue2407)
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
10 |
|
12606
5c8353692123
test-url: refactor with shorter lines
Martin Geisler <mg@aragost.com>
parents:
12592
diff
changeset
|
11 |
def cert(cn): |
20685
56b1f39dd0c1
test-url: move from dict() construction to {} literals
Augie Fackler <raf@durin42.com>
parents:
15611
diff
changeset
|
12 |
return {'subject': ((('commonName', cn),),)} |
12606
5c8353692123
test-url: refactor with shorter lines
Martin Geisler <mg@aragost.com>
parents:
12592
diff
changeset
|
13 |
|
28914
63fe5ddb8715
tests: make test-url use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28677
diff
changeset
|
14 |
from mercurial import ( |
63fe5ddb8715
tests: make test-url use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28677
diff
changeset
|
15 |
sslutil, |
63fe5ddb8715
tests: make test-url use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28677
diff
changeset
|
16 |
) |
12592
f2937d6492c5
url: verify correctness of https server certificates (issue2407)
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
17 |
|
28914
63fe5ddb8715
tests: make test-url use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28677
diff
changeset
|
18 |
_verifycert = sslutil._verifycert |
12724
66e7ba85585b
test-url: remove trailing whitespace
Augie Fackler <durin42@gmail.com>
parents:
12606
diff
changeset
|
19 |
# Test non-wildcard certificates |
12606
5c8353692123
test-url: refactor with shorter lines
Martin Geisler <mg@aragost.com>
parents:
12592
diff
changeset
|
20 |
check(_verifycert(cert('example.com'), 'example.com'), |
5c8353692123
test-url: refactor with shorter lines
Martin Geisler <mg@aragost.com>
parents:
12592
diff
changeset
|
21 |
None) |
5c8353692123
test-url: refactor with shorter lines
Martin Geisler <mg@aragost.com>
parents:
12592
diff
changeset
|
22 |
check(_verifycert(cert('example.com'), 'www.example.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
23 |
b'certificate is for example.com') |
12606
5c8353692123
test-url: refactor with shorter lines
Martin Geisler <mg@aragost.com>
parents:
12592
diff
changeset
|
24 |
check(_verifycert(cert('www.example.com'), 'example.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
25 |
b'certificate is for www.example.com') |
12592
f2937d6492c5
url: verify correctness of https server certificates (issue2407)
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
26 |
|
f2937d6492c5
url: verify correctness of https server certificates (issue2407)
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
27 |
# Test wildcard certificates |
12606
5c8353692123
test-url: refactor with shorter lines
Martin Geisler <mg@aragost.com>
parents:
12592
diff
changeset
|
28 |
check(_verifycert(cert('*.example.com'), 'www.example.com'), |
5c8353692123
test-url: refactor with shorter lines
Martin Geisler <mg@aragost.com>
parents:
12592
diff
changeset
|
29 |
None) |
5c8353692123
test-url: refactor with shorter lines
Martin Geisler <mg@aragost.com>
parents:
12592
diff
changeset
|
30 |
check(_verifycert(cert('*.example.com'), 'example.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
31 |
b'certificate is for *.example.com') |
12606
5c8353692123
test-url: refactor with shorter lines
Martin Geisler <mg@aragost.com>
parents:
12592
diff
changeset
|
32 |
check(_verifycert(cert('*.example.com'), 'w.w.example.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
33 |
b'certificate is for *.example.com') |
12592
f2937d6492c5
url: verify correctness of https server certificates (issue2407)
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
34 |
|
13249
75d0c38a0bca
url: check subjectAltName when verifying ssl certificate
Yuya Nishihara <yuya@tcha.org>
parents:
13248
diff
changeset
|
35 |
# Test subjectAltName |
75d0c38a0bca
url: check subjectAltName when verifying ssl certificate
Yuya Nishihara <yuya@tcha.org>
parents:
13248
diff
changeset
|
36 |
san_cert = {'subject': ((('commonName', 'example.com'),),), |
75d0c38a0bca
url: check subjectAltName when verifying ssl certificate
Yuya Nishihara <yuya@tcha.org>
parents:
13248
diff
changeset
|
37 |
'subjectAltName': (('DNS', '*.example.net'), |
75d0c38a0bca
url: check subjectAltName when verifying ssl certificate
Yuya Nishihara <yuya@tcha.org>
parents:
13248
diff
changeset
|
38 |
('DNS', 'example.net'))} |
75d0c38a0bca
url: check subjectAltName when verifying ssl certificate
Yuya Nishihara <yuya@tcha.org>
parents:
13248
diff
changeset
|
39 |
check(_verifycert(san_cert, 'example.net'), |
75d0c38a0bca
url: check subjectAltName when verifying ssl certificate
Yuya Nishihara <yuya@tcha.org>
parents:
13248
diff
changeset
|
40 |
None) |
75d0c38a0bca
url: check subjectAltName when verifying ssl certificate
Yuya Nishihara <yuya@tcha.org>
parents:
13248
diff
changeset
|
41 |
check(_verifycert(san_cert, 'foo.example.net'), |
75d0c38a0bca
url: check subjectAltName when verifying ssl certificate
Yuya Nishihara <yuya@tcha.org>
parents:
13248
diff
changeset
|
42 |
None) |
14666
27b080aa880a
sslutil: fall back to commonName when no dNSName in subjectAltName (issue2798)
Nicolas Bareil <nico@chdir.org>
parents:
14313
diff
changeset
|
43 |
# no fallback to subject commonName when subjectAltName has DNS |
13249
75d0c38a0bca
url: check subjectAltName when verifying ssl certificate
Yuya Nishihara <yuya@tcha.org>
parents:
13248
diff
changeset
|
44 |
check(_verifycert(san_cert, 'example.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
45 |
b'certificate is for *.example.net, example.net') |
14666
27b080aa880a
sslutil: fall back to commonName when no dNSName in subjectAltName (issue2798)
Nicolas Bareil <nico@chdir.org>
parents:
14313
diff
changeset
|
46 |
# fallback to subject commonName when no DNS in subjectAltName |
27b080aa880a
sslutil: fall back to commonName when no dNSName in subjectAltName (issue2798)
Nicolas Bareil <nico@chdir.org>
parents:
14313
diff
changeset
|
47 |
san_cert = {'subject': ((('commonName', 'example.com'),),), |
27b080aa880a
sslutil: fall back to commonName when no dNSName in subjectAltName (issue2798)
Nicolas Bareil <nico@chdir.org>
parents:
14313
diff
changeset
|
48 |
'subjectAltName': (('IP Address', '8.8.8.8'),)} |
27b080aa880a
sslutil: fall back to commonName when no dNSName in subjectAltName (issue2798)
Nicolas Bareil <nico@chdir.org>
parents:
14313
diff
changeset
|
49 |
check(_verifycert(san_cert, 'example.com'), None) |
13249
75d0c38a0bca
url: check subjectAltName when verifying ssl certificate
Yuya Nishihara <yuya@tcha.org>
parents:
13248
diff
changeset
|
50 |
|
12592
f2937d6492c5
url: verify correctness of https server certificates (issue2407)
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
51 |
# Avoid some pitfalls |
12606
5c8353692123
test-url: refactor with shorter lines
Martin Geisler <mg@aragost.com>
parents:
12592
diff
changeset
|
52 |
check(_verifycert(cert('*.foo'), 'foo'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
53 |
b'certificate is for *.foo') |
29452
26a5d605b868
sslutil: synchronize hostname matching logic with CPython
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29451
diff
changeset
|
54 |
check(_verifycert(cert('*o'), 'foo'), None) |
12592
f2937d6492c5
url: verify correctness of https server certificates (issue2407)
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
55 |
|
12742
6ab4a7d3c179
url: validity (notBefore/notAfter) is checked by OpenSSL (issue2407)
Mads Kiilerich <mads@kiilerich.com>
parents:
12738
diff
changeset
|
56 |
check(_verifycert({'subject': ()}, |
12606
5c8353692123
test-url: refactor with shorter lines
Martin Geisler <mg@aragost.com>
parents:
12592
diff
changeset
|
57 |
'example.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
58 |
b'no commonName or subjectAltName found in certificate') |
12592
f2937d6492c5
url: verify correctness of https server certificates (issue2407)
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
59 |
check(_verifycert(None, 'example.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
60 |
b'no certificate received') |
13248
00411a4fa1bb
url: fix UnicodeDecodeError on certificate verification error
Yuya Nishihara <yuya@tcha.org>
parents:
12865
diff
changeset
|
61 |
|
14666
27b080aa880a
sslutil: fall back to commonName when no dNSName in subjectAltName (issue2798)
Nicolas Bareil <nico@chdir.org>
parents:
14313
diff
changeset
|
62 |
# Unicode (IDN) certname isn't supported |
27b080aa880a
sslutil: fall back to commonName when no dNSName in subjectAltName (issue2798)
Nicolas Bareil <nico@chdir.org>
parents:
14313
diff
changeset
|
63 |
check(_verifycert(cert(u'\u4f8b.jp'), 'example.jp'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
64 |
b'IDN in certificate not supported') |
14666
27b080aa880a
sslutil: fall back to commonName when no dNSName in subjectAltName (issue2798)
Nicolas Bareil <nico@chdir.org>
parents:
14313
diff
changeset
|
65 |
|
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
66 |
# The following tests are from CPython's test_ssl.py. |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
67 |
check(_verifycert(cert('example.com'), 'example.com'), None) |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
68 |
check(_verifycert(cert('example.com'), 'ExAmple.cOm'), None) |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
69 |
check(_verifycert(cert('example.com'), 'www.example.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
70 |
b'certificate is for example.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
71 |
check(_verifycert(cert('example.com'), '.example.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
72 |
b'certificate is for example.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
73 |
check(_verifycert(cert('example.com'), 'example.org'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
74 |
b'certificate is for example.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
75 |
check(_verifycert(cert('example.com'), 'exampleXcom'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
76 |
b'certificate is for example.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
77 |
check(_verifycert(cert('*.a.com'), 'foo.a.com'), None) |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
78 |
check(_verifycert(cert('*.a.com'), 'bar.foo.a.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
79 |
b'certificate is for *.a.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
80 |
check(_verifycert(cert('*.a.com'), 'a.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
81 |
b'certificate is for *.a.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
82 |
check(_verifycert(cert('*.a.com'), 'Xa.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
83 |
b'certificate is for *.a.com') |
29452
26a5d605b868
sslutil: synchronize hostname matching logic with CPython
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29451
diff
changeset
|
84 |
check(_verifycert(cert('*.a.com'), '.a.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
85 |
b'certificate is for *.a.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
86 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
87 |
# only match one left-most wildcard |
29452
26a5d605b868
sslutil: synchronize hostname matching logic with CPython
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29451
diff
changeset
|
88 |
check(_verifycert(cert('f*.com'), 'foo.com'), None) |
26a5d605b868
sslutil: synchronize hostname matching logic with CPython
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29451
diff
changeset
|
89 |
check(_verifycert(cert('f*.com'), 'f.com'), None) |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
90 |
check(_verifycert(cert('f*.com'), 'bar.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
91 |
b'certificate is for f*.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
92 |
check(_verifycert(cert('f*.com'), 'foo.a.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
93 |
b'certificate is for f*.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
94 |
check(_verifycert(cert('f*.com'), 'bar.foo.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
95 |
b'certificate is for f*.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
96 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
97 |
# NULL bytes are bad, CVE-2013-4073 |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
98 |
check(_verifycert(cert('null.python.org\x00example.org'), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
99 |
'null.python.org\x00example.org'), None) |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
100 |
check(_verifycert(cert('null.python.org\x00example.org'), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
101 |
'example.org'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
102 |
b'certificate is for null.python.org\x00example.org') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
103 |
check(_verifycert(cert('null.python.org\x00example.org'), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
104 |
'null.python.org'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
105 |
b'certificate is for null.python.org\x00example.org') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
106 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
107 |
# error cases with wildcards |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
108 |
check(_verifycert(cert('*.*.a.com'), 'bar.foo.a.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
109 |
b'certificate is for *.*.a.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
110 |
check(_verifycert(cert('*.*.a.com'), 'a.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
111 |
b'certificate is for *.*.a.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
112 |
check(_verifycert(cert('*.*.a.com'), 'Xa.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
113 |
b'certificate is for *.*.a.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
114 |
check(_verifycert(cert('*.*.a.com'), '.a.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
115 |
b'certificate is for *.*.a.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
116 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
117 |
check(_verifycert(cert('a.*.com'), 'a.foo.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
118 |
b'certificate is for a.*.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
119 |
check(_verifycert(cert('a.*.com'), 'a..com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
120 |
b'certificate is for a.*.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
121 |
check(_verifycert(cert('a.*.com'), 'a.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
122 |
b'certificate is for a.*.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
123 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
124 |
# wildcard doesn't match IDNA prefix 'xn--' |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
125 |
idna = u'püthon.python.org'.encode('idna').decode('ascii') |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
126 |
check(_verifycert(cert(idna), idna), None) |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
127 |
check(_verifycert(cert('x*.python.org'), idna), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
128 |
b'certificate is for x*.python.org') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
129 |
check(_verifycert(cert('xn--p*.python.org'), idna), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
130 |
b'certificate is for xn--p*.python.org') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
131 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
132 |
# wildcard in first fragment and IDNA A-labels in sequent fragments |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
133 |
# are supported. |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
134 |
idna = u'www*.pythön.org'.encode('idna').decode('ascii') |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
135 |
check(_verifycert(cert(idna), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
136 |
u'www.pythön.org'.encode('idna').decode('ascii')), |
29452
26a5d605b868
sslutil: synchronize hostname matching logic with CPython
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29451
diff
changeset
|
137 |
None) |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
138 |
check(_verifycert(cert(idna), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
139 |
u'www1.pythön.org'.encode('idna').decode('ascii')), |
29452
26a5d605b868
sslutil: synchronize hostname matching logic with CPython
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29451
diff
changeset
|
140 |
None) |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
141 |
check(_verifycert(cert(idna), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
142 |
u'ftp.pythön.org'.encode('idna').decode('ascii')), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
143 |
b'certificate is for www*.xn--pythn-mua.org') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
144 |
check(_verifycert(cert(idna), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
145 |
u'pythön.org'.encode('idna').decode('ascii')), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
146 |
b'certificate is for www*.xn--pythn-mua.org') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
147 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
148 |
c = { |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
149 |
'notAfter': 'Jun 26 21:41:46 2011 GMT', |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
150 |
'subject': (((u'commonName', u'linuxfrz.org'),),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
151 |
'subjectAltName': ( |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
152 |
('DNS', 'linuxfr.org'), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
153 |
('DNS', 'linuxfr.com'), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
154 |
('othername', '<unsupported>'), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
155 |
) |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
156 |
} |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
157 |
check(_verifycert(c, 'linuxfr.org'), None) |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
158 |
check(_verifycert(c, 'linuxfr.com'), None) |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
159 |
# Not a "DNS" entry |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
160 |
check(_verifycert(c, '<unsupported>'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
161 |
b'certificate is for linuxfr.org, linuxfr.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
162 |
# When there is a subjectAltName, commonName isn't used |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
163 |
check(_verifycert(c, 'linuxfrz.org'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
164 |
b'certificate is for linuxfr.org, linuxfr.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
165 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
166 |
# A pristine real-world example |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
167 |
c = { |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
168 |
'notAfter': 'Dec 18 23:59:59 2011 GMT', |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
169 |
'subject': ( |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
170 |
((u'countryName', u'US'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
171 |
((u'stateOrProvinceName', u'California'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
172 |
((u'localityName', u'Mountain View'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
173 |
((u'organizationName', u'Google Inc'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
174 |
((u'commonName', u'mail.google.com'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
175 |
), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
176 |
} |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
177 |
check(_verifycert(c, 'mail.google.com'), None) |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
178 |
check(_verifycert(c, 'gmail.com'), b'certificate is for mail.google.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
179 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
180 |
# Only commonName is considered |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
181 |
check(_verifycert(c, 'California'), b'certificate is for mail.google.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
182 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
183 |
# Neither commonName nor subjectAltName |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
184 |
c = { |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
185 |
'notAfter': 'Dec 18 23:59:59 2011 GMT', |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
186 |
'subject': ( |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
187 |
((u'countryName', u'US'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
188 |
((u'stateOrProvinceName', u'California'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
189 |
((u'localityName', u'Mountain View'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
190 |
((u'organizationName', u'Google Inc'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
191 |
), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
192 |
} |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
193 |
check(_verifycert(c, 'mail.google.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
194 |
b'no commonName or subjectAltName found in certificate') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
195 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
196 |
# No DNS entry in subjectAltName but a commonName |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
197 |
c = { |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
198 |
'notAfter': 'Dec 18 23:59:59 2099 GMT', |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
199 |
'subject': ( |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
200 |
((u'countryName', u'US'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
201 |
((u'stateOrProvinceName', u'California'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
202 |
((u'localityName', u'Mountain View'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
203 |
((u'commonName', u'mail.google.com'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
204 |
), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
205 |
'subjectAltName': (('othername', 'blabla'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
206 |
} |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
207 |
check(_verifycert(c, 'mail.google.com'), None) |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
208 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
209 |
# No DNS entry subjectAltName and no commonName |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
210 |
c = { |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
211 |
'notAfter': 'Dec 18 23:59:59 2099 GMT', |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
212 |
'subject': ( |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
213 |
((u'countryName', u'US'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
214 |
((u'stateOrProvinceName', u'California'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
215 |
((u'localityName', u'Mountain View'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
216 |
((u'organizationName', u'Google Inc'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
217 |
), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
218 |
'subjectAltName': (('othername', 'blabla'),), |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
219 |
} |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
220 |
check(_verifycert(c, 'google.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
221 |
b'no commonName or subjectAltName found in certificate') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
222 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
223 |
# Empty cert / no cert |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
224 |
check(_verifycert(None, 'example.com'), b'no certificate received') |
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
225 |
check(_verifycert({}, 'example.com'), b'no certificate received') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
226 |
|
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
227 |
# avoid denials of service by refusing more than one |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
228 |
# wildcard per fragment. |
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
229 |
check(_verifycert({'subject': (((u'commonName', u'a*b.com'),),)}, |
29452
26a5d605b868
sslutil: synchronize hostname matching logic with CPython
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29451
diff
changeset
|
230 |
'axxb.com'), None) |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
231 |
check(_verifycert({'subject': (((u'commonName', u'a*b.co*'),),)}, |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
232 |
'axxb.com'), b'certificate is for a*b.co*') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
233 |
check(_verifycert({'subject': (((u'commonName', u'a*b*.com'),),)}, |
29452
26a5d605b868
sslutil: synchronize hostname matching logic with CPython
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29451
diff
changeset
|
234 |
'axxbxxc.com'), |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
235 |
b'too many wildcards in certificate DNS name: a*b*.com') |
29451
676f4d0e3a7b
tests: import CPython's hostname matching tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28914
diff
changeset
|
236 |
|
13770 | 237 |
def test_url(): |
238 |
""" |
|
37874
0dcd03637d36
tests: fix error case in test-url.py's doctest
Augie Fackler <augie@google.com>
parents:
29452
diff
changeset
|
239 |
>>> from mercurial import error, pycompat |
0dcd03637d36
tests: fix error case in test-url.py's doctest
Augie Fackler <augie@google.com>
parents:
29452
diff
changeset
|
240 |
>>> from mercurial.util import forcebytestr, url |
13770 | 241 |
|
242 |
This tests for edge cases in url.URL's parsing algorithm. Most of |
|
243 |
these aren't useful for documentation purposes, so they aren't |
|
244 |
part of the class's doc tests. |
|
245 |
||
246 |
Query strings and fragments: |
|
247 |
||
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
248 |
>>> url(b'http://host/a?b#c') |
13770 | 249 |
<url scheme: 'http', host: 'host', path: 'a', query: 'b', fragment: 'c'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
250 |
>>> url(b'http://host/a?') |
13770 | 251 |
<url scheme: 'http', host: 'host', path: 'a'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
252 |
>>> url(b'http://host/a#b#c') |
13770 | 253 |
<url scheme: 'http', host: 'host', path: 'a', fragment: 'b#c'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
254 |
>>> url(b'http://host/a#b?c') |
13770 | 255 |
<url scheme: 'http', host: 'host', path: 'a', fragment: 'b?c'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
256 |
>>> url(b'http://host/?a#b') |
13770 | 257 |
<url scheme: 'http', host: 'host', path: '', query: 'a', fragment: 'b'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
258 |
>>> url(b'http://host/?a#b', parsequery=False) |
13770 | 259 |
<url scheme: 'http', host: 'host', path: '?a', fragment: 'b'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
260 |
>>> url(b'http://host/?a#b', parsefragment=False) |
13770 | 261 |
<url scheme: 'http', host: 'host', path: '', query: 'a#b'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
262 |
>>> url(b'http://host/?a#b', parsequery=False, parsefragment=False) |
13770 | 263 |
<url scheme: 'http', host: 'host', path: '?a#b'> |
264 |
||
265 |
IPv6 addresses: |
|
266 |
||
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
267 |
>>> url(b'ldap://[2001:db8::7]/c=GB?objectClass?one') |
13770 | 268 |
<url scheme: 'ldap', host: '[2001:db8::7]', path: 'c=GB', |
269 |
query: 'objectClass?one'> |
|
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
270 |
>>> url(b'ldap://joe:xxx@[2001:db8::7]:80/c=GB?objectClass?one') |
13770 | 271 |
<url scheme: 'ldap', user: 'joe', passwd: 'xxx', host: '[2001:db8::7]', |
272 |
port: '80', path: 'c=GB', query: 'objectClass?one'> |
|
273 |
||
274 |
Missing scheme, host, etc.: |
|
275 |
||
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
276 |
>>> url(b'://192.0.2.16:80/') |
13770 | 277 |
<url path: '://192.0.2.16:80/'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
278 |
>>> url(b'https://mercurial-scm.org') |
26421
4b0fc75f9403
urls: bulk-change primary website URLs
Matt Mackall <mpm@selenic.com>
parents:
20685
diff
changeset
|
279 |
<url scheme: 'https', host: 'mercurial-scm.org'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
280 |
>>> url(b'/foo') |
13770 | 281 |
<url path: '/foo'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
282 |
>>> url(b'bundle:/foo') |
13770 | 283 |
<url scheme: 'bundle', path: '/foo'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
284 |
>>> url(b'a?b#c') |
13770 | 285 |
<url path: 'a?b', fragment: 'c'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
286 |
>>> url(b'http://x.com?arg=/foo') |
13770 | 287 |
<url scheme: 'http', host: 'x.com', query: 'arg=/foo'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
288 |
>>> url(b'http://joe:xxx@/foo') |
13770 | 289 |
<url scheme: 'http', user: 'joe', passwd: 'xxx', path: 'foo'> |
290 |
||
291 |
Just a scheme and a path: |
|
292 |
||
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
293 |
>>> url(b'mailto:John.Doe@example.com') |
13770 | 294 |
<url scheme: 'mailto', path: 'John.Doe@example.com'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
295 |
>>> url(b'a:b:c:d') |
13808 | 296 |
<url path: 'a:b:c:d'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
297 |
>>> url(b'aa:bb:cc:dd') |
13808 | 298 |
<url scheme: 'aa', path: 'bb:cc:dd'> |
13770 | 299 |
|
300 |
SSH examples: |
|
301 |
||
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
302 |
>>> url(b'ssh://joe@host//home/joe') |
13770 | 303 |
<url scheme: 'ssh', user: 'joe', host: 'host', path: '/home/joe'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
304 |
>>> url(b'ssh://joe:xxx@host/src') |
13770 | 305 |
<url scheme: 'ssh', user: 'joe', passwd: 'xxx', host: 'host', path: 'src'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
306 |
>>> url(b'ssh://joe:xxx@host') |
13770 | 307 |
<url scheme: 'ssh', user: 'joe', passwd: 'xxx', host: 'host'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
308 |
>>> url(b'ssh://joe@host') |
13770 | 309 |
<url scheme: 'ssh', user: 'joe', host: 'host'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
310 |
>>> url(b'ssh://host') |
13770 | 311 |
<url scheme: 'ssh', host: 'host'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
312 |
>>> url(b'ssh://') |
13770 | 313 |
<url scheme: 'ssh'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
314 |
>>> url(b'ssh:') |
13770 | 315 |
<url scheme: 'ssh'> |
316 |
||
317 |
Non-numeric port: |
|
318 |
||
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
319 |
>>> url(b'http://example.com:dd') |
13770 | 320 |
<url scheme: 'http', host: 'example.com', port: 'dd'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
321 |
>>> url(b'ssh://joe:xxx@host:ssh/foo') |
13770 | 322 |
<url scheme: 'ssh', user: 'joe', passwd: 'xxx', host: 'host', port: 'ssh', |
323 |
path: 'foo'> |
|
324 |
||
325 |
Bad authentication credentials: |
|
326 |
||
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
327 |
>>> url(b'http://joe@joeville:123@4:@host/a?b#c') |
13770 | 328 |
<url scheme: 'http', user: 'joe@joeville', passwd: '123@4:', |
329 |
host: 'host', path: 'a', query: 'b', fragment: 'c'> |
|
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
330 |
>>> url(b'http://!*#?/@!*#?/:@host/a?b#c') |
13770 | 331 |
<url scheme: 'http', host: '!*', fragment: '?/@!*#?/:@host/a?b#c'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
332 |
>>> url(b'http://!*#?@!*#?:@host/a?b#c') |
13770 | 333 |
<url scheme: 'http', host: '!*', fragment: '?@!*#?:@host/a?b#c'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
334 |
>>> url(b'http://!*@:!*@@host/a?b#c') |
13770 | 335 |
<url scheme: 'http', user: '!*@', passwd: '!*@', host: 'host', |
336 |
path: 'a', query: 'b', fragment: 'c'> |
|
337 |
||
338 |
File paths: |
|
339 |
||
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
340 |
>>> url(b'a/b/c/d.g.f') |
13770 | 341 |
<url path: 'a/b/c/d.g.f'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
342 |
>>> url(b'/x///z/y/') |
13770 | 343 |
<url path: '/x///z/y/'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
344 |
>>> url(b'/foo:bar') |
13848
b2798c1defff
url: be stricter about detecting schemes
Brodie Rao <brodie@bitheap.org>
parents:
13827
diff
changeset
|
345 |
<url path: '/foo:bar'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
346 |
>>> url(b'\\\\foo:bar') |
13848
b2798c1defff
url: be stricter about detecting schemes
Brodie Rao <brodie@bitheap.org>
parents:
13827
diff
changeset
|
347 |
<url path: '\\\\foo:bar'> |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
348 |
>>> url(b'./foo:bar') |
13848
b2798c1defff
url: be stricter about detecting schemes
Brodie Rao <brodie@bitheap.org>
parents:
13827
diff
changeset
|
349 |
<url path: './foo:bar'> |
13770 | 350 |
|
13817
7f18bab2c0b0
url: abort on file:// URLs with non-localhost hosts
Brodie Rao <brodie@bitheap.org>
parents:
13808
diff
changeset
|
351 |
Non-localhost file URL: |
7f18bab2c0b0
url: abort on file:// URLs with non-localhost hosts
Brodie Rao <brodie@bitheap.org>
parents:
13808
diff
changeset
|
352 |
|
37874
0dcd03637d36
tests: fix error case in test-url.py's doctest
Augie Fackler <augie@google.com>
parents:
29452
diff
changeset
|
353 |
>>> try: |
0dcd03637d36
tests: fix error case in test-url.py's doctest
Augie Fackler <augie@google.com>
parents:
29452
diff
changeset
|
354 |
... u = url(b'file://mercurial-scm.org/foo') |
0dcd03637d36
tests: fix error case in test-url.py's doctest
Augie Fackler <augie@google.com>
parents:
29452
diff
changeset
|
355 |
... except error.Abort as e: |
0dcd03637d36
tests: fix error case in test-url.py's doctest
Augie Fackler <augie@google.com>
parents:
29452
diff
changeset
|
356 |
... forcebytestr(e) |
0dcd03637d36
tests: fix error case in test-url.py's doctest
Augie Fackler <augie@google.com>
parents:
29452
diff
changeset
|
357 |
'file:// URLs can only refer to localhost' |
13817
7f18bab2c0b0
url: abort on file:// URLs with non-localhost hosts
Brodie Rao <brodie@bitheap.org>
parents:
13808
diff
changeset
|
358 |
|
13770 | 359 |
Empty URL: |
360 |
||
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
361 |
>>> u = url(b'') |
13770 | 362 |
>>> u |
363 |
<url path: ''> |
|
364 |
>>> str(u) |
|
365 |
'' |
|
366 |
||
367 |
Empty path with query string: |
|
368 |
||
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
369 |
>>> str(url(b'http://foo/?bar')) |
13770 | 370 |
'http://foo/?bar' |
371 |
||
372 |
Invalid path: |
|
373 |
||
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
374 |
>>> u = url(b'http://foo/bar') |
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
375 |
>>> u.path = b'bar' |
13770 | 376 |
>>> str(u) |
377 |
'http://foo/bar' |
|
378 |
||
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
379 |
>>> u = url(b'file:/foo/bar/baz') |
14313
a389dd285282
util: make str(url) return file:/// for abs paths again
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14204
diff
changeset
|
380 |
>>> u |
a389dd285282
util: make str(url) return file:/// for abs paths again
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14204
diff
changeset
|
381 |
<url scheme: 'file', path: '/foo/bar/baz'> |
a389dd285282
util: make str(url) return file:/// for abs paths again
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14204
diff
changeset
|
382 |
>>> str(u) |
a389dd285282
util: make str(url) return file:/// for abs paths again
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14204
diff
changeset
|
383 |
'file:///foo/bar/baz' |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
384 |
>>> pycompat.bytestr(u.localpath()) |
15018
e89f62dcd723
url: really handle urls of the form file:///c:/foo/bar/ correctly
Mads Kiilerich <mads@kiilerich.com>
parents:
14666
diff
changeset
|
385 |
'/foo/bar/baz' |
14313
a389dd285282
util: make str(url) return file:/// for abs paths again
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14204
diff
changeset
|
386 |
|
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
387 |
>>> u = url(b'file:///foo/bar/baz') |
13770 | 388 |
>>> u |
389 |
<url scheme: 'file', path: '/foo/bar/baz'> |
|
390 |
>>> str(u) |
|
14313
a389dd285282
util: make str(url) return file:/// for abs paths again
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14204
diff
changeset
|
391 |
'file:///foo/bar/baz' |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
392 |
>>> pycompat.bytestr(u.localpath()) |
15018
e89f62dcd723
url: really handle urls of the form file:///c:/foo/bar/ correctly
Mads Kiilerich <mads@kiilerich.com>
parents:
14666
diff
changeset
|
393 |
'/foo/bar/baz' |
e89f62dcd723
url: really handle urls of the form file:///c:/foo/bar/ correctly
Mads Kiilerich <mads@kiilerich.com>
parents:
14666
diff
changeset
|
394 |
|
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
395 |
>>> u = url(b'file:///f:oo/bar/baz') |
15018
e89f62dcd723
url: really handle urls of the form file:///c:/foo/bar/ correctly
Mads Kiilerich <mads@kiilerich.com>
parents:
14666
diff
changeset
|
396 |
>>> u |
e89f62dcd723
url: really handle urls of the form file:///c:/foo/bar/ correctly
Mads Kiilerich <mads@kiilerich.com>
parents:
14666
diff
changeset
|
397 |
<url scheme: 'file', path: 'f:oo/bar/baz'> |
e89f62dcd723
url: really handle urls of the form file:///c:/foo/bar/ correctly
Mads Kiilerich <mads@kiilerich.com>
parents:
14666
diff
changeset
|
398 |
>>> str(u) |
15611 | 399 |
'file:///f:oo/bar/baz' |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
400 |
>>> pycompat.bytestr(u.localpath()) |
15018
e89f62dcd723
url: really handle urls of the form file:///c:/foo/bar/ correctly
Mads Kiilerich <mads@kiilerich.com>
parents:
14666
diff
changeset
|
401 |
'f:oo/bar/baz' |
14313
a389dd285282
util: make str(url) return file:/// for abs paths again
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14204
diff
changeset
|
402 |
|
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
403 |
>>> u = url(b'file://localhost/f:oo/bar/baz') |
15496
396e83d635a6
url: handle file://localhost/c:/foo "correctly"
Mads Kiilerich <mads@kiilerich.com>
parents:
15398
diff
changeset
|
404 |
>>> u |
396e83d635a6
url: handle file://localhost/c:/foo "correctly"
Mads Kiilerich <mads@kiilerich.com>
parents:
15398
diff
changeset
|
405 |
<url scheme: 'file', host: 'localhost', path: 'f:oo/bar/baz'> |
396e83d635a6
url: handle file://localhost/c:/foo "correctly"
Mads Kiilerich <mads@kiilerich.com>
parents:
15398
diff
changeset
|
406 |
>>> str(u) |
15513 | 407 |
'file://localhost/f:oo/bar/baz' |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
408 |
>>> pycompat.bytestr(u.localpath()) |
15496
396e83d635a6
url: handle file://localhost/c:/foo "correctly"
Mads Kiilerich <mads@kiilerich.com>
parents:
15398
diff
changeset
|
409 |
'f:oo/bar/baz' |
396e83d635a6
url: handle file://localhost/c:/foo "correctly"
Mads Kiilerich <mads@kiilerich.com>
parents:
15398
diff
changeset
|
410 |
|
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
411 |
>>> u = url(b'file:foo/bar/baz') |
14313
a389dd285282
util: make str(url) return file:/// for abs paths again
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14204
diff
changeset
|
412 |
>>> u |
a389dd285282
util: make str(url) return file:/// for abs paths again
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14204
diff
changeset
|
413 |
<url scheme: 'file', path: 'foo/bar/baz'> |
a389dd285282
util: make str(url) return file:/// for abs paths again
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14204
diff
changeset
|
414 |
>>> str(u) |
a389dd285282
util: make str(url) return file:/// for abs paths again
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14204
diff
changeset
|
415 |
'file:foo/bar/baz' |
37875
078c3eec2d5c
tests: port test-url.py to Python 3
Augie Fackler <augie@google.com>
parents:
37874
diff
changeset
|
416 |
>>> pycompat.bytestr(u.localpath()) |
15018
e89f62dcd723
url: really handle urls of the form file:///c:/foo/bar/ correctly
Mads Kiilerich <mads@kiilerich.com>
parents:
14666
diff
changeset
|
417 |
'foo/bar/baz' |
13770 | 418 |
""" |
419 |
||
15398
474279be5add
tests: fix readline escape characters in heredoctest.py/test-url.py
Brodie Rao <brodie@bitheap.org>
parents:
15018
diff
changeset
|
420 |
if 'TERM' in os.environ: |
474279be5add
tests: fix readline escape characters in heredoctest.py/test-url.py
Brodie Rao <brodie@bitheap.org>
parents:
15018
diff
changeset
|
421 |
del os.environ['TERM'] |
474279be5add
tests: fix readline escape characters in heredoctest.py/test-url.py
Brodie Rao <brodie@bitheap.org>
parents:
15018
diff
changeset
|
422 |
|
13770 | 423 |
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE) |