Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Ticket #786 (defect)

Opened 6 months ago

Last modified 2 months ago

wsgiserver should? protect Content-Length

Status: closed (worksforme)

Reported by: fumanchu Assigned to: fumanchu
Priority: normal Milestone: 3.1
Component: CherryPy code Keywords:
Cc:

See http://mail.python.org/pipermail/web-sig/2008-January/003109.html

For reading, we could make a wsgi.input class which performs its own Content-Length checking and does not allow an application to read past CL. For writes, it might be good if the server did not allow the app to yield more (or less!) bytes than CL.

Change History

03/14/08 10:39:51: Modified by fumanchu

  • status changed from new to closed.
  • resolution set to worksforme.

Looks like this was done in [1786]:

# Set rfile.maxlen to ensure we don't read past Content-Length.
# This will also be used to read the entire request body if errors
# are raised before the app can read the body.
if self.chunked_read:
    # If chunked, Content-Length will be 0.
    self.rfile.maxlen = self.max_request_body_size
else:
    cl = int(self.environ.get("CONTENT_LENGTH", 0))
    self.rfile.maxlen = min(cl, self.max_request_body_size)

05/23/08 02:52:23: Modified by davidf@sjsoft.com

The above code seems to have a bug... by default self.max_request_body_size is 0, but then the remaining message is never read, even if CONTENT_LENGTH is set... see #819 for the details and a fix

Hosted by WebFaction

Log in as guest/cpguest to create tickets