com.googler.python 1.0.8 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/python3.4.2/lib/python3.4/site-packages/pip/__init__.py +1 -277
- package/python3.4.2/lib/python3.4/site-packages/pip/__main__.py +19 -7
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/__init__.py +246 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/basecommand.py +373 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/{baseparser.py → _internal/baseparser.py} +240 -224
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/build_env.py +92 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/cache.py +202 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/cmdoptions.py +609 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/__init__.py +79 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/check.py +42 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/completion.py +94 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/configuration.py +227 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/download.py +233 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/freeze.py +96 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/hash.py +57 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/{commands → _internal/commands}/help.py +36 -33
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/install.py +477 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/list.py +343 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/search.py +135 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/show.py +164 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/uninstall.py +71 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/wheel.py +179 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/compat.py +235 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/configuration.py +378 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/download.py +922 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/exceptions.py +249 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/index.py +1117 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/locations.py +194 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/models/__init__.py +4 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/models/index.py +15 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/{_vendor/requests/packages/urllib3/contrib → _internal/operations}/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/check.py +106 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/freeze.py +252 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/prepare.py +378 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/pep425tags.py +317 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/__init__.py +69 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_file.py +338 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_install.py +1115 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_set.py +164 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_uninstall.py +455 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/resolve.py +354 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/{status_codes.py → _internal/status_codes.py} +8 -6
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/appdirs.py +258 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/deprecation.py +77 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/encoding.py +33 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/filesystem.py +28 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/glibc.py +84 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/hashes.py +94 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/logging.py +132 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/misc.py +851 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/outdated.py +163 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/packaging.py +70 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/setuptools_build.py +8 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/temp_dir.py +82 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/typing.py +29 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/ui.py +421 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/__init__.py +471 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/bazaar.py +113 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/git.py +311 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/mercurial.py +105 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/subversion.py +271 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/wheel.py +817 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/__init__.py +109 -8
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/appdirs.py +604 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/__init__.py +11 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/_cmd.py +60 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/adapter.py +134 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/cache.py +39 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +2 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +133 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +43 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/compat.py +29 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/controller.py +373 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/filewrapper.py +78 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/heuristics.py +138 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/serialize.py +194 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/wrapper.py +27 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/__init__.py +3 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/__main__.py +2 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests → certifi}/cacert.pem +1765 -2358
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/core.py +37 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/__init__.py +39 -32
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/big5freq.py +386 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/big5prober.py +47 -42
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/chardistribution.py +233 -231
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/charsetgroupprober.py +106 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/charsetprober.py +145 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/cli/__init__.py +1 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/cli/chardetect.py +85 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/codingstatemachine.py +88 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/compat.py +34 -34
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/cp949prober.py +49 -44
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/enums.py +76 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/escprober.py +101 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/escsm.py +246 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/eucjpprober.py +92 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/euckrfreq.py +195 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euckrprober.py +47 -42
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euctwfreq.py +387 -428
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euctwprober.py +46 -41
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/gb2312freq.py +283 -472
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/gb2312prober.py +46 -41
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/hebrewprober.py +292 -283
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/jisfreq.py +325 -569
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/jpcntx.py +233 -219
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langbulgarianmodel.py +228 -229
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langcyrillicmodel.py +333 -329
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langgreekmodel.py +225 -225
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langhebrewmodel.py +200 -201
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langhungarianmodel.py +225 -225
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langthaimodel.py +199 -200
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/langturkishmodel.py +193 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/latin1prober.py +145 -139
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/mbcharsetprober.py +91 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/mbcsgroupprober.py +54 -54
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/mbcssm.py +572 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/sbcharsetprober.py +132 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/sbcsgroupprober.py +73 -69
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/sjisprober.py +92 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/universaldetector.py +286 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/utf8prober.py +82 -76
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/version.py +9 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/__init__.py +7 -7
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/ansi.py +102 -50
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/ansitowin32.py +236 -190
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/initialise.py +82 -56
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/win32.py +156 -137
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/winterm.py +162 -120
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/__init__.py +23 -23
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/__init__.py +6 -6
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/misc.py +41 -41
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/shutil.py +761 -761
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/sysconfig.cfg +84 -84
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/sysconfig.py +788 -788
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/tarfile.py +2607 -2607
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/compat.py +1117 -1064
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/database.py +1318 -1301
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/index.py +516 -488
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/locators.py +1292 -1194
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/manifest.py +393 -364
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/markers.py +131 -190
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/metadata.py +1068 -1026
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/resources.py +355 -317
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py +415 -323
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/t32.exe +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/t64.exe +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/util.py +1755 -1575
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/version.py +736 -721
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/w32.exe +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/w64.exe +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/wheel.py +984 -958
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distro.py +1104 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/__init__.py +35 -23
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{ihatexml.py → _ihatexml.py} +288 -285
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{inputstream.py → _inputstream.py} +923 -881
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{tokenizer.py → _tokenizer.py} +1721 -1731
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/__init__.py +14 -12
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/_base.py +37 -37
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/datrie.py +44 -44
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/py.py +67 -67
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{utils.py → _utils.py} +124 -82
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/constants.py +2947 -3104
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.py +29 -20
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/{_base.py → base.py} +12 -12
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/inject_meta_charset.py +73 -65
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/lint.py +93 -93
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/optionaltags.py +207 -205
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/sanitizer.py +896 -12
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/whitespace.py +38 -38
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/html5parser.py +2791 -2713
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer.py +409 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/__init__.py +30 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/genshi.py +54 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/sax.py +50 -44
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/__init__.py +88 -76
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/{_base.py → base.py} +417 -377
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/dom.py +236 -227
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/etree.py +340 -337
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.py +366 -369
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py +154 -57
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{_base.py → base.py} +252 -200
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/dom.py +43 -46
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/etree.py +130 -138
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{lxmletree.py → etree_lxml.py} +213 -208
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{genshistream.py → genshi.py} +69 -69
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/__init__.py +2 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/codec.py +118 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/compat.py +12 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/core.py +387 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/idnadata.py +1585 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/intranges.py +53 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/package_data.py +2 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/uts46data.py +7634 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/ipaddress.py +2419 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/__init__.py +347 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/linklockfile.py +73 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/mkdirlockfile.py +84 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/pidlockfile.py +190 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/sqlitelockfile.py +156 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/symlinklockfile.py +70 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/__init__.py +66 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/_version.py +1 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/exceptions.py +41 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/fallback.py +971 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/__about__.py +21 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/__init__.py +14 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/_compat.py +30 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/_structures.py +70 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/markers.py +301 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/requirements.py +130 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/specifiers.py +774 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/utils.py +63 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/version.py +441 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{pkg_resources.py → pkg_resources/__init__.py} +3125 -2762
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources/py31compat.py +22 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/__init__.py +127 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/bar.py +88 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/counter.py +48 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/helpers.py +91 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/spinner.py +44 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pyparsing.py +5720 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/__init__.py +3 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/core.py +13 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/parser.py +374 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/writer.py +127 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/__init__.py +123 -77
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/__version__.py +14 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/_internal_utils.py +42 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/adapters.py +525 -388
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/api.py +152 -120
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/auth.py +293 -193
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/certs.py +18 -24
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/compat.py +73 -115
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/cookies.py +542 -454
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/exceptions.py +122 -75
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/help.py +120 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/hooks.py +34 -45
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/models.py +948 -803
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages.py +16 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py +737 -637
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/status_codes.py +91 -88
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/structures.py +105 -127
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/utils.py +904 -673
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/retrying.py +267 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/six.py +891 -646
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/__init__.py +97 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/_collections.py +319 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/connection.py +373 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/connectionpool.py +905 -710
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +593 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +343 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/appengine.py +296 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/contrib/ntlmpool.py +112 -120
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +455 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +810 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/socks.py +188 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/exceptions.py +246 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/fields.py +178 -177
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/filepost.py +94 -100
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/__init__.py +5 -4
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +53 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ordered_dict.py +259 -260
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/six.py +868 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ssl_match_hostname/__init__.py +19 -13
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ssl_match_hostname/_implementation.py +157 -105
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/poolmanager.py +440 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/request.py +148 -141
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/response.py +626 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/__init__.py +54 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/connection.py +130 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/request.py +118 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/response.py +81 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/retry.py +401 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/selectors.py +581 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/ssl_.py +341 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/util/timeout.py +242 -234
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/util/url.py +230 -162
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/wait.py +40 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/__init__.py +342 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/labels.py +231 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/mklabels.py +59 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/tests.py +153 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/x_user_defined.py +325 -0
- package/python3.4.2/lib/python3.4/site-packages/pip-10.0.0.dist-info/LICENSE.txt +20 -0
- package/python3.4.2/lib/python3.4/site-packages/pip-10.0.0.dist-info/METADATA +78 -0
- package/python3.4.2/lib/python3.4/site-packages/pip-10.0.0.dist-info/RECORD +294 -0
- package/python3.4.2/lib/python3.4/site-packages/{pip-1.5.6.dist-info → pip-10.0.0.dist-info}/WHEEL +6 -6
- package/python3.4.2/lib/python3.4/site-packages/pip-10.0.0.dist-info/entry_points.txt +5 -0
- package/python3.4.2/lib/python3.4/site-packages/{pip-1.5.6.dist-info → pip-10.0.0.dist-info}/top_level.txt +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/_markerlib/__init__.py +0 -16
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/_markerlib/markers.py +0 -119
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/sanitizer.py +0 -271
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer/__init__.py +0 -16
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer/htmlserializer.py +0 -320
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/pulldom.py +0 -63
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/re-vendor.py +0 -34
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/__init__.py +0 -3
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/big5freq.py +0 -925
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/chardetect.py +0 -46
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/charsetgroupprober.py +0 -106
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/charsetprober.py +0 -62
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/codingstatemachine.py +0 -61
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/constants.py +0 -39
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/escprober.py +0 -86
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/escsm.py +0 -242
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/eucjpprober.py +0 -90
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/euckrfreq.py +0 -596
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcharsetprober.py +0 -86
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcssm.py +0 -575
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sbcharsetprober.py +0 -120
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sjisprober.py +0 -91
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/universaldetector.py +0 -170
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py +0 -58
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/_collections.py +0 -205
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connection.py +0 -204
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py +0 -422
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/exceptions.py +0 -126
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/packages/six.py +0 -385
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py +0 -258
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/response.py +0 -308
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/__init__.py +0 -27
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/connection.py +0 -45
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/request.py +0 -68
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/response.py +0 -13
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py +0 -133
- package/python3.4.2/lib/python3.4/site-packages/pip/backwardcompat/__init__.py +0 -138
- package/python3.4.2/lib/python3.4/site-packages/pip/basecommand.py +0 -201
- package/python3.4.2/lib/python3.4/site-packages/pip/cmdoptions.py +0 -371
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/__init__.py +0 -88
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/bundle.py +0 -42
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/completion.py +0 -59
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/freeze.py +0 -114
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/install.py +0 -314
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/list.py +0 -162
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/search.py +0 -132
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/show.py +0 -80
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/uninstall.py +0 -59
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/unzip.py +0 -7
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/wheel.py +0 -195
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/zip.py +0 -351
- package/python3.4.2/lib/python3.4/site-packages/pip/download.py +0 -644
- package/python3.4.2/lib/python3.4/site-packages/pip/exceptions.py +0 -46
- package/python3.4.2/lib/python3.4/site-packages/pip/index.py +0 -990
- package/python3.4.2/lib/python3.4/site-packages/pip/locations.py +0 -171
- package/python3.4.2/lib/python3.4/site-packages/pip/log.py +0 -276
- package/python3.4.2/lib/python3.4/site-packages/pip/pep425tags.py +0 -102
- package/python3.4.2/lib/python3.4/site-packages/pip/req.py +0 -1931
- package/python3.4.2/lib/python3.4/site-packages/pip/runner.py +0 -18
- package/python3.4.2/lib/python3.4/site-packages/pip/util.py +0 -720
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/__init__.py +0 -251
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/bazaar.py +0 -131
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/git.py +0 -194
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/mercurial.py +0 -151
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/subversion.py +0 -273
- package/python3.4.2/lib/python3.4/site-packages/pip/wheel.py +0 -560
- package/python3.4.2/lib/python3.4/site-packages/pip-1.5.6.dist-info/DESCRIPTION.rst +0 -71
- package/python3.4.2/lib/python3.4/site-packages/pip-1.5.6.dist-info/METADATA +0 -98
- package/python3.4.2/lib/python3.4/site-packages/pip-1.5.6.dist-info/RECORD +0 -373
- package/python3.4.2/lib/python3.4/site-packages/pip-1.5.6.dist-info/entry_points.txt +0 -5
- package/python3.4.2/lib/python3.4/site-packages/pip-1.5.6.dist-info/metadata.json +0 -1
package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connection.py
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
# urllib3/connection.py
|
|
2
|
-
# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
|
|
3
|
-
#
|
|
4
|
-
# This module is part of urllib3 and is released under
|
|
5
|
-
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
|
6
|
-
|
|
7
|
-
import sys
|
|
8
|
-
import socket
|
|
9
|
-
from socket import timeout as SocketTimeout
|
|
10
|
-
|
|
11
|
-
try: # Python 3
|
|
12
|
-
from http.client import HTTPConnection as _HTTPConnection, HTTPException
|
|
13
|
-
except ImportError:
|
|
14
|
-
from httplib import HTTPConnection as _HTTPConnection, HTTPException
|
|
15
|
-
|
|
16
|
-
class DummyConnection(object):
|
|
17
|
-
"Used to detect a failed ConnectionCls import."
|
|
18
|
-
pass
|
|
19
|
-
|
|
20
|
-
try: # Compiled with SSL?
|
|
21
|
-
ssl = None
|
|
22
|
-
HTTPSConnection = DummyConnection
|
|
23
|
-
|
|
24
|
-
class BaseSSLError(BaseException):
|
|
25
|
-
pass
|
|
26
|
-
|
|
27
|
-
try: # Python 3
|
|
28
|
-
from http.client import HTTPSConnection as _HTTPSConnection
|
|
29
|
-
except ImportError:
|
|
30
|
-
from httplib import HTTPSConnection as _HTTPSConnection
|
|
31
|
-
|
|
32
|
-
import ssl
|
|
33
|
-
BaseSSLError = ssl.SSLError
|
|
34
|
-
|
|
35
|
-
except (ImportError, AttributeError): # Platform-specific: No SSL.
|
|
36
|
-
pass
|
|
37
|
-
|
|
38
|
-
from .exceptions import (
|
|
39
|
-
ConnectTimeoutError,
|
|
40
|
-
)
|
|
41
|
-
from .packages.ssl_match_hostname import match_hostname
|
|
42
|
-
from .packages import six
|
|
43
|
-
from .util import (
|
|
44
|
-
assert_fingerprint,
|
|
45
|
-
resolve_cert_reqs,
|
|
46
|
-
resolve_ssl_version,
|
|
47
|
-
ssl_wrap_socket,
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
port_by_scheme = {
|
|
52
|
-
'http': 80,
|
|
53
|
-
'https': 443,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
class HTTPConnection(_HTTPConnection, object):
|
|
58
|
-
"""
|
|
59
|
-
Based on httplib.HTTPConnection but provides an extra constructor
|
|
60
|
-
backwards-compatibility layer between older and newer Pythons.
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
default_port = port_by_scheme['http']
|
|
64
|
-
|
|
65
|
-
# By default, disable Nagle's Algorithm.
|
|
66
|
-
tcp_nodelay = 1
|
|
67
|
-
|
|
68
|
-
def __init__(self, *args, **kw):
|
|
69
|
-
if six.PY3: # Python 3
|
|
70
|
-
kw.pop('strict', None)
|
|
71
|
-
if sys.version_info < (2, 7): # Python 2.6 and older
|
|
72
|
-
kw.pop('source_address', None)
|
|
73
|
-
|
|
74
|
-
# Pre-set source_address in case we have an older Python like 2.6.
|
|
75
|
-
self.source_address = kw.get('source_address')
|
|
76
|
-
|
|
77
|
-
# Superclass also sets self.source_address in Python 2.7+.
|
|
78
|
-
_HTTPConnection.__init__(self, *args, **kw)
|
|
79
|
-
|
|
80
|
-
def _new_conn(self):
|
|
81
|
-
""" Establish a socket connection and set nodelay settings on it.
|
|
82
|
-
|
|
83
|
-
:return: a new socket connection
|
|
84
|
-
"""
|
|
85
|
-
extra_args = []
|
|
86
|
-
if self.source_address: # Python 2.7+
|
|
87
|
-
extra_args.append(self.source_address)
|
|
88
|
-
|
|
89
|
-
conn = socket.create_connection(
|
|
90
|
-
(self.host, self.port), self.timeout, *extra_args)
|
|
91
|
-
conn.setsockopt(
|
|
92
|
-
socket.IPPROTO_TCP, socket.TCP_NODELAY, self.tcp_nodelay)
|
|
93
|
-
|
|
94
|
-
return conn
|
|
95
|
-
|
|
96
|
-
def _prepare_conn(self, conn):
|
|
97
|
-
self.sock = conn
|
|
98
|
-
# the _tunnel_host attribute was added in python 2.6.3 (via
|
|
99
|
-
# http://hg.python.org/cpython/rev/0f57b30a152f) so pythons 2.6(0-2) do
|
|
100
|
-
# not have them.
|
|
101
|
-
if getattr(self, '_tunnel_host', None):
|
|
102
|
-
# TODO: Fix tunnel so it doesn't depend on self.sock state.
|
|
103
|
-
self._tunnel()
|
|
104
|
-
|
|
105
|
-
def connect(self):
|
|
106
|
-
conn = self._new_conn()
|
|
107
|
-
self._prepare_conn(conn)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
class HTTPSConnection(HTTPConnection):
|
|
111
|
-
default_port = port_by_scheme['https']
|
|
112
|
-
|
|
113
|
-
def __init__(self, host, port=None, key_file=None, cert_file=None,
|
|
114
|
-
strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, **kw):
|
|
115
|
-
|
|
116
|
-
HTTPConnection.__init__(self, host, port, strict=strict,
|
|
117
|
-
timeout=timeout, **kw)
|
|
118
|
-
|
|
119
|
-
self.key_file = key_file
|
|
120
|
-
self.cert_file = cert_file
|
|
121
|
-
|
|
122
|
-
# Required property for Google AppEngine 1.9.0 which otherwise causes
|
|
123
|
-
# HTTPS requests to go out as HTTP. (See Issue #356)
|
|
124
|
-
self._protocol = 'https'
|
|
125
|
-
|
|
126
|
-
def connect(self):
|
|
127
|
-
conn = self._new_conn()
|
|
128
|
-
self._prepare_conn(conn)
|
|
129
|
-
self.sock = ssl.wrap_socket(conn, self.key_file, self.cert_file)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
class VerifiedHTTPSConnection(HTTPSConnection):
|
|
133
|
-
"""
|
|
134
|
-
Based on httplib.HTTPSConnection but wraps the socket with
|
|
135
|
-
SSL certification.
|
|
136
|
-
"""
|
|
137
|
-
cert_reqs = None
|
|
138
|
-
ca_certs = None
|
|
139
|
-
ssl_version = None
|
|
140
|
-
conn_kw = {}
|
|
141
|
-
|
|
142
|
-
def set_cert(self, key_file=None, cert_file=None,
|
|
143
|
-
cert_reqs=None, ca_certs=None,
|
|
144
|
-
assert_hostname=None, assert_fingerprint=None):
|
|
145
|
-
|
|
146
|
-
self.key_file = key_file
|
|
147
|
-
self.cert_file = cert_file
|
|
148
|
-
self.cert_reqs = cert_reqs
|
|
149
|
-
self.ca_certs = ca_certs
|
|
150
|
-
self.assert_hostname = assert_hostname
|
|
151
|
-
self.assert_fingerprint = assert_fingerprint
|
|
152
|
-
|
|
153
|
-
def connect(self):
|
|
154
|
-
# Add certificate verification
|
|
155
|
-
|
|
156
|
-
try:
|
|
157
|
-
sock = socket.create_connection(
|
|
158
|
-
address=(self.host, self.port), timeout=self.timeout,
|
|
159
|
-
**self.conn_kw)
|
|
160
|
-
except SocketTimeout:
|
|
161
|
-
raise ConnectTimeoutError(
|
|
162
|
-
self, "Connection to %s timed out. (connect timeout=%s)" %
|
|
163
|
-
(self.host, self.timeout))
|
|
164
|
-
|
|
165
|
-
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY,
|
|
166
|
-
self.tcp_nodelay)
|
|
167
|
-
|
|
168
|
-
resolved_cert_reqs = resolve_cert_reqs(self.cert_reqs)
|
|
169
|
-
resolved_ssl_version = resolve_ssl_version(self.ssl_version)
|
|
170
|
-
|
|
171
|
-
hostname = self.host
|
|
172
|
-
if getattr(self, '_tunnel_host', None):
|
|
173
|
-
# _tunnel_host was added in Python 2.6.3
|
|
174
|
-
# (See: http://hg.python.org/cpython/rev/0f57b30a152f)
|
|
175
|
-
|
|
176
|
-
self.sock = sock
|
|
177
|
-
# Calls self._set_hostport(), so self.host is
|
|
178
|
-
# self._tunnel_host below.
|
|
179
|
-
self._tunnel()
|
|
180
|
-
|
|
181
|
-
# Override the host with the one we're requesting data from.
|
|
182
|
-
hostname = self._tunnel_host
|
|
183
|
-
|
|
184
|
-
# Wrap socket using verification with the root certs in
|
|
185
|
-
# trusted_root_certs
|
|
186
|
-
self.sock = ssl_wrap_socket(sock, self.key_file, self.cert_file,
|
|
187
|
-
cert_reqs=resolved_cert_reqs,
|
|
188
|
-
ca_certs=self.ca_certs,
|
|
189
|
-
server_hostname=hostname,
|
|
190
|
-
ssl_version=resolved_ssl_version)
|
|
191
|
-
|
|
192
|
-
if resolved_cert_reqs != ssl.CERT_NONE:
|
|
193
|
-
if self.assert_fingerprint:
|
|
194
|
-
assert_fingerprint(self.sock.getpeercert(binary_form=True),
|
|
195
|
-
self.assert_fingerprint)
|
|
196
|
-
elif self.assert_hostname is not False:
|
|
197
|
-
match_hostname(self.sock.getpeercert(),
|
|
198
|
-
self.assert_hostname or hostname)
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if ssl:
|
|
202
|
-
# Make a copy for testing.
|
|
203
|
-
UnverifiedHTTPSConnection = HTTPSConnection
|
|
204
|
-
HTTPSConnection = VerifiedHTTPSConnection
|
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
'''SSL with SNI_-support for Python 2. Follow these instructions if you would
|
|
2
|
-
like to verify SSL certificates in Python 2. Note, the default libraries do
|
|
3
|
-
*not* do certificate checking; you need to do additional work to validate
|
|
4
|
-
certificates yourself.
|
|
5
|
-
|
|
6
|
-
This needs the following packages installed:
|
|
7
|
-
|
|
8
|
-
* pyOpenSSL (tested with 0.13)
|
|
9
|
-
* ndg-httpsclient (tested with 0.3.2)
|
|
10
|
-
* pyasn1 (tested with 0.1.6)
|
|
11
|
-
|
|
12
|
-
You can install them with the following command:
|
|
13
|
-
|
|
14
|
-
pip install pyopenssl ndg-httpsclient pyasn1
|
|
15
|
-
|
|
16
|
-
To activate certificate checking, call
|
|
17
|
-
:func:`~urllib3.contrib.pyopenssl.inject_into_urllib3` from your Python code
|
|
18
|
-
before you begin making HTTP requests. This can be done in a ``sitecustomize``
|
|
19
|
-
module, or at any other time before your application begins using ``urllib3``,
|
|
20
|
-
like this::
|
|
21
|
-
|
|
22
|
-
try:
|
|
23
|
-
import urllib3.contrib.pyopenssl
|
|
24
|
-
urllib3.contrib.pyopenssl.inject_into_urllib3()
|
|
25
|
-
except ImportError:
|
|
26
|
-
pass
|
|
27
|
-
|
|
28
|
-
Now you can use :mod:`urllib3` as you normally would, and it will support SNI
|
|
29
|
-
when the required modules are installed.
|
|
30
|
-
|
|
31
|
-
Activating this module also has the positive side effect of disabling SSL/TLS
|
|
32
|
-
encryption in Python 2 (see `CRIME attack`_).
|
|
33
|
-
|
|
34
|
-
If you want to configure the default list of supported cipher suites, you can
|
|
35
|
-
set the ``urllib3.contrib.pyopenssl.DEFAULT_SSL_CIPHER_LIST`` variable.
|
|
36
|
-
|
|
37
|
-
Module Variables
|
|
38
|
-
----------------
|
|
39
|
-
|
|
40
|
-
:var DEFAULT_SSL_CIPHER_LIST: The list of supported SSL/TLS cipher suites.
|
|
41
|
-
Default: ``ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:
|
|
42
|
-
ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS``
|
|
43
|
-
|
|
44
|
-
.. _sni: https://en.wikipedia.org/wiki/Server_Name_Indication
|
|
45
|
-
.. _crime attack: https://en.wikipedia.org/wiki/CRIME_(security_exploit)
|
|
46
|
-
|
|
47
|
-
'''
|
|
48
|
-
|
|
49
|
-
from ndg.httpsclient.ssl_peer_verification import SUBJ_ALT_NAME_SUPPORT
|
|
50
|
-
from ndg.httpsclient.subj_alt_name import SubjectAltName as BaseSubjectAltName
|
|
51
|
-
import OpenSSL.SSL
|
|
52
|
-
from pyasn1.codec.der import decoder as der_decoder
|
|
53
|
-
from pyasn1.type import univ, constraint
|
|
54
|
-
from socket import _fileobject, timeout
|
|
55
|
-
import ssl
|
|
56
|
-
import select
|
|
57
|
-
from cStringIO import StringIO
|
|
58
|
-
|
|
59
|
-
from .. import connection
|
|
60
|
-
from .. import util
|
|
61
|
-
|
|
62
|
-
__all__ = ['inject_into_urllib3', 'extract_from_urllib3']
|
|
63
|
-
|
|
64
|
-
# SNI only *really* works if we can read the subjectAltName of certificates.
|
|
65
|
-
HAS_SNI = SUBJ_ALT_NAME_SUPPORT
|
|
66
|
-
|
|
67
|
-
# Map from urllib3 to PyOpenSSL compatible parameter-values.
|
|
68
|
-
_openssl_versions = {
|
|
69
|
-
ssl.PROTOCOL_SSLv23: OpenSSL.SSL.SSLv23_METHOD,
|
|
70
|
-
ssl.PROTOCOL_SSLv3: OpenSSL.SSL.SSLv3_METHOD,
|
|
71
|
-
ssl.PROTOCOL_TLSv1: OpenSSL.SSL.TLSv1_METHOD,
|
|
72
|
-
}
|
|
73
|
-
_openssl_verify = {
|
|
74
|
-
ssl.CERT_NONE: OpenSSL.SSL.VERIFY_NONE,
|
|
75
|
-
ssl.CERT_OPTIONAL: OpenSSL.SSL.VERIFY_PEER,
|
|
76
|
-
ssl.CERT_REQUIRED: OpenSSL.SSL.VERIFY_PEER
|
|
77
|
-
+ OpenSSL.SSL.VERIFY_FAIL_IF_NO_PEER_CERT,
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
# A secure default.
|
|
81
|
-
# Sources for more information on TLS ciphers:
|
|
82
|
-
#
|
|
83
|
-
# - https://wiki.mozilla.org/Security/Server_Side_TLS
|
|
84
|
-
# - https://www.ssllabs.com/projects/best-practices/index.html
|
|
85
|
-
# - https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
|
|
86
|
-
#
|
|
87
|
-
# The general intent is:
|
|
88
|
-
# - Prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE),
|
|
89
|
-
# - prefer ECDHE over DHE for better performance,
|
|
90
|
-
# - prefer any AES-GCM over any AES-CBC for better performance and security,
|
|
91
|
-
# - use 3DES as fallback which is secure but slow,
|
|
92
|
-
# - disable NULL authentication, MD5 MACs and DSS for security reasons.
|
|
93
|
-
DEFAULT_SSL_CIPHER_LIST = "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:" + \
|
|
94
|
-
"ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:" + \
|
|
95
|
-
"!aNULL:!MD5:!DSS"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
orig_util_HAS_SNI = util.HAS_SNI
|
|
99
|
-
orig_connection_ssl_wrap_socket = connection.ssl_wrap_socket
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
def inject_into_urllib3():
|
|
103
|
-
'Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.'
|
|
104
|
-
|
|
105
|
-
connection.ssl_wrap_socket = ssl_wrap_socket
|
|
106
|
-
util.HAS_SNI = HAS_SNI
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
def extract_from_urllib3():
|
|
110
|
-
'Undo monkey-patching by :func:`inject_into_urllib3`.'
|
|
111
|
-
|
|
112
|
-
connection.ssl_wrap_socket = orig_connection_ssl_wrap_socket
|
|
113
|
-
util.HAS_SNI = orig_util_HAS_SNI
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
### Note: This is a slightly bug-fixed version of same from ndg-httpsclient.
|
|
117
|
-
class SubjectAltName(BaseSubjectAltName):
|
|
118
|
-
'''ASN.1 implementation for subjectAltNames support'''
|
|
119
|
-
|
|
120
|
-
# There is no limit to how many SAN certificates a certificate may have,
|
|
121
|
-
# however this needs to have some limit so we'll set an arbitrarily high
|
|
122
|
-
# limit.
|
|
123
|
-
sizeSpec = univ.SequenceOf.sizeSpec + \
|
|
124
|
-
constraint.ValueSizeConstraint(1, 1024)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
### Note: This is a slightly bug-fixed version of same from ndg-httpsclient.
|
|
128
|
-
def get_subj_alt_name(peer_cert):
|
|
129
|
-
# Search through extensions
|
|
130
|
-
dns_name = []
|
|
131
|
-
if not SUBJ_ALT_NAME_SUPPORT:
|
|
132
|
-
return dns_name
|
|
133
|
-
|
|
134
|
-
general_names = SubjectAltName()
|
|
135
|
-
for i in range(peer_cert.get_extension_count()):
|
|
136
|
-
ext = peer_cert.get_extension(i)
|
|
137
|
-
ext_name = ext.get_short_name()
|
|
138
|
-
if ext_name != 'subjectAltName':
|
|
139
|
-
continue
|
|
140
|
-
|
|
141
|
-
# PyOpenSSL returns extension data in ASN.1 encoded form
|
|
142
|
-
ext_dat = ext.get_data()
|
|
143
|
-
decoded_dat = der_decoder.decode(ext_dat,
|
|
144
|
-
asn1Spec=general_names)
|
|
145
|
-
|
|
146
|
-
for name in decoded_dat:
|
|
147
|
-
if not isinstance(name, SubjectAltName):
|
|
148
|
-
continue
|
|
149
|
-
for entry in range(len(name)):
|
|
150
|
-
component = name.getComponentByPosition(entry)
|
|
151
|
-
if component.getName() != 'dNSName':
|
|
152
|
-
continue
|
|
153
|
-
dns_name.append(str(component.getComponent()))
|
|
154
|
-
|
|
155
|
-
return dns_name
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
class fileobject(_fileobject):
|
|
159
|
-
|
|
160
|
-
def _wait_for_sock(self):
|
|
161
|
-
rd, wd, ed = select.select([self._sock], [], [],
|
|
162
|
-
self._sock.gettimeout())
|
|
163
|
-
if not rd:
|
|
164
|
-
raise timeout()
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
def read(self, size=-1):
|
|
168
|
-
# Use max, disallow tiny reads in a loop as they are very inefficient.
|
|
169
|
-
# We never leave read() with any leftover data from a new recv() call
|
|
170
|
-
# in our internal buffer.
|
|
171
|
-
rbufsize = max(self._rbufsize, self.default_bufsize)
|
|
172
|
-
# Our use of StringIO rather than lists of string objects returned by
|
|
173
|
-
# recv() minimizes memory usage and fragmentation that occurs when
|
|
174
|
-
# rbufsize is large compared to the typical return value of recv().
|
|
175
|
-
buf = self._rbuf
|
|
176
|
-
buf.seek(0, 2) # seek end
|
|
177
|
-
if size < 0:
|
|
178
|
-
# Read until EOF
|
|
179
|
-
self._rbuf = StringIO() # reset _rbuf. we consume it via buf.
|
|
180
|
-
while True:
|
|
181
|
-
try:
|
|
182
|
-
data = self._sock.recv(rbufsize)
|
|
183
|
-
except OpenSSL.SSL.WantReadError:
|
|
184
|
-
self._wait_for_sock()
|
|
185
|
-
continue
|
|
186
|
-
if not data:
|
|
187
|
-
break
|
|
188
|
-
buf.write(data)
|
|
189
|
-
return buf.getvalue()
|
|
190
|
-
else:
|
|
191
|
-
# Read until size bytes or EOF seen, whichever comes first
|
|
192
|
-
buf_len = buf.tell()
|
|
193
|
-
if buf_len >= size:
|
|
194
|
-
# Already have size bytes in our buffer? Extract and return.
|
|
195
|
-
buf.seek(0)
|
|
196
|
-
rv = buf.read(size)
|
|
197
|
-
self._rbuf = StringIO()
|
|
198
|
-
self._rbuf.write(buf.read())
|
|
199
|
-
return rv
|
|
200
|
-
|
|
201
|
-
self._rbuf = StringIO() # reset _rbuf. we consume it via buf.
|
|
202
|
-
while True:
|
|
203
|
-
left = size - buf_len
|
|
204
|
-
# recv() will malloc the amount of memory given as its
|
|
205
|
-
# parameter even though it often returns much less data
|
|
206
|
-
# than that. The returned data string is short lived
|
|
207
|
-
# as we copy it into a StringIO and free it. This avoids
|
|
208
|
-
# fragmentation issues on many platforms.
|
|
209
|
-
try:
|
|
210
|
-
data = self._sock.recv(left)
|
|
211
|
-
except OpenSSL.SSL.WantReadError:
|
|
212
|
-
self._wait_for_sock()
|
|
213
|
-
continue
|
|
214
|
-
if not data:
|
|
215
|
-
break
|
|
216
|
-
n = len(data)
|
|
217
|
-
if n == size and not buf_len:
|
|
218
|
-
# Shortcut. Avoid buffer data copies when:
|
|
219
|
-
# - We have no data in our buffer.
|
|
220
|
-
# AND
|
|
221
|
-
# - Our call to recv returned exactly the
|
|
222
|
-
# number of bytes we were asked to read.
|
|
223
|
-
return data
|
|
224
|
-
if n == left:
|
|
225
|
-
buf.write(data)
|
|
226
|
-
del data # explicit free
|
|
227
|
-
break
|
|
228
|
-
assert n <= left, "recv(%d) returned %d bytes" % (left, n)
|
|
229
|
-
buf.write(data)
|
|
230
|
-
buf_len += n
|
|
231
|
-
del data # explicit free
|
|
232
|
-
#assert buf_len == buf.tell()
|
|
233
|
-
return buf.getvalue()
|
|
234
|
-
|
|
235
|
-
def readline(self, size=-1):
|
|
236
|
-
buf = self._rbuf
|
|
237
|
-
buf.seek(0, 2) # seek end
|
|
238
|
-
if buf.tell() > 0:
|
|
239
|
-
# check if we already have it in our buffer
|
|
240
|
-
buf.seek(0)
|
|
241
|
-
bline = buf.readline(size)
|
|
242
|
-
if bline.endswith('\n') or len(bline) == size:
|
|
243
|
-
self._rbuf = StringIO()
|
|
244
|
-
self._rbuf.write(buf.read())
|
|
245
|
-
return bline
|
|
246
|
-
del bline
|
|
247
|
-
if size < 0:
|
|
248
|
-
# Read until \n or EOF, whichever comes first
|
|
249
|
-
if self._rbufsize <= 1:
|
|
250
|
-
# Speed up unbuffered case
|
|
251
|
-
buf.seek(0)
|
|
252
|
-
buffers = [buf.read()]
|
|
253
|
-
self._rbuf = StringIO() # reset _rbuf. we consume it via buf.
|
|
254
|
-
data = None
|
|
255
|
-
recv = self._sock.recv
|
|
256
|
-
while True:
|
|
257
|
-
try:
|
|
258
|
-
while data != "\n":
|
|
259
|
-
data = recv(1)
|
|
260
|
-
if not data:
|
|
261
|
-
break
|
|
262
|
-
buffers.append(data)
|
|
263
|
-
except OpenSSL.SSL.WantReadError:
|
|
264
|
-
self._wait_for_sock()
|
|
265
|
-
continue
|
|
266
|
-
break
|
|
267
|
-
return "".join(buffers)
|
|
268
|
-
|
|
269
|
-
buf.seek(0, 2) # seek end
|
|
270
|
-
self._rbuf = StringIO() # reset _rbuf. we consume it via buf.
|
|
271
|
-
while True:
|
|
272
|
-
try:
|
|
273
|
-
data = self._sock.recv(self._rbufsize)
|
|
274
|
-
except OpenSSL.SSL.WantReadError:
|
|
275
|
-
self._wait_for_sock()
|
|
276
|
-
continue
|
|
277
|
-
if not data:
|
|
278
|
-
break
|
|
279
|
-
nl = data.find('\n')
|
|
280
|
-
if nl >= 0:
|
|
281
|
-
nl += 1
|
|
282
|
-
buf.write(data[:nl])
|
|
283
|
-
self._rbuf.write(data[nl:])
|
|
284
|
-
del data
|
|
285
|
-
break
|
|
286
|
-
buf.write(data)
|
|
287
|
-
return buf.getvalue()
|
|
288
|
-
else:
|
|
289
|
-
# Read until size bytes or \n or EOF seen, whichever comes first
|
|
290
|
-
buf.seek(0, 2) # seek end
|
|
291
|
-
buf_len = buf.tell()
|
|
292
|
-
if buf_len >= size:
|
|
293
|
-
buf.seek(0)
|
|
294
|
-
rv = buf.read(size)
|
|
295
|
-
self._rbuf = StringIO()
|
|
296
|
-
self._rbuf.write(buf.read())
|
|
297
|
-
return rv
|
|
298
|
-
self._rbuf = StringIO() # reset _rbuf. we consume it via buf.
|
|
299
|
-
while True:
|
|
300
|
-
try:
|
|
301
|
-
data = self._sock.recv(self._rbufsize)
|
|
302
|
-
except OpenSSL.SSL.WantReadError:
|
|
303
|
-
self._wait_for_sock()
|
|
304
|
-
continue
|
|
305
|
-
if not data:
|
|
306
|
-
break
|
|
307
|
-
left = size - buf_len
|
|
308
|
-
# did we just receive a newline?
|
|
309
|
-
nl = data.find('\n', 0, left)
|
|
310
|
-
if nl >= 0:
|
|
311
|
-
nl += 1
|
|
312
|
-
# save the excess data to _rbuf
|
|
313
|
-
self._rbuf.write(data[nl:])
|
|
314
|
-
if buf_len:
|
|
315
|
-
buf.write(data[:nl])
|
|
316
|
-
break
|
|
317
|
-
else:
|
|
318
|
-
# Shortcut. Avoid data copy through buf when returning
|
|
319
|
-
# a substring of our first recv().
|
|
320
|
-
return data[:nl]
|
|
321
|
-
n = len(data)
|
|
322
|
-
if n == size and not buf_len:
|
|
323
|
-
# Shortcut. Avoid data copy through buf when
|
|
324
|
-
# returning exactly all of our first recv().
|
|
325
|
-
return data
|
|
326
|
-
if n >= left:
|
|
327
|
-
buf.write(data[:left])
|
|
328
|
-
self._rbuf.write(data[left:])
|
|
329
|
-
break
|
|
330
|
-
buf.write(data)
|
|
331
|
-
buf_len += n
|
|
332
|
-
#assert buf_len == buf.tell()
|
|
333
|
-
return buf.getvalue()
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
class WrappedSocket(object):
|
|
337
|
-
'''API-compatibility wrapper for Python OpenSSL's Connection-class.'''
|
|
338
|
-
|
|
339
|
-
def __init__(self, connection, socket):
|
|
340
|
-
self.connection = connection
|
|
341
|
-
self.socket = socket
|
|
342
|
-
|
|
343
|
-
def fileno(self):
|
|
344
|
-
return self.socket.fileno()
|
|
345
|
-
|
|
346
|
-
def makefile(self, mode, bufsize=-1):
|
|
347
|
-
return fileobject(self.connection, mode, bufsize)
|
|
348
|
-
|
|
349
|
-
def settimeout(self, timeout):
|
|
350
|
-
return self.socket.settimeout(timeout)
|
|
351
|
-
|
|
352
|
-
def sendall(self, data):
|
|
353
|
-
return self.connection.sendall(data)
|
|
354
|
-
|
|
355
|
-
def close(self):
|
|
356
|
-
return self.connection.shutdown()
|
|
357
|
-
|
|
358
|
-
def getpeercert(self, binary_form=False):
|
|
359
|
-
x509 = self.connection.get_peer_certificate()
|
|
360
|
-
|
|
361
|
-
if not x509:
|
|
362
|
-
return x509
|
|
363
|
-
|
|
364
|
-
if binary_form:
|
|
365
|
-
return OpenSSL.crypto.dump_certificate(
|
|
366
|
-
OpenSSL.crypto.FILETYPE_ASN1,
|
|
367
|
-
x509)
|
|
368
|
-
|
|
369
|
-
return {
|
|
370
|
-
'subject': (
|
|
371
|
-
(('commonName', x509.get_subject().CN),),
|
|
372
|
-
),
|
|
373
|
-
'subjectAltName': [
|
|
374
|
-
('DNS', value)
|
|
375
|
-
for value in get_subj_alt_name(x509)
|
|
376
|
-
]
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
def _verify_callback(cnx, x509, err_no, err_depth, return_code):
|
|
381
|
-
return err_no == 0
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None,
|
|
385
|
-
ca_certs=None, server_hostname=None,
|
|
386
|
-
ssl_version=None):
|
|
387
|
-
ctx = OpenSSL.SSL.Context(_openssl_versions[ssl_version])
|
|
388
|
-
if certfile:
|
|
389
|
-
ctx.use_certificate_file(certfile)
|
|
390
|
-
if keyfile:
|
|
391
|
-
ctx.use_privatekey_file(keyfile)
|
|
392
|
-
if cert_reqs != ssl.CERT_NONE:
|
|
393
|
-
ctx.set_verify(_openssl_verify[cert_reqs], _verify_callback)
|
|
394
|
-
if ca_certs:
|
|
395
|
-
try:
|
|
396
|
-
ctx.load_verify_locations(ca_certs, None)
|
|
397
|
-
except OpenSSL.SSL.Error as e:
|
|
398
|
-
raise ssl.SSLError('bad ca_certs: %r' % ca_certs, e)
|
|
399
|
-
else:
|
|
400
|
-
ctx.set_default_verify_paths()
|
|
401
|
-
|
|
402
|
-
# Disable TLS compression to migitate CRIME attack (issue #309)
|
|
403
|
-
OP_NO_COMPRESSION = 0x20000
|
|
404
|
-
ctx.set_options(OP_NO_COMPRESSION)
|
|
405
|
-
|
|
406
|
-
# Set list of supported ciphersuites.
|
|
407
|
-
ctx.set_cipher_list(DEFAULT_SSL_CIPHER_LIST)
|
|
408
|
-
|
|
409
|
-
cnx = OpenSSL.SSL.Connection(ctx, sock)
|
|
410
|
-
cnx.set_tlsext_host_name(server_hostname)
|
|
411
|
-
cnx.set_connect_state()
|
|
412
|
-
while True:
|
|
413
|
-
try:
|
|
414
|
-
cnx.do_handshake()
|
|
415
|
-
except OpenSSL.SSL.WantReadError:
|
|
416
|
-
select.select([sock], [], [])
|
|
417
|
-
continue
|
|
418
|
-
except OpenSSL.SSL.Error as e:
|
|
419
|
-
raise ssl.SSLError('bad handshake', e)
|
|
420
|
-
break
|
|
421
|
-
|
|
422
|
-
return WrappedSocket(cnx, sock)
|