summaryrefslogtreecommitdiffstats
path: root/third_party/python/idna-ssl
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/python/idna-ssl')
-rw-r--r--third_party/python/idna-ssl/LICENSE22
-rw-r--r--third_party/python/idna-ssl/MANIFEST.in4
-rw-r--r--third_party/python/idna-ssl/PKG-INFO81
-rw-r--r--third_party/python/idna-ssl/README.rst60
-rw-r--r--third_party/python/idna-ssl/idna_ssl.egg-info/PKG-INFO81
-rw-r--r--third_party/python/idna-ssl/idna_ssl.egg-info/SOURCES.txt12
-rw-r--r--third_party/python/idna-ssl/idna_ssl.egg-info/dependency_links.txt1
-rw-r--r--third_party/python/idna-ssl/idna_ssl.egg-info/not-zip-safe1
-rw-r--r--third_party/python/idna-ssl/idna_ssl.egg-info/requires.txt1
-rw-r--r--third_party/python/idna-ssl/idna_ssl.egg-info/top_level.txt1
-rw-r--r--third_party/python/idna-ssl/idna_ssl.py40
-rw-r--r--third_party/python/idna-ssl/setup.cfg15
-rw-r--r--third_party/python/idna-ssl/setup.py53
13 files changed, 372 insertions, 0 deletions
diff --git a/third_party/python/idna-ssl/LICENSE b/third_party/python/idna-ssl/LICENSE
new file mode 100644
index 0000000000..13ff0bb0c7
--- /dev/null
+++ b/third_party/python/idna-ssl/LICENSE
@@ -0,0 +1,22 @@
+The MIT License
+
+Copyright (c) 2018 aio-libs team https://github.com/aio-libs/
+Copyright (c) 2017 Ocean S. A. https://ocean.io/
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/third_party/python/idna-ssl/MANIFEST.in b/third_party/python/idna-ssl/MANIFEST.in
new file mode 100644
index 0000000000..e24206f795
--- /dev/null
+++ b/third_party/python/idna-ssl/MANIFEST.in
@@ -0,0 +1,4 @@
+include README.rst
+include LICENSE
+recursive-exclude * __pycache__
+recursive-exclude * *.py[co]
diff --git a/third_party/python/idna-ssl/PKG-INFO b/third_party/python/idna-ssl/PKG-INFO
new file mode 100644
index 0000000000..54ea22146d
--- /dev/null
+++ b/third_party/python/idna-ssl/PKG-INFO
@@ -0,0 +1,81 @@
+Metadata-Version: 1.1
+Name: idna-ssl
+Version: 1.1.0
+Summary: Patch ssl.match_hostname for Unicode(idna) domains support
+Home-page: https://github.com/aio-libs/idna-ssl
+Author: Victor Kovtun
+Author-email: hellysmile@gmail.com
+License: UNKNOWN
+Description: idna-ssl
+ ========
+
+ :info: Patch ssl.match_hostname for Unicode(idna) domains support
+
+ .. image:: https://travis-ci.com/aio-libs/idna-ssl.svg?branch=master
+ :target: https://travis-ci.com/aio-libs/idna-ssl
+
+ .. image:: https://img.shields.io/pypi/v/idna_ssl.svg
+ :target: https://pypi.python.org/pypi/idna_ssl
+
+ .. image:: https://codecov.io/gh/aio-libs/idna-ssl/branch/master/graph/badge.svg
+ :target: https://codecov.io/gh/aio-libs/idna-ssl
+
+ Installation
+ ------------
+
+ .. code-block:: shell
+
+ pip install idna-ssl
+
+ Usage
+ -----
+
+ .. code-block:: python
+
+ from idna_ssl import patch_match_hostname # noqa isort:skip
+ patch_match_hostname() # noqa isort:skip
+
+ import asyncio
+
+ import aiohttp
+
+ URL = 'https://цфоут.мвд.рф/news/item/8065038/'
+
+
+ async def main():
+ async with aiohttp.ClientSession() as session:
+ async with session.get(URL) as response:
+ print(response)
+
+
+ loop = asyncio.get_event_loop()
+ loop.run_until_complete(main())
+
+ Motivation
+ ----------
+
+ * Here is 100% backward capability
+ * Related aiohttp `issue <https://github.com/aio-libs/aiohttp/issues/949>`_
+ * Related Python `bug <https://bugs.python.org/issue31872>`_
+ * Related Python `pull request <https://github.com/python/cpython/pull/3462>`_
+ * It is fixed (by January 27 2018) in upcoming Python 3.7, but `IDNA2008 <https://tools.ietf.org/html/rfc5895>`_ is still broken
+
+ Thanks
+ ------
+
+ The library was donated by `Ocean S.A. <https://ocean.io/>`_
+
+ Thanks to the company for contribution.
+
+Keywords: ssl,Unicode,idna,match_hostname
+Platform: UNKNOWN
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
diff --git a/third_party/python/idna-ssl/README.rst b/third_party/python/idna-ssl/README.rst
new file mode 100644
index 0000000000..687e8b674a
--- /dev/null
+++ b/third_party/python/idna-ssl/README.rst
@@ -0,0 +1,60 @@
+idna-ssl
+========
+
+:info: Patch ssl.match_hostname for Unicode(idna) domains support
+
+.. image:: https://travis-ci.com/aio-libs/idna-ssl.svg?branch=master
+ :target: https://travis-ci.com/aio-libs/idna-ssl
+
+.. image:: https://img.shields.io/pypi/v/idna_ssl.svg
+ :target: https://pypi.python.org/pypi/idna_ssl
+
+.. image:: https://codecov.io/gh/aio-libs/idna-ssl/branch/master/graph/badge.svg
+ :target: https://codecov.io/gh/aio-libs/idna-ssl
+
+Installation
+------------
+
+.. code-block:: shell
+
+ pip install idna-ssl
+
+Usage
+-----
+
+.. code-block:: python
+
+ from idna_ssl import patch_match_hostname # noqa isort:skip
+ patch_match_hostname() # noqa isort:skip
+
+ import asyncio
+
+ import aiohttp
+
+ URL = 'https://цфоут.мвд.рф/news/item/8065038/'
+
+
+ async def main():
+ async with aiohttp.ClientSession() as session:
+ async with session.get(URL) as response:
+ print(response)
+
+
+ loop = asyncio.get_event_loop()
+ loop.run_until_complete(main())
+
+Motivation
+----------
+
+* Here is 100% backward capability
+* Related aiohttp `issue <https://github.com/aio-libs/aiohttp/issues/949>`_
+* Related Python `bug <https://bugs.python.org/issue31872>`_
+* Related Python `pull request <https://github.com/python/cpython/pull/3462>`_
+* It is fixed (by January 27 2018) in upcoming Python 3.7, but `IDNA2008 <https://tools.ietf.org/html/rfc5895>`_ is still broken
+
+Thanks
+------
+
+The library was donated by `Ocean S.A. <https://ocean.io/>`_
+
+Thanks to the company for contribution.
diff --git a/third_party/python/idna-ssl/idna_ssl.egg-info/PKG-INFO b/third_party/python/idna-ssl/idna_ssl.egg-info/PKG-INFO
new file mode 100644
index 0000000000..54ea22146d
--- /dev/null
+++ b/third_party/python/idna-ssl/idna_ssl.egg-info/PKG-INFO
@@ -0,0 +1,81 @@
+Metadata-Version: 1.1
+Name: idna-ssl
+Version: 1.1.0
+Summary: Patch ssl.match_hostname for Unicode(idna) domains support
+Home-page: https://github.com/aio-libs/idna-ssl
+Author: Victor Kovtun
+Author-email: hellysmile@gmail.com
+License: UNKNOWN
+Description: idna-ssl
+ ========
+
+ :info: Patch ssl.match_hostname for Unicode(idna) domains support
+
+ .. image:: https://travis-ci.com/aio-libs/idna-ssl.svg?branch=master
+ :target: https://travis-ci.com/aio-libs/idna-ssl
+
+ .. image:: https://img.shields.io/pypi/v/idna_ssl.svg
+ :target: https://pypi.python.org/pypi/idna_ssl
+
+ .. image:: https://codecov.io/gh/aio-libs/idna-ssl/branch/master/graph/badge.svg
+ :target: https://codecov.io/gh/aio-libs/idna-ssl
+
+ Installation
+ ------------
+
+ .. code-block:: shell
+
+ pip install idna-ssl
+
+ Usage
+ -----
+
+ .. code-block:: python
+
+ from idna_ssl import patch_match_hostname # noqa isort:skip
+ patch_match_hostname() # noqa isort:skip
+
+ import asyncio
+
+ import aiohttp
+
+ URL = 'https://цфоут.мвд.рф/news/item/8065038/'
+
+
+ async def main():
+ async with aiohttp.ClientSession() as session:
+ async with session.get(URL) as response:
+ print(response)
+
+
+ loop = asyncio.get_event_loop()
+ loop.run_until_complete(main())
+
+ Motivation
+ ----------
+
+ * Here is 100% backward capability
+ * Related aiohttp `issue <https://github.com/aio-libs/aiohttp/issues/949>`_
+ * Related Python `bug <https://bugs.python.org/issue31872>`_
+ * Related Python `pull request <https://github.com/python/cpython/pull/3462>`_
+ * It is fixed (by January 27 2018) in upcoming Python 3.7, but `IDNA2008 <https://tools.ietf.org/html/rfc5895>`_ is still broken
+
+ Thanks
+ ------
+
+ The library was donated by `Ocean S.A. <https://ocean.io/>`_
+
+ Thanks to the company for contribution.
+
+Keywords: ssl,Unicode,idna,match_hostname
+Platform: UNKNOWN
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
diff --git a/third_party/python/idna-ssl/idna_ssl.egg-info/SOURCES.txt b/third_party/python/idna-ssl/idna_ssl.egg-info/SOURCES.txt
new file mode 100644
index 0000000000..0ed8815e28
--- /dev/null
+++ b/third_party/python/idna-ssl/idna_ssl.egg-info/SOURCES.txt
@@ -0,0 +1,12 @@
+LICENSE
+MANIFEST.in
+README.rst
+idna_ssl.py
+setup.cfg
+setup.py
+idna_ssl.egg-info/PKG-INFO
+idna_ssl.egg-info/SOURCES.txt
+idna_ssl.egg-info/dependency_links.txt
+idna_ssl.egg-info/not-zip-safe
+idna_ssl.egg-info/requires.txt
+idna_ssl.egg-info/top_level.txt \ No newline at end of file
diff --git a/third_party/python/idna-ssl/idna_ssl.egg-info/dependency_links.txt b/third_party/python/idna-ssl/idna_ssl.egg-info/dependency_links.txt
new file mode 100644
index 0000000000..8b13789179
--- /dev/null
+++ b/third_party/python/idna-ssl/idna_ssl.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/third_party/python/idna-ssl/idna_ssl.egg-info/not-zip-safe b/third_party/python/idna-ssl/idna_ssl.egg-info/not-zip-safe
new file mode 100644
index 0000000000..8b13789179
--- /dev/null
+++ b/third_party/python/idna-ssl/idna_ssl.egg-info/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/third_party/python/idna-ssl/idna_ssl.egg-info/requires.txt b/third_party/python/idna-ssl/idna_ssl.egg-info/requires.txt
new file mode 100644
index 0000000000..af5772da99
--- /dev/null
+++ b/third_party/python/idna-ssl/idna_ssl.egg-info/requires.txt
@@ -0,0 +1 @@
+idna>=2.0
diff --git a/third_party/python/idna-ssl/idna_ssl.egg-info/top_level.txt b/third_party/python/idna-ssl/idna_ssl.egg-info/top_level.txt
new file mode 100644
index 0000000000..15da36aac1
--- /dev/null
+++ b/third_party/python/idna-ssl/idna_ssl.egg-info/top_level.txt
@@ -0,0 +1 @@
+idna_ssl
diff --git a/third_party/python/idna-ssl/idna_ssl.py b/third_party/python/idna-ssl/idna_ssl.py
new file mode 100644
index 0000000000..59db9bd469
--- /dev/null
+++ b/third_party/python/idna-ssl/idna_ssl.py
@@ -0,0 +1,40 @@
+import ssl
+import sys
+
+import idna
+
+__version__ = '1.1.0'
+
+real_match_hostname = ssl.match_hostname
+
+PY_370 = sys.version_info >= (3, 7, 0)
+
+
+def patched_match_hostname(cert, hostname):
+ try:
+ hostname = idna.encode(hostname, uts46=True).decode('ascii')
+ except UnicodeError:
+ hostname = hostname.encode('idna').decode('ascii')
+
+ return real_match_hostname(cert, hostname)
+
+
+def patch_match_hostname():
+ if PY_370:
+ return
+
+ if hasattr(ssl.match_hostname, 'patched'):
+ return
+
+ ssl.match_hostname = patched_match_hostname
+ ssl.match_hostname.patched = True
+
+
+def reset_match_hostname():
+ if PY_370:
+ return
+
+ if not hasattr(ssl.match_hostname, 'patched'):
+ return
+
+ ssl.match_hostname = real_match_hostname
diff --git a/third_party/python/idna-ssl/setup.cfg b/third_party/python/idna-ssl/setup.cfg
new file mode 100644
index 0000000000..3eba006ab9
--- /dev/null
+++ b/third_party/python/idna-ssl/setup.cfg
@@ -0,0 +1,15 @@
+[coverage:run]
+branch = True
+omit = site-packages
+
+[isort]
+known_third_party = aiohttp
+known_first_party = idna_ssl
+
+[tool:pytest]
+addopts = -s --keep-duplicates --cache-clear --verbose --no-cov-on-fail --cov=idna_ssl --cov-report=term --cov-report=html
+
+[egg_info]
+tag_build =
+tag_date = 0
+
diff --git a/third_party/python/idna-ssl/setup.py b/third_party/python/idna-ssl/setup.py
new file mode 100644
index 0000000000..da180db2c5
--- /dev/null
+++ b/third_party/python/idna-ssl/setup.py
@@ -0,0 +1,53 @@
+import io
+import os
+import re
+import sys
+
+from setuptools import setup
+
+needs_pytest = 'pytest' in set(sys.argv)
+
+
+def get_version():
+ regex = r"__version__\s=\s\'(?P<version>[\d\.ab]+?)\'"
+
+ path = ('idna_ssl.py',)
+
+ return re.search(regex, read(*path)).group('version')
+
+
+def read(*parts):
+ filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), *parts)
+
+ with io.open(filename, encoding='utf-8', mode='rt') as fp:
+ return fp.read()
+
+
+setup(
+ name='idna-ssl',
+ version=get_version(),
+ author='Victor Kovtun',
+ author_email='hellysmile@gmail.com',
+ url='https://github.com/aio-libs/idna-ssl',
+ description='Patch ssl.match_hostname for Unicode(idna) domains support',
+ long_description=read('README.rst'),
+ setup_requires=['pytest-runner'] if needs_pytest else [],
+ tests_require=['pytest', 'pytest-asyncio', 'pytest-cov', 'aiohttp>2.3'],
+ py_modules=['idna_ssl'],
+ install_requires=['idna>=2.0'],
+ include_package_data=True,
+ zip_safe=False,
+ classifiers=[
+ 'Development Status :: 4 - Beta',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: MIT License',
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
+ ],
+ keywords=['ssl', 'Unicode', 'idna', 'match_hostname'],
+)