Commit f614eced authored by sroberts's avatar sroberts

Updated z2.py so that a ZServer can be told to listen for FastCGI requests.

parent cb85a655
...@@ -122,6 +122,8 @@ except: ...@@ -122,6 +122,8 @@ except:
from medusa import resolver, logger, asyncore from medusa import resolver, logger, asyncore
from HTTPServer import zhttp_server, zhttp_handler from HTTPServer import zhttp_server, zhttp_handler
from PCGIServer import PCGIServer from PCGIServer import PCGIServer
from FCGIServer import FCGIServer
from FTPServer import FTPServer from FTPServer import FTPServer
from PubCore import setNumberOfThreads from PubCore import setNumberOfThreads
from medusa.monitor import secure_monitor_server from medusa.monitor import secure_monitor_server
...@@ -122,6 +122,8 @@ except: ...@@ -122,6 +122,8 @@ except:
from medusa import resolver, logger, asyncore from medusa import resolver, logger, asyncore
from HTTPServer import zhttp_server, zhttp_handler from HTTPServer import zhttp_server, zhttp_handler
from PCGIServer import PCGIServer from PCGIServer import PCGIServer
from FCGIServer import FCGIServer
from FTPServer import FTPServer from FTPServer import FTPServer
from PubCore import setNumberOfThreads from PubCore import setNumberOfThreads
from medusa.monitor import secure_monitor_server from medusa.monitor import secure_monitor_server
...@@ -165,6 +165,13 @@ Options: ...@@ -165,6 +165,13 @@ Options:
%(PCGI_FILE)s, relative to the Zope location. If this is an empty %(PCGI_FILE)s, relative to the Zope location. If this is an empty
string (-p '') or the file does not exist, then PCGI is disabled. string (-p '') or the file does not exist, then PCGI is disabled.
-F path_or_port
Either a port number (for inet sockets) or a path name (for unix
domain sockets) for the FastCGI Server. If the flag and value are
not specified then the FastCGI Server is disabled.
-m port -m port
The secure monitor server port. If this is an empty string The secure monitor server port. If this is an empty string
...@@ -268,11 +275,16 @@ MODULE='Zope' ...@@ -268,11 +275,16 @@ MODULE='Zope'
# The size of the thread pool, if ZODB3 is used. # The size of the thread pool, if ZODB3 is used.
NUMBER_OF_THREADS=4 NUMBER_OF_THREADS=4
# Localization support # Localization support
LOCALE_ID=None LOCALE_ID=None
# Socket path or port for the FastCGI Server
FCGI_PORT=None
# #
######################################################################## ########################################################################
...@@ -282,8 +294,9 @@ LOCALE_ID=None ...@@ -282,8 +294,9 @@ LOCALE_ID=None
try: try:
if string.split(sys.version)[0] < '1.5.2': if string.split(sys.version)[0] < '1.5.2':
raise 'Invalid python version', string.split(sys.version)[0] raise 'Invalid python version', string.split(sys.version)[0]
opts, args = getopt.getopt(sys.argv[1:], 'hz:Z:t:a:d:u:w:f:p:m:Sl:2DP:rL:') opts, args = getopt.getopt(sys.argv[1:], 'hz:Z:t:a:d:u:w:f:p:m:Sl:2DP:rF:L:')
DEBUG=0 DEBUG=0
READ_ONLY=0 READ_ONLY=0
...@@ -351,6 +364,8 @@ try: ...@@ -351,6 +364,8 @@ try:
elif o=='-L': elif o=='-L':
if v: LOCALE_ID=v if v: LOCALE_ID=v
else: LOCALE_ID='' else: LOCALE_ID=''
elif o=='-F': FCGI_PORT=v
__builtins__.__debug__=DEBUG __builtins__.__debug__=DEBUG
...@@ -375,6 +390,7 @@ sys.path=[os.path.join(here,'lib','python'),here ...@@ -375,6 +390,7 @@ sys.path=[os.path.join(here,'lib','python'),here
]+filter(None, sys.path) ]+filter(None, sys.path)
# Try to set the locale if specified on the command # Try to set the locale if specified on the command
# line. If the locale module is not available or the # line. If the locale module is not available or the
# requested locale is not supported by the local # requested locale is not supported by the local
...@@ -403,7 +419,6 @@ if LOCALE_ID is not None: ...@@ -403,7 +419,6 @@ if LOCALE_ID is not None:
set_locale(LOCALE_ID) set_locale(LOCALE_ID)
# from this point forward we can use the zope logger # from this point forward we can use the zope logger
# Import ZServer before we open the database or get at interesting # Import ZServer before we open the database or get at interesting
...@@ -450,7 +465,9 @@ if MODULE=='Zope': ...@@ -450,7 +465,9 @@ if MODULE=='Zope':
setNumberOfThreads(NUMBER_OF_THREADS) setNumberOfThreads(NUMBER_OF_THREADS)
from ZServer import resolver, logger, asyncore from ZServer import resolver, logger, asyncore
from ZServer import zhttp_server, zhttp_handler, PCGIServer,FTPServer
from ZServer import zhttp_server, zhttp_handler, PCGIServer,FTPServer,FCGIServer
from ZServer import secure_monitor_server from ZServer import secure_monitor_server
## ZServer startup ## ZServer startup
...@@ -508,6 +525,23 @@ if PCGI_FILE and not READ_ONLY: ...@@ -508,6 +525,23 @@ if PCGI_FILE and not READ_ONLY:
resolver=rs, resolver=rs,
logger_object=lg) logger_object=lg)
# FastCGI Server
if FCGI_PORT and not READ_ONLY:
fcgiPort = None
fcgiPath = None
try:
fcgiPort = string.atoi(FCGI_PORT)
except ValueError:
fcgiPath = FCGI_PORT
zfcgi = FCGIServer(module=MODULE,
ip=IP_ADDRESS,
port=fcgiPort,
socket_file=fcgiPath,
resolver=rs,
logger_object=lg)
# Monitor Server # Monitor Server
if MONITOR_PORT: if MONITOR_PORT:
from AccessControl.User import super from AccessControl.User import super
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment