diff --git a/uvicorn/__init__.py b/uvicorn/__init__.py
index bfd395e..385fbc3 100644
--- a/uvicorn/__init__.py
+++ b/uvicorn/__init__.py
@@ -1,4 +1,4 @@
 from uvicorn.main import main, run
 
-__version__ = "0.2.5"
+__version__ = "0.2.6"
 __all__ = ["main", "run"]
diff --git a/uvicorn/protocols/http/h11.py b/uvicorn/protocols/http/h11.py
index 6848630..073cddd 100644
--- a/uvicorn/protocols/http/h11.py
+++ b/uvicorn/protocols/http/h11.py
@@ -72,11 +72,15 @@ class H11Protocol(asyncio.Protocol):
         if self.access_logs:
             self.logger.debug("%s - Disconnected", self.server[0])
 
-        if self.cycle and self.cycle.more_body:
+        if self.cycle and not self.cycle.response_complete:
             self.cycle.disconnected = True
         if self.conn.our_state != h11.ERROR:
             event = h11.ConnectionClosed()
-            self.conn.send(event)
+            try:
+                self.conn.send(event)
+            except h11.LocalProtocolError:
+                # Premature client disconnect
+                pass
         self.client_event.set()
 
     def eof_received(self):
@@ -215,6 +219,9 @@ class RequestResponseCycle:
         protocol = self.protocol
         message_type = message["type"]
 
+        if self.disconnected:
+            return
+
         if not protocol.writable:
             await protocol.writable_event.wait()
 
diff --git a/uvicorn/protocols/http/httptools.py b/uvicorn/protocols/http/httptools.py
index 7344b01..ebbbb39 100644
--- a/uvicorn/protocols/http/httptools.py
+++ b/uvicorn/protocols/http/httptools.py
@@ -83,7 +83,7 @@ class HttpToolsProtocol(asyncio.Protocol):
         if self.access_logs:
             self.logger.debug("%s - Disconnected", self.server[0])
 
-        if self.cycle and self.cycle.more_body:
+        if self.cycle and not self.cycle.response_complete:
             self.cycle.disconnected = True
         self.client_event.set()
 
@@ -238,6 +238,9 @@ class RequestResponseCycle:
         protocol = self.protocol
         message_type = message["type"]
 
+        if self.disconnected:
+            return
+
         if not protocol.writable:
             await protocol.writable_event.wait()
 

RuntimeError in uvicorn for some requests
`uvicorn==0.2.5` is throwing errors for some requests.

```
ERROR: Exception in ASGI application
Traceback (most recent call last):
  File "/home/chillar/.virtualenvs/library/lib/python3.6/site-packages/uvicorn/protocols/http/httptools.py", line 196, in run_asgi
    result = await asgi(self.receive, self.send)
  File "/home/chillar/.virtualenvs/library/lib/python3.6/site-packages/channels/http.py", line 190, in __call__
    await self.handle(body)
  File "/home/chillar/.virtualenvs/library/lib/python3.6/site-packages/asgiref/sync.py", line 110, in __call__
    return await asyncio.wait_for(future, timeout=None)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 339, in wait_for
    return (yield from fut)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/chillar/.virtualenvs/library/lib/python3.6/site-packages/asgiref/sync.py", line 125, in thread_handler
    return self.func(*args, **kwargs)
  File "/home/chillar/.virtualenvs/library/lib/python3.6/site-packages/channels/http.py", line 229, in handle
    self.send(response_message)
  File "/home/chillar/.virtualenvs/library/lib/python3.6/site-packages/asgiref/sync.py", line 64, in __call__
    return call_result.result()
  File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/chillar/.virtualenvs/library/lib/python3.6/site-packages/asgiref/sync.py", line 78, in main_wrap
    result = await self.awaitable(*args, **kwargs)
  File "/home/chillar/.virtualenvs/library/lib/python3.6/site-packages/uvicorn/protocols/http/httptools.py", line 308, in send
    protocol.transport.write(body)
  File "uvloop/handles/stream.pyx", line 636, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 165, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x1a48ad8>; the handler is closed
```

diff --git a/tests/protocols/test_http.py b/tests/protocols/test_http.py
index 88658dd..3b08fee 100644
--- a/tests/protocols/test_http.py
+++ b/tests/protocols/test_http.py
@@ -340,6 +340,17 @@ def test_value_returned(protocol_cls):
     assert protocol.transport.is_closing()
 
 
+@pytest.mark.parametrize("protocol_cls", [HttpToolsProtocol, H11Protocol])
+def test_early_disconnect(protocol_cls):
+    def app(scope):
+        return Response(b"xxx", headers={"content-length": 10})
+
+    protocol = get_connected_protocol(app, protocol_cls)
+    protocol.data_received(SIMPLE_GET_REQUEST)
+    protocol.connection_lost(None)
+    protocol.loop.run_one()
+
+
 @pytest.mark.parametrize("protocol_cls", [HttpToolsProtocol, H11Protocol])
 def test_http10_request(protocol_cls):
     def app(scope):

pip install -e .
parse_log_pytest
requirements.txt
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
coverage==7.8.0
exceptiongroup==1.2.2
h11==0.14.0
httptools==0.6.4
idna==3.10
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-cov==6.0.0
requests==2.32.3
tomli==2.2.1
urllib3==2.3.0
-e git+https://github.com/encode/uvicorn.git@df2e97eaf6560dc4f7f3d321ab1f085553125ba0#egg=uvicorn
uvloop==0.21.0
websockets==15.0.1

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:
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - click==8.1.8
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - h11==0.14.0
      - httptools==0.6.4
      - idna==3.10
      - iniconfig==2.1.0
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - requests==2.32.3
      - tomli==2.2.1
      - urllib3==2.3.0
      - uvloop==0.21.0
      - websockets==15.0.1
prefix: /opt/conda/envs/uvicorn

tests/protocols/test_http.py::test_early_disconnect[H11Protocol]
tests/protocols/test_http.py::test_get_request[HttpToolsProtocol] tests/protocols/test_http.py::test_get_request[H11Protocol] tests/protocols/test_http.py::test_post_request[HttpToolsProtocol] tests/protocols/test_http.py::test_post_request[H11Protocol] tests/protocols/test_http.py::test_keepalive[HttpToolsProtocol] tests/protocols/test_http.py::test_keepalive[H11Protocol] tests/protocols/test_http.py::test_close[HttpToolsProtocol] tests/protocols/test_http.py::test_close[H11Protocol] tests/protocols/test_http.py::test_undersized_request[HttpToolsProtocol] tests/protocols/test_http.py::test_undersized_request[H11Protocol] tests/protocols/test_http.py::test_oversized_request[HttpToolsProtocol] tests/protocols/test_http.py::test_oversized_request[H11Protocol] tests/protocols/test_http.py::test_app_exception[HttpToolsProtocol] tests/protocols/test_http.py::test_app_exception[H11Protocol] tests/protocols/test_http.py::test_app_init_exception[HttpToolsProtocol] tests/protocols/test_http.py::test_app_init_exception[H11Protocol] tests/protocols/test_http.py::test_exception_during_response[HttpToolsProtocol] tests/protocols/test_http.py::test_exception_during_response[H11Protocol] tests/protocols/test_http.py::test_no_response_returned[HttpToolsProtocol] tests/protocols/test_http.py::test_no_response_returned[H11Protocol] tests/protocols/test_http.py::test_partial_response_returned[HttpToolsProtocol] tests/protocols/test_http.py::test_partial_response_returned[H11Protocol] tests/protocols/test_http.py::test_duplicate_start_message[HttpToolsProtocol] tests/protocols/test_http.py::test_duplicate_start_message[H11Protocol] tests/protocols/test_http.py::test_missing_start_message[HttpToolsProtocol] tests/protocols/test_http.py::test_missing_start_message[H11Protocol] tests/protocols/test_http.py::test_message_after_body_complete[HttpToolsProtocol] tests/protocols/test_http.py::test_message_after_body_complete[H11Protocol] tests/protocols/test_http.py::test_value_returned[HttpToolsProtocol] tests/protocols/test_http.py::test_value_returned[H11Protocol] tests/protocols/test_http.py::test_early_disconnect[HttpToolsProtocol] tests/protocols/test_http.py::test_http10_request[HttpToolsProtocol] tests/protocols/test_http.py::test_http10_request[H11Protocol]
uvicorn/protocols/http/httptools.py uvicorn/__init__.py uvicorn/protocols/http/h11.py
uvicorn/protocols/http/httptools.py uvicorn/__init__.py uvicorn/protocols/http/h11.py