Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
ff1f11b1
Kaydet (Commit)
ff1f11b1
authored
Eki 14, 2014
tarafından
Sam Alba
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #347 from aanand/override-assert-hostname
Enable the overriding of `assert_hostname` on TLSConfig
üst
7a462970
4bf438d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
ssladapter.py
docker/ssladapter/ssladapter.py
+13
-5
tls.py
docker/tls.py
+6
-2
No files found.
docker/ssladapter/ssladapter.py
Dosyayı görüntüle @
ff1f11b1
...
@@ -15,19 +15,27 @@ PoolManager = urllib3.poolmanager.PoolManager
...
@@ -15,19 +15,27 @@ PoolManager = urllib3.poolmanager.PoolManager
class
SSLAdapter
(
HTTPAdapter
):
class
SSLAdapter
(
HTTPAdapter
):
'''An HTTPS Transport Adapter that uses an arbitrary SSL version.'''
'''An HTTPS Transport Adapter that uses an arbitrary SSL version.'''
def
__init__
(
self
,
ssl_version
=
None
,
**
kwargs
):
def
__init__
(
self
,
ssl_version
=
None
,
assert_hostname
=
None
,
**
kwargs
):
self
.
ssl_version
=
ssl_version
self
.
ssl_version
=
ssl_version
self
.
assert_hostname
=
assert_hostname
super
(
SSLAdapter
,
self
)
.
__init__
(
**
kwargs
)
super
(
SSLAdapter
,
self
)
.
__init__
(
**
kwargs
)
def
init_poolmanager
(
self
,
connections
,
maxsize
,
block
=
False
):
def
init_poolmanager
(
self
,
connections
,
maxsize
,
block
=
False
):
urllib_ver
=
urllib3
.
__version__
.
split
(
'-'
)[
0
]
kwargs
=
{
kwargs
=
{
'num_pools'
:
connections
,
'num_pools'
:
connections
,
'maxsize'
:
maxsize
,
'maxsize'
:
maxsize
,
'block'
:
block
'block'
:
block
,
'assert_hostname'
:
self
.
assert_hostname
,
}
}
if
urllib3
and
urllib_ver
==
'dev'
and
\
if
self
.
can_override_ssl_version
():
StrictVersion
(
urllib_ver
)
>
StrictVersion
(
'1.5'
):
kwargs
[
'ssl_version'
]
=
self
.
ssl_version
kwargs
[
'ssl_version'
]
=
self
.
ssl_version
self
.
poolmanager
=
PoolManager
(
**
kwargs
)
self
.
poolmanager
=
PoolManager
(
**
kwargs
)
def
can_override_ssl_version
(
self
):
urllib_ver
=
urllib3
.
__version__
.
split
(
'-'
)[
0
]
if
urllib_ver
is
None
:
return
False
if
urllib_ver
==
'dev'
:
return
True
return
StrictVersion
(
urllib_ver
)
>
StrictVersion
(
'1.5'
)
docker/tls.py
Dosyayı görüntüle @
ff1f11b1
...
@@ -10,7 +10,7 @@ class TLSConfig(object):
...
@@ -10,7 +10,7 @@ class TLSConfig(object):
ssl_version
=
None
ssl_version
=
None
def
__init__
(
self
,
client_cert
=
None
,
ca_cert
=
None
,
verify
=
None
,
def
__init__
(
self
,
client_cert
=
None
,
ca_cert
=
None
,
verify
=
None
,
ssl_version
=
None
):
ssl_version
=
None
,
assert_hostname
=
None
):
# Argument compatibility/mapping with
# Argument compatibility/mapping with
# http://docs.docker.com/examples/https/
# http://docs.docker.com/examples/https/
# This diverges from the Docker CLI in that users can specify 'tls'
# This diverges from the Docker CLI in that users can specify 'tls'
...
@@ -20,6 +20,7 @@ class TLSConfig(object):
...
@@ -20,6 +20,7 @@ class TLSConfig(object):
# urllib3 sets a default ssl_version if ssl_version is None
# urllib3 sets a default ssl_version if ssl_version is None
# http://tinyurl.com/kxga8hb
# http://tinyurl.com/kxga8hb
self
.
ssl_version
=
ssl_version
self
.
ssl_version
=
ssl_version
self
.
assert_hostname
=
assert_hostname
# "tls" and "tls_verify" must have both or neither cert/key files
# "tls" and "tls_verify" must have both or neither cert/key files
# In either case, Alert the user when both are expected, but any are
# In either case, Alert the user when both are expected, but any are
...
@@ -65,4 +66,7 @@ class TLSConfig(object):
...
@@ -65,4 +66,7 @@ class TLSConfig(object):
client
.
verify
=
self
.
verify
client
.
verify
=
self
.
verify
if
self
.
cert
:
if
self
.
cert
:
client
.
cert
=
self
.
cert
client
.
cert
=
self
.
cert
client
.
mount
(
'https://'
,
ssladapter
.
SSLAdapter
(
self
.
ssl_version
))
client
.
mount
(
'https://'
,
ssladapter
.
SSLAdapter
(
ssl_version
=
self
.
ssl_version
,
assert_hostname
=
self
.
assert_hostname
,
))
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