Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
fbaf9310
Commit
fbaf9310
authored
Nov 05, 2014
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test_httplib: use self-signed.pythontest.net for verification test with non-root-CA cert
parent
50219fcd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
+24
-12
Lib/test/selfsigned_pythontestdotnet.pem
Lib/test/selfsigned_pythontestdotnet.pem
+16
-0
Lib/test/test_httplib.py
Lib/test/test_httplib.py
+8
-12
No files found.
Lib/test/selfsigned_pythontestdotnet.pem
0 → 100644
View file @
fbaf9310
-----BEGIN CERTIFICATE-----
MIIChzCCAfCgAwIBAgIJAKGU95wKR8pSMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
BAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9u
IFNvZnR3YXJlIEZvdW5kYXRpb24xIzAhBgNVBAMMGnNlbGYtc2lnbmVkLnB5dGhv
bnRlc3QubmV0MB4XDTE0MTEwMjE4MDkyOVoXDTI0MTAzMDE4MDkyOVowcDELMAkG
A1UEBhMCWFkxFzAVBgNVBAcMDkNhc3RsZSBBbnRocmF4MSMwIQYDVQQKDBpQeXRo
b24gU29mdHdhcmUgRm91bmRhdGlvbjEjMCEGA1UEAwwac2VsZi1zaWduZWQucHl0
aG9udGVzdC5uZXQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANDXQXW9tjyZ
Xt0Iv2tLL1+jinr4wGg36ioLDLFkMf+2Y1GL0v0BnKYG4N1OKlAU15LXGeGer8vm
Sv/yIvmdrELvhAbbo3w4a9TMYQA4XkIVLdvu3mvNOAet+8PMJxn26dbDhG809ALv
EHY57lQsBS3G59RZyBPVqAqmImWNJnVzAgMBAAGjKTAnMCUGA1UdEQQeMByCGnNl
bGYtc2lnbmVkLnB5dGhvbnRlc3QubmV0MA0GCSqGSIb3DQEBBQUAA4GBAIOXmdtM
eG9qzP9TiXW/Gc/zI4cBfdCpC+Y4gOfC9bQUC7hefix4iO3+iZjgy3X/FaRxUUoV
HKiXcXIaWqTSUWp45cSh0MbwZXudp6JIAptzdAhvvCrPKeC9i9GvxsPD4LtDAL97
vSaxQBezA7hdxZd90/EeyMgVZgAnTCnvAWX9
-----END CERTIFICATE-----
Lib/test/test_httplib.py
View file @
fbaf9310
...
...
@@ -15,8 +15,8 @@ here = os.path.dirname(__file__)
CERT_localhost
=
os
.
path
.
join
(
here
,
'keycert.pem'
)
# Self-signed cert file for 'fakehostname'
CERT_fakehostname
=
os
.
path
.
join
(
here
,
'keycert2.pem'
)
#
Root cert file (CA) for svn.python.org's cer
t
C
ACERT_svn_python_org
=
os
.
path
.
join
(
here
,
'https_svn_python_org_roo
t.pem'
)
#
Self-signed cert file for self-signed.pythontest.ne
t
C
ERT_selfsigned_pythontestdotnet
=
os
.
path
.
join
(
here
,
'selfsigned_pythontestdotne
t.pem'
)
HOST
=
support
.
HOST
...
...
@@ -772,11 +772,6 @@ class HTTPSTest(TestCase):
h
=
client
.
HTTPSConnection
(
HOST
,
TimeoutTest
.
PORT
,
timeout
=
30
)
self
.
assertEqual
(
h
.
timeout
,
30
)
def
_check_svn_python_org
(
self
,
resp
):
# Just a simple check that everything went fine
server_string
=
resp
.
getheader
(
'server'
)
self
.
assertIn
(
'Apache'
,
server_string
)
def
test_networked
(
self
):
# Default settings: requires a valid cert from a trusted CA
import
ssl
...
...
@@ -810,17 +805,18 @@ class HTTPSTest(TestCase):
self
.
assertIn
(
'text/html'
,
content_type
)
def
test_networked_good_cert
(
self
):
# We feed
a CA cert that validates the server's
cert
# We feed
the server's cert as a validating
cert
import
ssl
support
.
requires
(
'network'
)
with
support
.
transient_internet
(
's
vn.python.org
'
):
with
support
.
transient_internet
(
's
elf-signed.pythontest.net
'
):
context
=
ssl
.
SSLContext
(
ssl
.
PROTOCOL_TLSv1
)
context
.
verify_mode
=
ssl
.
CERT_REQUIRED
context
.
load_verify_locations
(
C
ACERT_svn_python_org
)
h
=
client
.
HTTPSConnection
(
's
vn.python.org
'
,
443
,
context
=
context
)
context
.
load_verify_locations
(
C
ERT_selfsigned_pythontestdotnet
)
h
=
client
.
HTTPSConnection
(
's
elf-signed.pythontest.net
'
,
443
,
context
=
context
)
h
.
request
(
'GET'
,
'/'
)
resp
=
h
.
getresponse
()
self
.
_check_svn_python_org
(
resp
)
server_string
=
resp
.
getheader
(
'server'
)
self
.
assertIn
(
'nginx'
,
server_string
)
def
test_networked_bad_cert
(
self
):
# We feed a "CA" cert that is unrelated to the server's cert
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment