[Zope-Checkins] CVS: Products/SiteAccess - VirtualHostMonster.py:1.10.22.3

Andreas Jung andreas at andreas-jung.com
Thu Dec 2 11:49:28 EST 2004


Update of /cvs-repository/Products/SiteAccess
In directory cvs.zope.org:/tmp/cvs-serv8805/lib/python/Products/SiteAccess

Modified Files:
      Tag: Zope-2_7-branch
	VirtualHostMonster.py 
Log Message:
      - The REQUEST now contains a new entry ACTUAL_URL which contains the
        full URL without query string as it appears within the location bar of
        the browser. The key has been added to provide a single key that is 
        available for vhosted and non-vhosted installations.

      - Collector #1605: VHM did not quote URLs


=== Products/SiteAccess/VirtualHostMonster.py 1.10.22.2 => 1.10.22.3 ===
--- Products/SiteAccess/VirtualHostMonster.py:1.10.22.2	Fri Dec 12 14:36:39 2003
+++ Products/SiteAccess/VirtualHostMonster.py	Thu Dec  2 11:49:28 2004
@@ -8,6 +8,7 @@
 from Acquisition import Implicit, aq_inner, aq_parent
 from ZPublisher import BeforeTraverse
 from zExceptions import BadRequest
+from urllib import quote
 import os
 
 from AccessRule import _swallow
@@ -185,11 +186,16 @@
                         vh_part = path.pop(0)[1:]
                     if vh_part:
                         request['VIRTUAL_URL_PARTS'] = vup = (
-                            request['SERVER_URL'], vh_part, '/'.join(path))
+                            request['SERVER_URL'], vh_part, quote('/'.join(path)))
                     else:
                         request['VIRTUAL_URL_PARTS'] = vup = (
-                            request['SERVER_URL'], '/'.join(path))
+                            request['SERVER_URL'], quote('/'.join(path)))
                     request['VIRTUAL_URL'] = '/'.join(vup)
+
+                    # new ACTUAL_URL
+                    add = request['ACTUAL_URL'].endswith('/') and '/' or ''
+                    request['ACTUAL_URL'] = request['VIRTUAL_URL']+add
+
                 return
             vh_used = 1 # Only retry once.
             # Try to apply the host map if one exists, and if no



More information about the Zope-Checkins mailing list