Skip to content

Commit

Permalink
Merge pull request #561 from KeepSafe/family_zero
Browse files Browse the repository at this point in the history
TCPConnector processes both IPv4 and IPv6 by default #559
  • Loading branch information
asvetlov committed Oct 10, 2015
2 parents 72a6a07 + 21d004a commit 956a0db
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ CHANGES
- Add `async with` support for `ClientSession.request()` and family #536

- Ignore message body on 204 and 304 responses #505

- `TCPConnector` processed both IPv4 and IPv6 by default #559
2 changes: 1 addition & 1 deletion aiohttp/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ class TCPConnector(BaseConnector):

def __init__(self, *, verify_ssl=True, fingerprint=None,
resolve=_marker, use_dns_cache=_marker,
family=socket.AF_INET, ssl_context=None,
family=0, ssl_context=None,
**kwargs):
super().__init__(**kwargs)

Expand Down
17 changes: 13 additions & 4 deletions docs/client_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,9 @@ BaseConnector
TCPConnector
^^^^^^^^^^^^

.. class:: TCPConnector(*, verify_ssl=True, fingerprint=None, use_dns_cache=False, \
family=socket.AF_INET, \
.. class:: TCPConnector(*, verify_ssl=True, fingerprint=None,\
use_dns_cache=False, \
family=0, \
ssl_context=None, conn_timeout=None, \
keepalive_timeout=30, limit=None, share_cookies=False, \
force_close=False, loop=None)
Expand Down Expand Up @@ -660,8 +661,16 @@ TCPConnector

.. deprecated:: 0.17

:param int family: TCP socket family, ``AF_INET`` by default
(*IPv4*). For *IPv6* use ``AF_INET6``.
:param int family: TCP socket family, both IPv4 and IPv6 by default.
For *IPv4* only use :const:`socket.AF_INET`,
for *IPv6* only -- :const:`socket.AF_INET6`.

.. versionchanged:: 0.18

*family* is `0` by default, that means both IPv4 and IPv6 are
accepted. To specify only concrete version please pass
:const:`socket.AF_INET` or :const:`socket.AF_INET6`
explicitly.

:param ssl.SSLContext ssl_context: ssl context used for processing
*HTTPS* requests (optional).
Expand Down
2 changes: 1 addition & 1 deletion tests/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def test_tcp_connector_ctor(self):
self.assertFalse(conn.resolve)
self.assertFalse(conn.use_dns_cache)

self.assertEqual(conn.family, socket.AF_INET)
self.assertEqual(conn.family, 0)

with self.assertWarns(DeprecationWarning):
self.assertEqual(conn.resolved_hosts, {})
Expand Down

0 comments on commit 956a0db

Please sign in to comment.