Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/hypercorn/protocol/http_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,13 @@ async def app_send(self, message: ASGISendEvent | None) -> None:
raise UnexpectedMessageError(self.state, message["type"])

async def _send_closed(self) -> None:
await self.send(EndBody(stream_id=self.stream_id))
self.state = ASGIHTTPState.CLOSED
await self.send(EndBody(stream_id=self.stream_id))
await self.config.log.access(self.scope, self.response, time() - self.start_time)
await self.send(StreamClosed(stream_id=self.stream_id))

async def _send_error_response(self, status_code: int) -> None:
self.state = ASGIHTTPState.CLOSED
await self.send(
Response(
stream_id=self.stream_id,
Expand All @@ -255,7 +256,6 @@ async def _send_error_response(self, status_code: int) -> None:
)
)
await self.send(EndBody(stream_id=self.stream_id))
self.state = ASGIHTTPState.CLOSED
await self.config.log.access(
self.scope, {"status": status_code, "headers": []}, time() - self.start_time
)