[Checkins] SVN: zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/wsgi.py Provide the URL when attempting to connect to an un-allowed host in an attempt
Brian Sutherland
jinty at web.de
Mon Mar 7 08:13:57 EST 2011
Log message for revision 120789:
Provide the URL when attempting to connect to an un-allowed host in an attempt
to fix https://bugs.launchpad.net/zope.testbrowser/+bug/98482
Changed:
U zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/wsgi.py
-=-
Modified: zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/wsgi.py
===================================================================
--- zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/wsgi.py 2011-03-07 13:04:02 UTC (rev 120788)
+++ zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/wsgi.py 2011-03-07 13:13:57 UTC (rev 120789)
@@ -34,6 +34,8 @@
class WSGIConnection(object):
"""A ``mechanize`` compatible connection object."""
+ _allowed = True
+
def __init__(self, test_app, host, timeout=None):
self._test_app = TestApp(test_app)
self.host = host
@@ -46,7 +48,7 @@
for dom in _allowed_2nd_level:
if host.endswith('.%s' % dom):
return
- raise HostNotAllowed(host)
+ self._allowed = False
def set_debuglevel(self, level):
pass
@@ -84,6 +86,9 @@
if scheme_key in headers:
del headers[scheme_key]
+ if not self._allowed:
+ raise HostNotAllowed('%s://%s%s' % (extra_environ['wsgi.url_scheme'], self.host, url))
+
app = self._test_app
# clear our app cookies so that our testbrowser cookie headers don't
More information about the checkins
mailing list