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

Changeset 1223

Show
Ignore:
Timestamp:
08/06/06 17:17:03
Author:
fumanchu
Message:

Split process_request_body into two flags instead (new request.body_read flag to signal that the request body has already been read).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cprequest.py

    r1222 r1223  
    7676    process_request_body = True 
    7777    body = None 
     78    body_read = False 
    7879     
    7980    # Dispatch attributes 
     
    200201                self.hooks.run('on_start_resource') 
    201202                 
    202                 if self.process_request_body
     203                if self.process_request_body and not self.body_read
    203204                    # Check path-specific methods_with_bodies. 
    204205                    meths = self.config.get("methods_with_bodies", ("POST", "PUT")) 
     
    214215                if self.process_request_body: 
    215216                    self.process_body() 
    216                     # Guard against re-reading body on InternalRedirect 
    217                     self.process_request_body = False 
    218217                 
    219218                self.hooks.run('before_main') 
     
    362361    def process_body(self): 
    363362        """Convert request.rfile into request.params (or request.body).""" 
     363        # Guard against re-reading body (e.g. on InternalRedirect) 
     364        if self.body_read: 
     365            return 
     366        self.body_read = True 
     367         
    364368        # FieldStorage only recognizes POST, so fake it. 
    365369        methenv = {'REQUEST_METHOD': "POST"} 

Hosted by WebFaction

Log in as guest/cpguest to create tickets