Repository: aio-libs/aiohttp

Issue:
Would do you like to rename SocketConnector to TCPSocketConnector?
I think SocketConnector name is too common name and it corresponds to BaseConnector, not to TCP sockets itself. The naming is ambiguous. I guess to save BaseConnector and get rid of SocketConnector.

Moreover, it would be better to rename SocketConnector -> TCPConnector and UnixSocketConnector -> UnixConnector.

If you like to keep backward compatibility (do you really pursuit the target for now?) you can add aliases.

What do you think about?



Discussion:
TCPConnector and UnixConnector  sounds good.


Resolving patch:
diff --git a/aiohttp/client.py b/aiohttp/client.py
--- a/aiohttp/client.py
+++ b/aiohttp/client.py
@@ -65,7 +65,7 @@ def request(method, url, *,
     :param chunked: Boolean or Integer. Set to chunk size for chunked
        transfer encoding.
     :param expect100: Boolean. Expect 100-continue response from server.
-    :param connector: aiohttp.conntect.SocketConnector instance to support
+    :param connector: aiohttp.conntect.BaseConnector instance to support
        connection pooling and session cookies.
     :param read_until_eof: Read response until eof if response
        does not have Content-Length header.
@@ -87,7 +87,7 @@ def request(method, url, *,
     if request_class is None:
         request_class = HttpRequest
     if connector is None:
-        connector = aiohttp.SocketConnector(loop=loop)
+        connector = aiohttp.TCPConnector(loop=loop)
 
     while True:
         req = request_class(
@@ -781,7 +781,7 @@ def __init__(self, hosts, *, method=None, path=None,
         self._loop = loop
 
         if conn_pool:
-            self._connector = aiohttp.SocketConnector(
+            self._connector = aiohttp.TCPConnector(
                 share_cookies=True, conn_timeout=conn_timeout,
                 resolve=resolve, verify_ssl=verify_ssl, loop=loop)
 
diff --git a/aiohttp/connector.py b/aiohttp/connector.py
--- a/aiohttp/connector.py
+++ b/aiohttp/connector.py
@@ -1,4 +1,4 @@
-__all__ = ['BaseConnector', 'SocketConnector', 'UnixSocketConnector']
+__all__ = ['BaseConnector', 'TCPConnector', 'UnixConnector']
 
 import asyncio
 import aiohttp
@@ -168,7 +168,7 @@ def _create_connection(self, req, *args, **kwargs):
         raise NotImplementedError()
 
 
-class SocketConnector(BaseConnector):
+class TCPConnector(BaseConnector):
 
     def __init__(self, *args, verify_ssl=True,
                  resolve=False, family=socket.AF_INET, **kwargs):
@@ -236,7 +236,7 @@ def _create_connection(self, req, **kwargs):
                     raise
 
 
-class UnixSocketConnector(BaseConnector):
+class UnixConnector(BaseConnector):
 
     def __init__(self, path, *args, **kw):
         super().__init__(*args, **kw)
diff --git a/examples/crawl.py b/examples/crawl.py
--- a/examples/crawl.py
+++ b/examples/crawl.py
@@ -22,7 +22,7 @@ def __init__(self, rooturl, loop, maxtasks=100):
         self.sem = asyncio.Semaphore(maxtasks)
 
         # connector stores cookies between requests and uses connection pool
-        self.connector = aiohttp.SocketConnector(share_cookies=True, loop=loop)
+        self.connector = aiohttp.TCPConnector(share_cookies=True, loop=loop)
 
     @asyncio.coroutine
     def run(self):


Test patch:
diff --git a/tests/test_client_functional.py b/tests/test_client_functional.py
--- a/tests/test_client_functional.py
+++ b/tests/test_client_functional.py
@@ -111,7 +111,7 @@ def test_client_defaults_HTTP_200_OK_METHOD(self):
             r.close()
 
     def test_HTTP_200_OK_METHOD_ssl(self):
-        connector = aiohttp.SocketConnector(verify_ssl=False, loop=self.loop)
+        connector = aiohttp.TCPConnector(verify_ssl=False, loop=self.loop)
 
         with test_utils.run_server(self.loop, use_ssl=True) as httpd:
             for meth in ('get', 'post', 'put', 'delete', 'head'):
@@ -555,7 +555,7 @@ def test_request_conn_closed(self):
 
     def test_keepalive(self):
         from aiohttp import connector
-        c = connector.SocketConnector(share_cookies=True, loop=self.loop)
+        c = connector.TCPConnector(share_cookies=True, loop=self.loop)
 
         with test_utils.run_server(self.loop, router=Functional) as httpd:
             r = self.loop.run_until_complete(
@@ -575,7 +575,7 @@ def test_keepalive(self):
             r.close()
 
     def test_session_close(self):
-        conn = aiohttp.SocketConnector(loop=self.loop)
+        conn = aiohttp.TCPConnector(loop=self.loop)
 
         with test_utils.run_server(self.loop, router=Functional) as httpd:
             r = self.loop.run_until_complete(
@@ -597,7 +597,7 @@ def test_session_close(self):
 
     def test_session_cookies(self):
         from aiohttp import connector
-        conn = connector.SocketConnector(share_cookies=True, loop=self.loop)
+        conn = connector.TCPConnector(share_cookies=True, loop=self.loop)
 
         with test_utils.run_server(self.loop, router=Functional) as httpd:
             conn.update_cookies({'test': '1'})
diff --git a/tests/test_connector.py b/tests/test_connector.py
--- a/tests/test_connector.py
+++ b/tests/test_connector.py
@@ -251,7 +251,7 @@ def test_tcp_connector(self):
             r = self.loop.run_until_complete(
                 client.request(
                     'get', httpd.url('method', 'get'),
-                    connector=aiohttp.SocketConnector(loop=self.loop),
+                    connector=aiohttp.TCPConnector(loop=self.loop),
                     loop=self.loop))
             content = self.loop.run_until_complete(r.content.read())
             content = content.decode()
@@ -267,7 +267,7 @@ def test_unix_connector(self):
             r = self.loop.run_until_complete(
                 client.request(
                     'get', httpd.url('method', 'get'),
-                    connector=aiohttp.UnixSocketConnector(
+                    connector=aiohttp.UnixConnector(
                         path, loop=self.loop),
                     loop=self.loop))
             content = self.loop.run_until_complete(r.content.read())