[Zope-CVS] CVS: Packages/HTTPMounter - HTTPMounter.py:1.11

Andreas Jung andreas@digicool.com
Tue, 28 May 2002 12:01:08 -0400


Update of /cvs-repository/Packages/HTTPMounter
In directory cvs.zope.org:/tmp/cvs-serv5826

Modified Files:
	HTTPMounter.py 
Log Message:
yet another fix to get acquisition *and* virtual hosting working


=== Packages/HTTPMounter/HTTPMounter.py 1.10 => 1.11 ===
         from zLOG import INFO, LOG
 
-        path_info = string.replace(REQUEST['URL1'] , REQUEST['SERVER_URL'],'')
-        path_elements = string.split(path_info,'/')
-        path_elements = filter(lambda x: x, path_elements)
-        pos = path_elements.index(self.id)
-        sub_path = string.join(path_elements[pos+1:], '/')
-        
-        if pos+1==len(path_elements): sub_path = sub_path +  self.default_document
+        own_path = string.join(self.getPhysicalPath(), '/')
+
+        path = REQUEST['URL1']
+        pos = string.rfind(path, self.id)
+        sub_path = path[pos + len(self.id):]
+
+        if REQUEST['URL1'][- len(self.id):] == self.id:
+            sub_path = sub_path + self.default_document
 
         tries = 0
 
@@ -77,7 +78,7 @@
                 path = tup[2] 
                 if path[-1] != '/': path = path + '/'
                 path = path + sub_path
-                
+
                 status, data, headers = self._http_request(host, path)
                 for k in ('content-type','content-length','etag','last-modified'):
                     v = headers.getheader(k)