Commit 740e8d67 authored by Sidnei da Silva's avatar Sidnei da Silva

- Make it so webdav-source server is distinguishable from the default http server in the ZMI and event.log
parent e0de78c7
......@@ -380,8 +380,8 @@ class zhttp_channel(http_channel):
class zhttp_server(http_server):
"http server"
SERVER_IDENT='Zope/%s ZServer/%s' % (ZOPE_VERSION,ZSERVER_VERSION)
SERVER_IDENT = 'Zope/%s ZServer/%s' % (ZOPE_VERSION, ZSERVER_VERSION)
server_protocol = 'HTTP'
channel_class = zhttp_channel
shutup=0
......@@ -389,8 +389,9 @@ class zhttp_server(http_server):
self.shutup=1
http_server.__init__(self, ip, port, resolver, logger_object)
self.shutup=0
self.log_info('HTTP server started at %s\n'
self.log_info('%s server started at %s\n'
'\tHostname: %s\n\tPort: %d' % (
self.server_protocol,
time.ctime(time.time()),
self.server_name,
self.server_port
......@@ -398,7 +399,7 @@ class zhttp_server(http_server):
def clean_shutdown_control(self,phase,time_in_this_phase):
if phase==2:
self.log_info('closing HTTP to new connections')
self.log_info('closing %s to new connections' % self.server_protocol)
self.close()
def log_info(self, message, type='info'):
......@@ -418,3 +419,6 @@ class zhttp_server(http_server):
# override asyncore limits for nt's listen queue size
self.accepting = 1
return self.socket.listen (num)
class zwebdav_server(zhttp_server):
server_protocol = 'WebDAV'
......@@ -58,25 +58,27 @@ class ServerFactory:
class HTTPServerFactory(ServerFactory):
def __init__(self, section):
from ZServer import HTTPServer
if not section.address:
raise ZConfig.ConfigurationError(
"No 'address' settings found "
"within the 'http-server' or 'webdav-source-server' section")
ServerFactory.__init__(self, section.address)
self.server_class = HTTPServer.zhttp_server
self.force_connection_close = section.force_connection_close
# webdav-source-server sections won't have webdav_source_clients:
webdav_clients = getattr(section, "webdav_source_clients", None)
self.webdav_source_clients = webdav_clients
def create(self):
from ZServer import HTTPServer
from ZServer.AccessLogger import access_logger
handler = self.createHandler()
handler._force_connection_close = self.force_connection_close
if self.webdav_source_clients:
handler.set_webdav_source_clients(self.webdav_source_clients)
server = HTTPServer.zhttp_server(ip=self.ip, port=self.port,
server = self.server_class(ip=self.ip, port=self.port,
resolver=self.dnsresolver,
logger_object=access_logger)
server.install_handler(handler)
......@@ -88,6 +90,12 @@ class HTTPServerFactory(ServerFactory):
class WebDAVSourceServerFactory(HTTPServerFactory):
def __init__(self, section):
from ZServer import HTTPServer
HTTPServerFactory.__init__(self, section)
self.server_class = HTTPServer.zwebdav_server
def createHandler(self):
from ZServer.WebDAVSrcHandler import WebDAVSrcHandler
return WebDAVSrcHandler(self.module, '', self.cgienv)
......
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