Commit c4126ab0 authored by Andreas Jung's avatar Andreas Jung

added retrieval of the document source on the standard HTTP port

for dedicated webdav clients by setting the env. var
WEBDAV_SOURCE_PORT_CLIENTS
parent 44fc445d
......@@ -61,6 +61,7 @@ register_subsystem('ZServer HTTPServer')
CONTENT_LENGTH = re.compile('Content-Length: ([0-9]+)',re.I)
CONNECTION = re.compile('Connection: (.*)', re.I)
USER_AGENT = re.compile('User-Agent: (.*)', re.I)
# maps request some headers to environment variables.
# (those that don't start with 'HTTP_')
......@@ -197,6 +198,31 @@ class zhttp_handler:
env['GATEWAY_INTERFACE']='CGI/1.1'
env['REMOTE_ADDR']=request.channel.addr[0]
# This is a really bad hack to support WebDAV
# clients accessing documents through GET
# on the HTTP port. We check if your WebDAV magic
# machinery is enabled and if the client is recognized
# as WebDAV client. If yes, we fake the environment
# to pretend the ZPublisher to have a WebDAV request.
# This sucks like hell but it works pretty fine ;-)
if env['REQUEST_METHOD']=='GET':
if sys.WEBDAV_SOURCE_PORT_CLIENTS:
agent = get_header(USER_AGENT,request.header)
if sys.WEBDAV_SOURCE_PORT_CLIENTS(agent):
env['WEBDAV_SOURCE_PORT'] = 1
path_info = env['PATH_INFO']
path_info = os.path.join(path_info,'manage_FTPget')
path_info = os.path.normpath(path_info)
if os.sep != '/': path_info = path_info.replace(os.sep,'/')
env['PATH_INFO'] = path_info
# If we're using a resolving logger, try to get the
# remote host from the resolver's cache.
if hasattr(server.logger, 'resolver'):
......
......@@ -23,6 +23,10 @@ Zope Changes
to perform calculation of the week number based on the
Julian calendar.
- WebDAV: the new environment variable WEBDAV_SOURCE_PORT_CLIENTS
enables retrieval of the document source for dedicated WebDAV
clients (see ENVIRONMENT.txt for usage)
Bugs:
- Collector #32: Use difflib instead of ndiff
......
......@@ -216,6 +216,21 @@ Session related
The number of items to use as a "maximum number of subobjects"
value of the "/temp_folder" session data transient object container.
WebDAV
WEBDAV_SOURCE_PORT_CLIENTS
Setting this variable enables the retrieval of the document source
through the standard HTTP port instead of the WebDAV port. The value
of this variable is a regular expression that is matched against
the user-agent string of the client.
Example::
WEBDAV_SOURCE_PORT_CLIENTS="cadaver.*" enables retrieval
of the document source for the Cadaver WebDAV client
Esoteric
Z_MAX_STACK_SIZE
......
......@@ -61,6 +61,7 @@ register_subsystem('ZServer HTTPServer')
CONTENT_LENGTH = re.compile('Content-Length: ([0-9]+)',re.I)
CONNECTION = re.compile('Connection: (.*)', re.I)
USER_AGENT = re.compile('User-Agent: (.*)', re.I)
# maps request some headers to environment variables.
# (those that don't start with 'HTTP_')
......@@ -197,6 +198,31 @@ class zhttp_handler:
env['GATEWAY_INTERFACE']='CGI/1.1'
env['REMOTE_ADDR']=request.channel.addr[0]
# This is a really bad hack to support WebDAV
# clients accessing documents through GET
# on the HTTP port. We check if your WebDAV magic
# machinery is enabled and if the client is recognized
# as WebDAV client. If yes, we fake the environment
# to pretend the ZPublisher to have a WebDAV request.
# This sucks like hell but it works pretty fine ;-)
if env['REQUEST_METHOD']=='GET':
if sys.WEBDAV_SOURCE_PORT_CLIENTS:
agent = get_header(USER_AGENT,request.header)
if sys.WEBDAV_SOURCE_PORT_CLIENTS(agent):
env['WEBDAV_SOURCE_PORT'] = 1
path_info = env['PATH_INFO']
path_info = os.path.join(path_info,'manage_FTPget')
path_info = os.path.normpath(path_info)
if os.sep != '/': path_info = path_info.replace(os.sep,'/')
env['PATH_INFO'] = path_info
# If we're using a resolving logger, try to get the
# remote host from the resolver's cache.
if hasattr(server.logger, 'resolver'):
......
......@@ -597,6 +597,17 @@ try:
zh = WebDAVSrcHandler(MODULE, '', HTTP_ENV)
hs.install_handler(zh)
# enable document retrieval of the document source on the
# standard HTTP port
clients = os.environ.get('WEBDAV_SOURCE_PORT_CLIENTS')
if clients:
import re
sys.WEBDAV_SOURCE_PORT_CLIENTS = re.compile(clients).search
else:
sys.WEBDAV_SOURCE_PORT_CLIENTS = None
# FTP Server
if FTP_PORT:
if type(FTP_PORT) is type(0): FTP_PORT=((IP_ADDRESS, FTP_PORT),)
......
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