prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <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?
  
  
  </issue>
  <code>
  [start of uvicorn/protocols/utils.py]
  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 of uvicorn/protocols/utils.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: 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")
  
verification_info: {"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"}]}