[Zope-Checkins] SVN: Zope/trunk/ - Collector #2122: fixed missing is_proxying_match definition

2006-06-10 Thread Andreas Jung
Log message for revision 68564:
- Collector #2122: fixed missing is_proxying_match definition
  in ZServer/HTTPServer
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/ZServer/HTTPServer.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2006-06-10 13:21:05 UTC (rev 68563)
+++ Zope/trunk/doc/CHANGES.txt  2006-06-10 13:21:54 UTC (rev 68564)
@@ -24,3 +24,5 @@
 
 Bugs Fixed
 
+  - Collector #2122: fixed missing is_proxying_match definition
+in ZServer/HTTPServer

Modified: Zope/trunk/lib/python/ZServer/HTTPServer.py
===
--- Zope/trunk/lib/python/ZServer/HTTPServer.py 2006-06-10 13:21:05 UTC (rev 
68563)
+++ Zope/trunk/lib/python/ZServer/HTTPServer.py 2006-06-10 13:21:54 UTC (rev 
68564)
@@ -63,6 +63,9 @@
 CONNECTION  = re.compile('Connection: (.*)', re.I)
 USER_AGENT  = re.compile('User-Agent: (.*)', re.I)
 
+is_proxying_match = re.compile(r'[^ ]* [^ \\]*:').match
+
+
 # maps request some headers to environment variables.
 # (those that don't start with 'HTTP_')
 header2env={'content-length': 'CONTENT_LENGTH',

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Zope/trunk/ - Collector #2122: fixed missing is_proxying_match definition

2006-06-10 Thread Andreas Jung
Log message for revision 68565:
- Collector #2122: fixed missing is_proxying_match definition
  in ZServer/HTTPServer
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Products/SiteAccess/SiteRoot.py
  A   Zope/trunk/lib/python/Products/SiteAccess/tests/testSiteRoot.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2006-06-10 13:21:54 UTC (rev 68564)
+++ Zope/trunk/doc/CHANGES.txt  2006-06-10 13:48:39 UTC (rev 68565)
@@ -26,3 +26,6 @@
 
   - Collector #2122: fixed missing is_proxying_match definition
 in ZServer/HTTPServer
+
+  - Collector 2077: fixed problem with ACTUAL_URL and SiteRoot
+

Modified: Zope/trunk/lib/python/Products/SiteAccess/SiteRoot.py
===
--- Zope/trunk/lib/python/Products/SiteAccess/SiteRoot.py   2006-06-10 
13:21:54 UTC (rev 68564)
+++ Zope/trunk/lib/python/Products/SiteAccess/SiteRoot.py   2006-06-10 
13:48:39 UTC (rev 68565)
@@ -117,10 +117,13 @@
 if srd[i] is None:
 srd[i] = request.environ.get(srp, None)
 if srd[0] is not None:
+request['ACTUAL_URL'] = 
request['ACTUAL_URL'].replace(request['SERVER_URL'], srd[0])
 request['SERVER_URL'] = srd[0]
 request._resetURLS()
 if srd[1] is not None:
+old = request['URL']
 request.setVirtualRoot(srd[1])
+request['ACTUAL_URL'] = request['ACTUAL_URL'].replace(old, 
request['URL'])
 
 def get_size(self):
 '''Make FTP happy'''

Added: Zope/trunk/lib/python/Products/SiteAccess/tests/testSiteRoot.py
===
--- Zope/trunk/lib/python/Products/SiteAccess/tests/testSiteRoot.py 
2006-06-10 13:21:54 UTC (rev 68564)
+++ Zope/trunk/lib/python/Products/SiteAccess/tests/testSiteRoot.py 
2006-06-10 13:48:39 UTC (rev 68565)
@@ -0,0 +1,50 @@
+SiteRoot regression tests.
+
+These tests verify that the request URL headers, in particular ACTUAL_URL, are
+set correctly when a SiteRoot is used.
+
+See http://www.zope.org/Collectors/Zope/2077
+
+
+
+from Testing.makerequest import makerequest
+
+import Zope2
+Zope2.startup()
+
+import transaction
+
+import unittest
+
+class SiteRootRegressions(unittest.TestCase):
+
+def setUp(self):
+transaction.begin()
+self.app = makerequest(Zope2.app())
+try:
+self.app.manage_addFolder('folder')
+   
self.app.folder.manage_addProduct['SiteAccess'].manage_addSiteRoot(title = 
'SiteRoot', base = 'http://test_base', path = '/test_path')
+   self.app.REQUEST.set('PARENTS', [self.app])
+   self.app.REQUEST.traverse('/folder')
+   
+except:
+self.tearDown()
+
+def tearDown(self):
+transaction.abort()
+self.app._p_jar.close()
+   
+def testRequest(self):
+self.assertEqual(self.app.REQUEST['SERVER_URL'], 'http://test_base') 
+   self.assertEqual(self.app.REQUEST['URL'], 
'http://test_base/test_path/index_html')
+   self.assertEqual(self.app.REQUEST['ACTUAL_URL'], 
'http://test_base/test_path')
+def testAbsoluteUrl(self): 
+   self.assertEqual(self.app.folder.absolute_url(), 
'http://test_base/test_path')
+
+def test_suite():
+suite = unittest.TestSuite()
+suite.addTest(unittest.makeSuite(SiteRootRegressions))
+return suite
+
+if __name__ == '__main__':
+unittest.main(defaultTest='test_suite')

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins