Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix ASGIMiddleware Receive#59

Merged
abersheeran merged 3 commits into
masterfrom
fix-asgi
Jun 26, 2024
Merged

Fix ASGIMiddleware Receive#59
abersheeran merged 3 commits into
masterfrom
fix-asgi

Conversation

@abersheeran

@abersheeran abersheeran commented Jun 26, 2024

Copy link
Copy Markdown
Owner

fixes #58 #45

In Starlette, there are many codes that use receive to determine whether the connection is disconnected and continue to send. The current ASGIMiddleware is designed to save resources and handles two requests in the same thread, which will cause send to be blocked by receive.

https://github.com/encode/starlette/blob/5a1bec33f8d6a669a3670f51034de83292d19408/starlette/responses.py#L257-L265

@abersheeran abersheeran linked an issue Jun 26, 2024 that may be closed by this pull request
@abersheeran abersheeran changed the title Refactoring ASGIMiddleware design Fix ASGIMiddleware Receive Jun 26, 2024
@abersheeran abersheeran marked this pull request as ready for review June 26, 2024 09:35
@abersheeran abersheeran merged commit dd66cda into master Jun 26, 2024
@abersheeran abersheeran deleted the fix-asgi branch June 26, 2024 09:39
@lmignon

lmignon commented Jun 26, 2024

Copy link
Copy Markdown

Thank you @abersheeran for the fix and improvement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Starlette StreamingResponse does not work anymore a2wsgi can't work with BaseHTTPMiddleware in Starlette

2 participants