8000 fix h11 LocalProtocolError on connection close by client · localstack/localstack@6393a0a · GitHub
[go: up one dir, main page]

Skip to content < 8000 script type="application/json" data-target="react-partial.embeddedData">{"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}

Commit 6393a0a

Browse files
committed
fix h11 LocalProtocolError on connection close by client
1 parent 455077e commit 6393a0a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

localstack/http/asgi.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ async def write(self, data: bytes) -> None:
296296
if not self.started:
297297
raise ValueError("not started the response yet")
298298
if getattr(self.send.__self__, "closed", None):
299+
# the connection has been closed from the client side, set finalized=True to avoid sending more responses
300+
self.finalized = True
299301
raise BrokenPipeError("Connection closed")
300302
await self.send({"type": "http.response.body", "body": data, "more_body": True})
301303
self.sent += len(data)

0 commit comments

Comments
 (0)
0