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

In some cases, I need to get the raw request header #1963

Closed
L018 opened this issue Nov 4, 2020 · 3 comments · Fixed by #2032
Closed

In some cases, I need to get the raw request header #1963

L018 opened this issue Nov 4, 2020 · 3 comments · Fixed by #2032
Milestone

Comments

@L018
Copy link

L018 commented Nov 4, 2020

Hi,

I find that all request's headers had do a casefold transform. I know that's right. But I think we should keep save raw headers instead of drop it. I haven't find any property or function to get it yet. In web security, I need to find something from the raw request that is not the same as the real human request.

I know we can add a raw_headers property to solve it. But i think you have a better idea.

@ahopkins
Copy link
Member

ahopkins commented Nov 5, 2020

This is something I was toying with the idea of adding into the streaming branch that will be merged in early 2021. Currently it reads to a buffer and then drains. The thought was to add a raw HTTP request object to store a cache of the bytes received on the request object. There might be some memory concerns here, so I do not think it should be enabled by default. But there are some uses for this.

This would be the entire object. As for just the raw headers? That is also worth consideration. But, again this would likely be an opt-in feature.

@L018
Copy link
Author

L018 commented Nov 10, 2020

Yes, it is shouldn't be enabled by default. But I think request.body maybe a bit repetitive if we use a raw HTTP request object.

@ahopkins ahopkins added this to the v21.3 milestone Nov 10, 2020
@ashleysommer
Copy link
Member

ashleysommer commented Jan 19, 2021

I think we could at least cache a raw version of the HTTP header. It should be small enough to always fit into memory.

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

Successfully merging a pull request may close this issue.

3 participants