Commit c4016749 authored by Evan Simpson's avatar Evan Simpson

Merge fixes from Zope-2_5-branch

parent bcb5c442
...@@ -50,9 +50,7 @@ class VirtualHostMonster(Persistent, Item, Implicit): ...@@ -50,9 +50,7 @@ class VirtualHostMonster(Persistent, Item, Implicit):
except: except:
raise 'LineError', 'Needs a slash between host and path' raise 'LineError', 'Needs a slash between host and path'
pp = filter(None, split(path, '/')) pp = filter(None, split(path, '/'))
if not pp: if pp:
raise 'LineError', 'Empty path'
obpath = pp[:] obpath = pp[:]
if obpath[0] == 'VirtualHostBase': if obpath[0] == 'VirtualHostBase':
obpath = obpath[3:] obpath = obpath[3:]
...@@ -67,24 +65,24 @@ class VirtualHostMonster(Persistent, Item, Implicit): ...@@ -67,24 +65,24 @@ class VirtualHostMonster(Persistent, Item, Implicit):
except: except:
raise 'LineError', 'Path not found' raise 'LineError', 'Path not found'
if not getattr(ob.aq_base, 'isAnObjectManager', 0): if not getattr(ob.aq_base, 'isAnObjectManager', 0):
raise 'LineError', 'Path must lead to an Object Manager' raise 'LineError', ('Path must lead to '
'an Object Manager')
if 'VirtualHostRoot' not in pp:
pp.append('/')
pp.reverse()
try: try:
int(replace(host,'.','')) int(replace(host,'.',''))
raise 'LineError', 'IP addresses are not mappable' raise 'LineError', 'IP addresses are not mappable'
except ValueError: except ValueError:
pass pass
if 'VirtualHostRoot' not in pp:
pp.append('/')
pp.reverse()
if host[:2] == '*.': if host[:2] == '*.':
host_map = sub_map host_map = sub_map
host = host[2:] host = host[2:]
else: else:
host_map = fixed_map host_map = fixed_map
if not host_map.has_key(host):
host_map[host] = {}
hostname, port = (split(host, ':', 1) + [None])[:2] hostname, port = (split(host, ':', 1) + [None])[:2]
if not host_map.has_key(hostname):
host_map[hostname] = {}
host_map[hostname][port] = pp host_map[hostname][port] = pp
except 'LineError', msg: except 'LineError', msg:
line = '%s #! %s' % (line, msg) line = '%s #! %s' % (line, msg)
...@@ -160,8 +158,7 @@ class VirtualHostMonster(Persistent, Item, Implicit): ...@@ -160,8 +158,7 @@ class VirtualHostMonster(Persistent, Item, Implicit):
# If the directive is on top of the stack, go ahead # If the directive is on top of the stack, go ahead
# and process it right away. # and process it right away.
if at_end: if at_end:
if pp == [''] or pp == ['', '']: pp = filter(None, pp)
pp = []
request.setVirtualRoot(pp) request.setVirtualRoot(pp)
del stack[-2:] del stack[-2:]
break break
...@@ -187,7 +184,7 @@ class VirtualHostMonster(Persistent, Item, Implicit): ...@@ -187,7 +184,7 @@ class VirtualHostMonster(Persistent, Item, Implicit):
hostname = split(hostname, '.', 1)[1] hostname = split(hostname, '.', 1)[1]
if ports: if ports:
pp = ports.get(port, 0) pp = ports.get(port, 0)
if not pp and port is not None: if pp == 0 and port is not None:
# Try default port # Try default port
pp = ports.get(None, 0) pp = ports.get(None, 0)
if not pp: if not pp:
......
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