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

Shall we trust content length for RequestBodyLimitAction? #158

Open
jcchavezs opened this issue Feb 22, 2023 · 3 comments
Open

Shall we trust content length for RequestBodyLimitAction? #158

jcchavezs opened this issue Feb 22, 2023 · 3 comments

Comments

@jcchavezs
Copy link
Member

Currently we record the body per chunks as it is coming and when reach the limit we decide to trigger the RequestBodyLimitAction. As buffering is expensive, in specific cases like Envoy it is worth to investigate if we should trust content-length header for rushing this decision even before the buffering.

@anuraaga
Copy link
Contributor

Sending a content length but not sending a payload of the same size is invalid http. So I think it's fine to read it for eager limit checking given even if it wasn't accurate the request would be rejected.

@M4tteoP
Copy link
Member

M4tteoP commented Feb 27, 2023

we should trust content-length header for rushing this decision even before the buffering

I see value in doing this if the LimitAction is deny, but it requires an extra API method that accepts the content length, checks the LimitAction, and directly rises an interruption if it is above the limit, doesn't it?

@anuraaga
Copy link
Contributor

anuraaga commented Feb 27, 2023

Phase 1 should have content length from headers so don't think it needs an extra API. Meaning this should be for eagerly checking in phase 1 what would otherwise happen within phase 2.

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

No branches or pull requests

3 participants