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

Limit size of request header and body #90

Closed
ghost opened this issue Jan 20, 2005 · 11 comments
Closed

Limit size of request header and body #90

ghost opened this issue Jan 20, 2005 · 11 comments

Comments

@ghost
Copy link

ghost commented Jan 20, 2005

Originally reported by: Anonymous


Reported by rdelon


@ghost
Copy link
Author

ghost commented Aug 23, 2005

Original comment by Anonymous:


Could someone explain this one?

@ghost
Copy link
Author

ghost commented Aug 23, 2005

Original comment by Anonymous:


This is to protect us against attacks ...
Someone could send a huge request header or body and block a thread for a long time ...
So if the request header or body is over a certain limit we should just stop reading the request and abort. These parameters should be configurable.

@ghost
Copy link
Author

ghost commented Aug 23, 2005

Original comment by Anonymous:


True.

And in this case, we should send HTTP code 413 :
http://rfc.net/rfc2616.html#s10.4.14

@ghost
Copy link
Author

ghost commented Aug 23, 2005

Original comment by Anonymous:


See also :

http://rfc.net/rfc2616.html#s10.4.14

@ghost
Copy link
Author

ghost commented Aug 23, 2005

Original comment by Anonymous:


oops i meant:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.20

@ghost
Copy link
Author

ghost commented Aug 28, 2005

Original comment by Anonymous:


To be useful we need to test the length of the header entity and the body entity early in the process.

It either means we need to let the server handlers (WSGI, built-in HTTP, or else) do the job, or we need to do that in processRequestHeaders() and processRequestBody().

The former one seems to get the headers through self.requestHeaders which is a generator, thus we can't compute its length. We can wait for the request.headerMap to be filled up. But then it seems to be lae in the process IMO.

The latter is either to be done once FieldStorage has been called or before, but again it sounds late to be really useful.

So, I feel like we should leave that to the server handlers instead as a good practice.

@ghost
Copy link
Author

ghost commented Sep 2, 2005

Original comment by Anonymous:


server.maxRequestSize can now be used to set the maximum size a post body.

@ghost
Copy link
Author

ghost commented Sep 2, 2005

Original comment by Robert Brewer (Bitbucket: fumanchu, GitHub: fumanchu):


Changeset [585] partially addresses this.

Do we really need per-path config on this, though? It seems to me that server.maxRequestSize could be inspected once (on server.start()) to set cgi.maxlen. I certainly don't think we need a threadlocal object involved; in fact, I have my doubts it's working as expected. It would be good to see a ''decisive'' test in test_core.

#!python
>>> cgi.maxlen
<cherrypy._cpcgifs.LocalInt instance at 0x01062710>
>>> cgi.maxlen == 5
False

@ghost
Copy link
Author

ghost commented Sep 6, 2005

Original comment by Anonymous:


I'm perfectly happy making this a global setting.

@ghost
Copy link
Author

ghost commented Sep 11, 2005

Original comment by Anonymous:


Implementation done in [626]. Still need to write docs for new config options

@ghost
Copy link
Author

ghost commented Sep 12, 2005

Original comment by Anonymous:


Done in changeset 626 and 628

@ghost ghost closed this as completed Apr 30, 2016
jaraco pushed a commit that referenced this issue Apr 30, 2016
Fix several typos and grammar mistakes in the docs.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants