Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use content-length header in ASGI instead of reading request body #1649

Merged
merged 15 commits into from Oct 3, 2022

Conversation

antonpirker
Copy link
Member

@antonpirker antonpirker commented Sep 29, 2022

We did read the whole request body to figuring out the size of the content. This is not optimal at all. Now we read the "content-length" request header and if this header is not there, we just do not touch the request body (because in ASGI the request body is a stream and if it is consumed it can not be accessed again.)

Fixes #1646
Fixes #1631
Fixes #1595
Fixes #1573

@antonpirker antonpirker force-pushed the antonpirker/1646-asgi-request-body branch from 463599f to 70723b9 Compare September 29, 2022 09:57
@antonpirker antonpirker marked this pull request as ready for review October 3, 2022 13:26
@sl0thentr0py
Copy link
Member

sl0thentr0py commented Oct 3, 2022

can you make the PR title more specific? something like

Use content-length header in ASGI instead of reading request body

This is what goes into the changelog and right now our changelogs are not very informative.

tests/integrations/bottle/test_bottle.py Show resolved Hide resolved
sentry_sdk/integrations/starlette.py Outdated Show resolved Hide resolved
@antonpirker antonpirker changed the title Enhance handling of ASGI request body Use content-length header in ASGI instead of reading request body Oct 3, 2022
Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@antonpirker antonpirker merged commit e5b80d6 into master Oct 3, 2022
@antonpirker antonpirker deleted the antonpirker/1646-asgi-request-body branch October 3, 2022 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants