summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2009-09-28 16:57:45 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2009-09-28 16:57:45 (GMT)
commit97f5ff37ffa259cbb8fa418be04b03eac0531251 (patch)
tree02d8c3706e407afd876feb839b76da241deef60b
parent71adc9328d593449a7d8d3bff45b09bf87afa59e (diff)
downloadcpython-97f5ff37ffa259cbb8fa418be04b03eac0531251.zip
cpython-97f5ff37ffa259cbb8fa418be04b03eac0531251.tar.gz
cpython-97f5ff37ffa259cbb8fa418be04b03eac0531251.tar.bz2
Prevent test_bad_address failure when a domain in the dns search
path implements a '*' default rule. Also update comment with a more complete explanation of the difficulties inherent in the test.
-rw-r--r--Lib/test/test_urllib2_localnet.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
index 1729d5f..ee19a4b 100644
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -472,14 +472,24 @@ class TestUrlopen(unittest.TestCase):
# Make sure proper exception is raised when connecting to a bogus
# address.
self.assertRaises(IOError,
- # SF patch 809915: In Sep 2003, VeriSign started
- # highjacking invalid .com and .net addresses to
- # boost traffic to their own site. This test
- # started failing then. One hopes the .invalid
- # domain will be spared to serve its defined
- # purpose.
- # urllib2.urlopen, "http://www.sadflkjsasadf.com/")
- urllib2.urlopen, "http://sadflkjsasf.i.nvali.d/")
+ # Given that both VeriSign and various ISPs have in
+ # the past or are presently hijacking various invalid
+ # domain name requests in an attempt to boost traffic
+ # to their own sites, finding a domain name to use
+ # for this test is difficult. RFC2606 leads one to
+ # believe that '.invalid' should work, but experience
+ # seemed to indicate otherwise. Single character
+ # TLDs are likely to remain invalid, so this seems to
+ # be the best choice. The trailing '.' prevents a
+ # related problem: The normal DNS resolver appends
+ # the domain names from the search path if there is
+ # no '.' the end and, and if one of those domains
+ # implements a '*' rule a result is returned.
+ # However, none of this will prevent the test from
+ # failing if the ISP hijacks all invalid domain
+ # requests. The real solution would be to be able to
+ # parameterize the framework with a mock resolver.
+ urllib2.urlopen, "http://sadflkjsasf.i.nvali.d./")
def test_main():