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

Changeset 616

Show
Ignore:
Timestamp:
09/08/05 11:16:52
Author:
mikerobi
Message:

fixed ticket:285, made cgi.maxlen global, as recommended in ticket:90

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CHANGELOG.txt

    r532 r616  
     12005-09-04: 
     2    * Generalized mechanism for handling HTTP errors 
     3    * raising a HTTPStatusError will automatically send an appropriate error page 
     4    * All errors in production mode will cause CP to respond with a http error 
     5 
    162005-08-17: 
    27    * The session filter has been simplified, the mechanism for creating multiple sessions has been removed. However .. (mikerobi) 
  • trunk/cherrypy/_cpcgifs.py

    r608 r616  
    11import cgi 
    22import cherrypy 
    3  
    4 try: 
    5     from threading import local 
    6 except ImportError: 
    7     from cherrypy._cpthreadinglocal import local 
    83 
    94class LocalInt: 
     
    2419        return str(self.__local.value) 
    2520 
    26 cgi.maxlen = LocalInt(0) 
    27  
    2821class FieldStorage(cgi.FieldStorage): 
    2922    def __init__(self, *args, **kwds): 
    30         maxlen = cherrypy.config.get('server.maxRequestSize') 
    31         cgi.maxlen.setValue(maxlen) 
    3223        try: 
    3324            cgi.FieldStorage.__init__(self, *args, **kwds) 
    34         except ValueError: 
    35             raise cherrypy.HTTPStatusError(status=413) 
     25        except ValueError, ex: 
     26            if str(ex) == 'Maximum content length exceeded': 
     27                raise cherrypy.HTTPStatusError(status=413) 
     28            else: 
     29                raise ex 
    3630 
    3731    def read_lines_to_eof(self): 
  • trunk/cherrypy/_cphttptools.py

    r608 r616  
    461461            if not extrabody: 
    462462                extrabody = '' 
    463             status, _body = httperrors.getErrorPage(500, extrabody) 
     463            status, _body = cherrypy.lib.httperrors.getErrorPage(500, extrabody) 
    464464            headers = [('Content-Length', str(len(_body))), ('Content-Type', 'text/html')] 
    465465            return (status, headers, _body) 
  • trunk/cherrypy/server.py

    r583 r616  
    9393        and cherrypy.config.get('session.storageType') == 'file'): 
    9494        cherrypy._sessionFileLock = threading.RLock() 
     95     
     96    # set cgi.maxlen which will limit the size of POST request bodies 
     97    import cgi 
     98    cgi.maxlen = cherrypy.config.get('server.maxRequestSize') 
    9599     
    96100    # Call the functions from cherrypy.server.onStartServerList 

Hosted by WebFaction

Log in as guest/cpguest to create tickets