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

Changeset 1718

Show
Ignore:
Timestamp:
09/08/07 13:17:26
Author:
fumanchu
Message:

Checker warning for #711.

Files:

Legend:

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

    r1627 r1718  
    66 
    77class Checker(object): 
     8    """A checker for CherryPy sites and their mounted applications. 
     9     
     10    on: set this to False to turn off the checker completely. 
     11     
     12    When this object is called at engine startup, it executes each 
     13    of its own methods whose names start with "check_". If you wish 
     14    to disable selected checks, simply add a line in your global 
     15    config which sets the appropriate method to False: 
     16     
     17    [global] 
     18    checker.check_skipped_app_config = False 
     19     
     20    You may also dynamically add or replace check_* methods in this way. 
     21    """ 
    822     
    923    on = True 
     
    221235        for sn, app in cherrypy.tree.apps.iteritems(): 
    222236            self._known_types(app.config) 
    223  
    224  
     237     
     238     
     239    # -------------------- Specific config warnings -------------------- # 
     240     
     241    def check_localhost(self): 
     242        """Warn if any socket_host is 'localhost'. See #711.""" 
     243        for k, v in cherrypy.config.iteritems(): 
     244            if k == 'server.socket_host' and v == 'localhost': 
     245                warnings.warn("The use of 'localhost' as a socket host can " 
     246                    "cause problems on newer systems, since 'localhost' can " 
     247                    "map to either an IPv4 or an IPv6 address. You should " 
     248                    "use '127.0.0.1' or '[::1]' instead.") 
  • trunk/cherrypy/test/checkerdemo.py

    r1574 r1718  
    3636            # Warn on mismatched types 
    3737            '/conftype': {'request.show_tracebacks': 14}, 
     38            # Warn on 'localhost' 
     39            'global': {'server.socket_host': 'localhost'}, 
    3840            } 
    3941    cherrypy.quickstart(Root(), config=conf) 

Hosted by WebFaction

Log in as guest/cpguest to create tickets