Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer authored Sep 20, 2024
2 parents 320e508 + 8911419 commit f706927
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES/9052.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed exception information getting lost on ``HttpProcessingError`` -- by :user:`Dreamsorcerer`.
10 changes: 9 additions & 1 deletion aiohttp/client_proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,15 @@ def data_received(self, data: bytes) -> None:
# closed in this case
self.transport.close()
# should_close is True after the call
self.set_exception(HttpProcessingError(), underlying_exc)
if isinstance(underlying_exc, HttpProcessingError):
exc = HttpProcessingError(
code=underlying_exc.code,
message=underlying_exc.message,
headers=underlying_exc.headers,
)
else:
exc = HttpProcessingError()
self.set_exception(exc, underlying_exc)
return

self._upgraded = upgraded
Expand Down
4 changes: 0 additions & 4 deletions tests/test_client_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -4023,10 +4023,6 @@ async def handler(_: web.Request) -> web.Response:
await session.get("/")


@pytest.mark.xfail(
reason="#8395 Error message regression for large headers in 3.9.4",
raises=AssertionError,
)
async def test_header_too_large_error(aiohttp_client: AiohttpClient) -> None:
"""By default when not specifying `max_field_size` requests should fail with a 400 status code."""

Expand Down

0 comments on commit f706927

Please sign in to comment.