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

Ticket #67: ticket_67.patch

  • cherrypy/_cpconfig.py

    old new  
    3636    cpg.configOption.socketQueueSize = 5 # Size of the socket queue 
    3737    cpg.configOption.protocolVersion = "HTTP/1.0" 
    3838 
    39     # Parameters used to tell what kind of server we want 
    40     # Note that numberOfProcesses, threading and forking conflict 
    41     # wich each other: if one has a non-null value, the other 
    42     # ones should be null (for numberOfProcesses, null means equal to one) 
    43     cpg.configOption.processPool = 0 # Used if we want to fork n processes 
    44                                  # at the beginning. In this case, all 
    45                                  # processes will listen on the same 
    46                                  # socket (this only works on unix) 
    47     cpg.configOption.threading = 0 # Used if we want to create a new 
    48                                # thread for each request 
    49     cpg.configOption.forking = 0 # Used if we want to create a new process 
    50                              # for each request 
    51     cpg.configOption.threadPool = 0 # Used if we want to create a pool 
    52                                 # of threads at the beginning 
     39    # Create a pool of threads 
     40    cpg.configOption.threadPool = 1 
    5341 
    5442    # Variables used to tell if this is an SSL server 
    5543    cpg.configOption.sslKeyFile = "" 
     
    9987            ('server', 'socketPort', 'int'), 
    10088            ('server', 'socketFile', 'str'), 
    10189            ('server', 'reverseDNS', 'int'), 
    102             ('server', 'processPool', 'int'), 
    10390            ('server', 'threadPool', 'int'), 
    104             ('server', 'threading', 'int'), 
    105             ('server', 'forking', 'int'), 
    10691            ('server', 'sslKeyFile', 'str'), 
    10792            ('server', 'sslCertificateFile', 'str'), 
    10893            ('server', 'sslClientCertificateVerification', 'int'), 
     
    142127    _cpLogMessage("  socketFile: %s" % cpg.configOption.socketFile, 'CONFIG') 
    143128    _cpLogMessage("  reverseDNS: %s" % cpg.configOption.reverseDNS, 'CONFIG') 
    144129    _cpLogMessage("  socketQueueSize: %s" % cpg.configOption.socketQueueSize, 'CONFIG') 
    145     _cpLogMessage("  processPool: %s" % cpg.configOption.processPool, 'CONFIG') 
    146130    _cpLogMessage("  threadPool: %s" % cpg.configOption.threadPool, 'CONFIG') 
    147     _cpLogMessage("  threading: %s" % cpg.configOption.threading, 'CONFIG') 
    148     _cpLogMessage("  forking: %s" % cpg.configOption.forking, 'CONFIG') 
    149131    _cpLogMessage("  sslKeyFile: %s" % cpg.configOption.sslKeyFile, 'CONFIG') 
    150132    if cpg.configOption.sslKeyFile: 
    151133        _cpLogMessage("  sslCertificateFile: %s" % cpg.configOption.sslCertificateFile, 'CONFIG') 
     
    167149        raise "CherryError: protocolVersion must be 'HTTP/1.1' or 'HTTP/1.0'" 
    168150    if _reverseDNS not in (0,1): raise "CherryError: reverseDNS must be '0' or '1'" 
    169151    if _socketFile and not hasattr(socket, 'AF_UNIX'): raise "CherryError: Configuration file has socketFile, but this is only available on Unix machines" 
    170     if _processPool!=1 and not hasattr(os, 'fork'): raise "CherryError: Configuration file has processPool, but forking is not available on this operating system" 
    171     if _forking and not hasattr(os, 'fork'): raise "CherryError: Configuration file has forking, but forking is not available on this operating system" 
    172152    if _sslKeyFile: 
    173153        try: 
    174154            global SSL 
     
    176156        except: raise "CherryError: PyOpenSSL 0.5.1 or later must be installed to use SSL. You can get it from http://pyopenssl.sourceforge.net" 
    177157    if _socketPort and _socketFile: raise "CherryError: In configuration file: socketPort and socketFile conflict with each other" 
    178158    if not _socketFile and not _socketPort: _socketPort=8000 # Default port 
    179     if _processPool==1: severalProcs=0 
    180     else: severalProcs=1 
    181159    if _threadPool==1: severalThreads=0 
    182160    else: severalThreads=1 
    183     if severalThreads+severalProcs+_threading+_forking>1: raise "CherryError: In configuration file: threadPool, processPool, threading and forking conflict with each other" 
    184161    if _sslKeyFile and not _sslCertificateFile: raise "CherryError: Configuration file has sslKeyFile but no sslCertificateFile" 
    185162    if _sslCertificateFile and not _sslKeyFile: raise "CherryError: Configuration file has sslCertificateFile but no sslKeyFile" 
    186163    try: sys.stdout.flush() 
     
    189166    if _sessionStorageType not in ('', 'custom', 'ram', 'file', 'cookie'): raise "CherryError: Configuration file an invalid sessionStorageType: '%s'"%_sessionStorageType 
    190167    if _sessionStorageType in ('custom', 'ram', 'cookie') and _sessionStorageFileDir!='': raise "CherryError: Configuration file has sessionStorageType set to 'custom, 'ram' or 'cookie' but a sessionStorageFileDir is specified" 
    191168    if _sessionStorageType=='file' and _sessionStorageFileDir=='': raise "CherryError: Configuration file has sessionStorageType set to 'file' but no sessionStorageFileDir" 
    192     if _sessionStorageType=='ram' and (_forking or severalProcs): 
    193         print "CherryWarning: 'ram' sessions might be buggy when using several processes" 
    194169 

Hosted by WebFaction

Log in as guest/cpguest to create tickets