diff --git a/uvicorn/protocols/http/h11_impl.py b/uvicorn/protocols/http/h11_impl.py
index 5d2bad4..90850da 100644
--- a/uvicorn/protocols/http/h11_impl.py
+++ b/uvicorn/protocols/http/h11_impl.py
@@ -25,6 +25,8 @@ STATUS_PHRASES = {
     status_code: _get_status_phrase(status_code) for status_code in range(100, 600)
 }
 
+CLOSE_HEADER = (b"connection", b"close")
+
 HIGH_WATER_LIMIT = 65536
 
 TRACE_LOG_LEVEL = 5
@@ -452,6 +454,9 @@ class RequestResponseCycle:
             status_code = message["status"]
             headers = self.default_headers + message.get("headers", [])
 
+            if CLOSE_HEADER in self.scope["headers"] and CLOSE_HEADER not in headers:
+                headers = headers + [CLOSE_HEADER]
+
             if self.access_log:
                 self.access_logger.info(
                     '%s - "%s %s HTTP/%s" %d',
diff --git a/uvicorn/protocols/http/httptools_impl.py b/uvicorn/protocols/http/httptools_impl.py
index 7be0865..6dcb6e0 100644
--- a/uvicorn/protocols/http/httptools_impl.py
+++ b/uvicorn/protocols/http/httptools_impl.py
@@ -30,6 +30,8 @@ STATUS_LINE = {
     status_code: _get_status_line(status_code) for status_code in range(100, 600)
 }
 
+CLOSE_HEADER = (b"connection", b"close")
+
 HIGH_WATER_LIMIT = 65536
 
 TRACE_LOG_LEVEL = 5
@@ -454,6 +456,9 @@ class RequestResponseCycle:
             status_code = message["status"]
             headers = self.default_headers + list(message.get("headers", []))
 
+            if CLOSE_HEADER in self.scope["headers"] and CLOSE_HEADER not in headers:
+                headers = headers + [CLOSE_HEADER]
+
             if self.access_log:
                 self.access_logger.info(
                     '%s - "%s %s HTTP/%s" %d',

connection: close header not returned in response
Hello, the [W3 standard](https://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html) seems to say that a server which receives a request with a `connection: close` header should also return this header to the client. Specifically I'm talking about the first line in `8.1.2.1 Negotiation` quoted here:
> An HTTP/1.1 server MAY assume that a HTTP/1.1 client intends to maintain a persistent connection unless a Connection header including the connection-token "close" was sent in the request. If the server chooses to close the connection immediately after sending the response, it SHOULD send a Connection header including the connection-token close.

The wording is maybe a little ambiguous but to me it definitely seems to imply that if the server closes the connection (wether due to a `connection: close` header in the request or by it's own choice) it should return a `connection: close` header. I ran into an issue with the asks library were this was causing an issue: https://github.com/theelous3/asks/issues/115.
diff --git a/tests/test_main.py b/tests/test_main.py
index 5a5f3fd..a4c5349 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -11,6 +11,21 @@ async def app(scope, receive, send):
     await send({"type": "http.response.body", "body": b"", "more_body": False})
 
 
+@pytest.mark.asyncio
+async def test_return_close_header():
+    config = Config(app=app, host="localhost", loop="asyncio", limit_max_requests=1)
+    async with run_server(config):
+        async with httpx.AsyncClient() as client:
+            response = await client.get(
+                "http://127.0.0.1:8000", headers={"connection": "close"}
+            )
+
+    assert response.status_code == 204
+    assert (
+        "connection" in response.headers and response.headers["connection"] == "close"
+    )
+
+
 @pytest.mark.asyncio
 @pytest.mark.parametrize(
     "host, url",

pip install -e .[standard]
parse_log_pytest
requirements.txt
pytest pytest-mock pytest-asyncio
apt-get update apt-get install -y gcc
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
autoflake==2.3.1
babel==2.17.0
backports.tarfile==1.2.0
backrefs==5.8
black==25.1.0
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
click==7.1.2
colorama==0.4.6
coverage==7.8.0
cryptography==44.0.2
docutils==0.21.2
exceptiongroup==1.2.2
flake8==7.2.0
ghp-import==2.1.0
h11==0.14.0
httpcore==0.12.3
httptools==0.1.2
httpx==0.16.1
id==1.5.0
idna==3.10
importlib_metadata==8.6.1
iniconfig==2.1.0
isort==6.0.1
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
Jinja2==3.1.6
keyring==25.6.0
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mccabe==0.7.0
mdurl==0.1.2
mergedeep==1.3.4
mkdocs==1.6.1
mkdocs-get-deps==0.2.0
mkdocs-material==9.6.10
mkdocs-material-extensions==1.3.1
more-itertools==10.6.0
mypy==1.15.0
mypy-extensions==1.0.0
nh3==0.2.21
packaging==24.2
paginate==0.5.7
pathspec==0.12.1
platformdirs==4.3.7
pluggy==1.5.0
pycodestyle==2.13.0
pycparser==2.22
pyflakes==3.3.2
Pygments==2.19.1
pymdown-extensions==10.14.3
pytest==8.3.5
pytest-asyncio==0.14.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
PyYAML==6.0.2
pyyaml_env_tag==0.1
readme_renderer==44.0
requests==2.32.3
requests-toolbelt==1.0.0
rfc3986==1.5.0
rich==14.0.0
SecretStorage==3.3.3
six==1.17.0
sniffio==1.3.1
tomli==2.2.1
trustme==1.2.1
twine==6.1.0
typing_extensions==4.13.0
urllib3==2.3.0
-e git+https://github.com/encode/uvicorn.git@320fd6d975d47257aecde808d602c9a57fb74cba#egg=uvicorn
uvloop==0.21.0
watchdog==6.0.0
watchgod==0.6
websockets==8.1
wsproto==0.15.0
zipp==3.21.0

name: uvicorn
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - autoflake==2.3.1
      - babel==2.17.0
      - backports-tarfile==1.2.0
      - backrefs==5.8
      - black==25.1.0
      - certifi==2025.1.31
      - cffi==1.17.1
      - charset-normalizer==3.4.1
      - click==7.1.2
      - colorama==0.4.6
      - coverage==7.8.0
      - cryptography==44.0.2
      - docutils==0.21.2
      - exceptiongroup==1.2.2
      - flake8==7.2.0
      - ghp-import==2.1.0
      - h11==0.14.0
      - httpcore==0.12.3
      - httptools==0.1.2
      - httpx==0.16.1
      - id==1.5.0
      - idna==3.10
      - importlib-metadata==8.6.1
      - iniconfig==2.1.0
      - isort==6.0.1
      - jaraco-classes==3.4.0
      - jaraco-context==6.0.1
      - jaraco-functools==4.1.0
      - jeepney==0.9.0
      - jinja2==3.1.6
      - keyring==25.6.0
      - markdown==3.7
      - markdown-it-py==3.0.0
      - markupsafe==3.0.2
      - mccabe==0.7.0
      - mdurl==0.1.2
      - mergedeep==1.3.4
      - mkdocs==1.6.1
      - mkdocs-get-deps==0.2.0
      - mkdocs-material==9.6.10
      - mkdocs-material-extensions==1.3.1
      - more-itertools==10.6.0
      - mypy==1.15.0
      - mypy-extensions==1.0.0
      - nh3==0.2.21
      - packaging==24.2
      - paginate==0.5.7
      - pathspec==0.12.1
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - pycodestyle==2.13.0
      - pycparser==2.22
      - pyflakes==3.3.2
      - pygments==2.19.1
      - pymdown-extensions==10.14.3
      - pytest==8.3.5
      - pytest-asyncio==0.14.0
      - pytest-mock==3.14.0
      - python-dateutil==2.9.0.post0
      - python-dotenv==1.1.0
      - pyyaml==6.0.2
      - pyyaml-env-tag==0.1
      - readme-renderer==44.0
      - requests==2.32.3
      - requests-toolbelt==1.0.0
      - rfc3986==1.5.0
      - rich==14.0.0
      - secretstorage==3.3.3
      - six==1.17.0
      - sniffio==1.3.1
      - tomli==2.2.1
      - trustme==1.2.1
      - twine==6.1.0
      - typing-extensions==4.13.0
      - urllib3==2.3.0
      - uvloop==0.21.0
      - watchdog==6.0.0
      - watchgod==0.6
      - websockets==8.1
      - wsproto==0.15.0
      - zipp==3.21.0
prefix: /opt/conda/envs/uvicorn

tests/test_main.py::test_return_close_header
tests/test_main.py::test_run[default] tests/test_main.py::test_run[hostname] tests/test_main.py::test_run[ipv6] tests/test_main.py::test_run_multiprocess tests/test_main.py::test_run_reload
uvicorn/protocols/http/httptools_impl.py uvicorn/protocols/http/h11_impl.py
uvicorn/protocols/http/httptools_impl.py uvicorn/protocols/http/h11_impl.py