From 934db75a0e4c54ac600e11cbb5ee44314d183129 Mon Sep 17 00:00:00 2001 From: Zhymabek Roman <61125068+ZhymabekRoman@users.noreply.github.com> Date: Sat, 15 Apr 2023 07:35:53 +0600 Subject: [PATCH] Log exception traceback in case of invalid HTTP request when using h11 Author: florimondmanca (https://github.com/florimondmanca) Source: https://github.com/encode/uvicorn/pull/889 --- uvicorn/protocols/http/h11_impl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uvicorn/protocols/http/h11_impl.py b/uvicorn/protocols/http/h11_impl.py index d0b202e3a..044b503dd 100644 --- a/uvicorn/protocols/http/h11_impl.py +++ b/uvicorn/protocols/http/h11_impl.py @@ -205,9 +205,9 @@ def handle_events(self) -> None: while True: try: event = self.conn.next_event() - except h11.RemoteProtocolError: + except h11.RemoteProtocolError as exc: msg = "Invalid HTTP request received." - self.logger.warning(msg) + self.logger.warning(msg, exc_info=exc) self.send_400_response(msg) return event_type = type(event)