We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
--proxy-headers with supervisor get client ip failed
#### uvicorn version
`Running uvicorn 0.11.3 with CPython 3.8.2 on Linux` 
#### supervisor config
```
[fcgi-program:uvicorn]
socket=tcp://0.0.0.0:5000    
directory=/var/www/webapp/    
command=/usr/local/python3/bin/uvicorn --fd 0 --proxy-headers main:app    
numprocs=2    
process_name=uvicorn-%(process_num)d    
stdout_logfile_maxbytes=0    
stdout_logfile=/var/log/uvicorn.log    
```

### fastapi 
version 0.52.0

```
# cat /var/www/webapp/main.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from fastapi import FastAPI, Request

app = FastAPI(redoc_url=None)


@app.get('/')
def index(request: Request):
    return 'hello {}!'.format(request.client.host)

```

### run on supervisor
supervisord version 4.1.0
```
supervisord -n
curl  http://127.0.0.1:5000

```
why client.host is None?


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `uvicorn/protocols/utils.py`
Content:
```
1 import socket
2 
3 
4 def get_remote_addr(transport):
5     socket_info = transport.get_extra_info("socket")
6     if socket_info is not None:
7         try:
8             info = socket_info.getpeername()
9         except OSError:
10             # This case appears to inconsistently occur with uvloop
11             # bound to a unix domain socket.
12             family = None
13             info = None
14         else:
15             family = socket_info.family
16 
17         if family in (socket.AF_INET, socket.AF_INET6):
18             return (str(info[0]), int(info[1]))
19         return None
20     info = transport.get_extra_info("peername")
21     if info is not None and isinstance(info, (list, tuple)) and len(info) == 2:
22         return (str(info[0]), int(info[1]))
23     return None
24 
25 
26 def get_local_addr(transport):
27     socket_info = transport.get_extra_info("socket")
28     if socket_info is not None:
29         info = socket_info.getsockname()
30         family = socket_info.family
31         if family in (socket.AF_INET, socket.AF_INET6):
32             return (str(info[0]), int(info[1]))
33         return None
34     info = transport.get_extra_info("sockname")
35     if info is not None and isinstance(info, (list, tuple)) and len(info) == 2:
36         return (str(info[0]), int(info[1]))
37     return None
38 
39 
40 def is_ssl(transport):
41     return bool(transport.get_extra_info("sslcontext"))
42 
43 
44 def get_client_addr(scope):
45     client = scope.get("client")
46     if not client:
47         return ""
48     return "%s:%d" % client
49 
50 
51 def get_path_with_query_string(scope):
52     path_with_query_string = scope.get("root_path", "") + scope["path"]
53     if scope["query_string"]:
54         path_with_query_string = "{}?{}".format(
55             path_with_query_string, scope["query_string"].decode("ascii")
56         )
57     return path_with_query_string
58
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/uvicorn/protocols/utils.py b/uvicorn/protocols/utils.py
--- a/uvicorn/protocols/utils.py
+++ b/uvicorn/protocols/utils.py
@@ -1,5 +1,10 @@
 import socket
 
+if hasattr(socket, "AF_UNIX"):
+    SUPPORTED_SOCKET_FAMILIES = (socket.AF_INET, socket.AF_INET6, socket.AF_UNIX)
+else:
+    SUPPORTED_SOCKET_FAMILIES = (socket.AF_INET, socket.AF_INET6)
+
 
 def get_remote_addr(transport):
     socket_info = transport.get_extra_info("socket")
@@ -14,8 +19,9 @@
         else:
             family = socket_info.family
 
-        if family in (socket.AF_INET, socket.AF_INET6):
+        if family in SUPPORTED_SOCKET_FAMILIES:
             return (str(info[0]), int(info[1]))
+
         return None
     info = transport.get_extra_info("peername")
     if info is not None and isinstance(info, (list, tuple)) and len(info) == 2:
@@ -28,7 +34,7 @@
     if socket_info is not None:
         info = socket_info.getsockname()
         family = socket_info.family
-        if family in (socket.AF_INET, socket.AF_INET6):
+        if family in SUPPORTED_SOCKET_FAMILIES:
             return (str(info[0]), int(info[1]))
         return None
     info = transport.get_extra_info("sockname")

{"golden_diff": "diff --git a/uvicorn/protocols/utils.py b/uvicorn/protocols/utils.py\n--- a/uvicorn/protocols/utils.py\n+++ b/uvicorn/protocols/utils.py\n@@ -1,5 +1,10 @@\n import socket\n \n+if hasattr(socket, \"AF_UNIX\"):\n+    SUPPORTED_SOCKET_FAMILIES = (socket.AF_INET, socket.AF_INET6, socket.AF_UNIX)\n+else:\n+    SUPPORTED_SOCKET_FAMILIES = (socket.AF_INET, socket.AF_INET6)\n+\n \n def get_remote_addr(transport):\n     socket_info = transport.get_extra_info(\"socket\")\n@@ -14,8 +19,9 @@\n         else:\n             family = socket_info.family\n \n-        if family in (socket.AF_INET, socket.AF_INET6):\n+        if family in SUPPORTED_SOCKET_FAMILIES:\n             return (str(info[0]), int(info[1]))\n+\n         return None\n     info = transport.get_extra_info(\"peername\")\n     if info is not None and isinstance(info, (list, tuple)) and len(info) == 2:\n@@ -28,7 +34,7 @@\n     if socket_info is not None:\n         info = socket_info.getsockname()\n         family = socket_info.family\n-        if family in (socket.AF_INET, socket.AF_INET6):\n+        if family in SUPPORTED_SOCKET_FAMILIES:\n             return (str(info[0]), int(info[1]))\n         return None\n     info = transport.get_extra_info(\"sockname\")\n", "issue": "--proxy-headers with supervisor get client ip failed\n#### uvicorn version\r\n`Running uvicorn 0.11.3 with CPython 3.8.2 on Linux` \r\n#### supervisor config\r\n```\r\n[fcgi-program:uvicorn]\r\nsocket=tcp://0.0.0.0:5000    \r\ndirectory=/var/www/webapp/    \r\ncommand=/usr/local/python3/bin/uvicorn --fd 0 --proxy-headers main:app    \r\nnumprocs=2    \r\nprocess_name=uvicorn-%(process_num)d    \r\nstdout_logfile_maxbytes=0    \r\nstdout_logfile=/var/log/uvicorn.log    \r\n```\r\n\r\n### fastapi \r\nversion 0.52.0\r\n\r\n```\r\n# cat /var/www/webapp/main.py\r\n\r\n#!/usr/bin/env python\r\n# -*- coding: utf-8 -*-\r\nfrom fastapi import FastAPI, Request\r\n\r\napp = FastAPI(redoc_url=None)\r\n\r\n\r\n@app.get('/')\r\ndef index(request: Request):\r\n    return 'hello {}!'.format(request.client.host)\r\n\r\n```\r\n\r\n### run on supervisor\r\nsupervisord version 4.1.0\r\n```\r\nsupervisord -n\r\ncurl  http://127.0.0.1:5000\r\n\r\n```\r\nwhy client.host is None?\r\n\n", "before_files": [{"content": "import socket\n\n\ndef get_remote_addr(transport):\n    socket_info = transport.get_extra_info(\"socket\")\n    if socket_info is not None:\n        try:\n            info = socket_info.getpeername()\n        except OSError:\n            # This case appears to inconsistently occur with uvloop\n            # bound to a unix domain socket.\n            family = None\n            info = None\n        else:\n            family = socket_info.family\n\n        if family in (socket.AF_INET, socket.AF_INET6):\n            return (str(info[0]), int(info[1]))\n        return None\n    info = transport.get_extra_info(\"peername\")\n    if info is not None and isinstance(info, (list, tuple)) and len(info) == 2:\n        return (str(info[0]), int(info[1]))\n    return None\n\n\ndef get_local_addr(transport):\n    socket_info = transport.get_extra_info(\"socket\")\n    if socket_info is not None:\n        info = socket_info.getsockname()\n        family = socket_info.family\n        if family in (socket.AF_INET, socket.AF_INET6):\n            return (str(info[0]), int(info[1]))\n        return None\n    info = transport.get_extra_info(\"sockname\")\n    if info is not None and isinstance(info, (list, tuple)) and len(info) == 2:\n        return (str(info[0]), int(info[1]))\n    return None\n\n\ndef is_ssl(transport):\n    return bool(transport.get_extra_info(\"sslcontext\"))\n\n\ndef get_client_addr(scope):\n    client = scope.get(\"client\")\n    if not client:\n        return \"\"\n    return \"%s:%d\" % client\n\n\ndef get_path_with_query_string(scope):\n    path_with_query_string = scope.get(\"root_path\", \"\") + scope[\"path\"]\n    if scope[\"query_string\"]:\n        path_with_query_string = \"{}?{}\".format(\n            path_with_query_string, scope[\"query_string\"].decode(\"ascii\")\n        )\n    return path_with_query_string\n", "path": "uvicorn/protocols/utils.py"}], "after_files": [{"content": "import socket\n\nif hasattr(socket, \"AF_UNIX\"):\n    SUPPORTED_SOCKET_FAMILIES = (socket.AF_INET, socket.AF_INET6, socket.AF_UNIX)\nelse:\n    SUPPORTED_SOCKET_FAMILIES = (socket.AF_INET, socket.AF_INET6)\n\n\ndef get_remote_addr(transport):\n    socket_info = transport.get_extra_info(\"socket\")\n    if socket_info is not None:\n        try:\n            info = socket_info.getpeername()\n        except OSError:\n            # This case appears to inconsistently occur with uvloop\n            # bound to a unix domain socket.\n            family = None\n            info = None\n        else:\n            family = socket_info.family\n\n        if family in SUPPORTED_SOCKET_FAMILIES:\n            return (str(info[0]), int(info[1]))\n\n        return None\n    info = transport.get_extra_info(\"peername\")\n    if info is not None and isinstance(info, (list, tuple)) and len(info) == 2:\n        return (str(info[0]), int(info[1]))\n    return None\n\n\ndef get_local_addr(transport):\n    socket_info = transport.get_extra_info(\"socket\")\n    if socket_info is not None:\n        info = socket_info.getsockname()\n        family = socket_info.family\n        if family in SUPPORTED_SOCKET_FAMILIES:\n            return (str(info[0]), int(info[1]))\n        return None\n    info = transport.get_extra_info(\"sockname\")\n    if info is not None and isinstance(info, (list, tuple)) and len(info) == 2:\n        return (str(info[0]), int(info[1]))\n    return None\n\n\ndef is_ssl(transport):\n    return bool(transport.get_extra_info(\"sslcontext\"))\n\n\ndef get_client_addr(scope):\n    client = scope.get(\"client\")\n    if not client:\n        return \"\"\n    return \"%s:%d\" % client\n\n\ndef get_path_with_query_string(scope):\n    path_with_query_string = scope.get(\"root_path\", \"\") + scope[\"path\"]\n    if scope[\"query_string\"]:\n        path_with_query_string = \"{}?{}\".format(\n            path_with_query_string, scope[\"query_string\"].decode(\"ascii\")\n        )\n    return path_with_query_string\n", "path": "uvicorn/protocols/utils.py"}]}