def test_ipv6(self):
try:
self.http_server.listen(self.get_http_port(), address='::1')
except socket.gaierror, e:
if e.errno == socket.EAI_ADDRFAMILY:
# ipv6 is not configured on this system, so skip this test
return
raise
url = self.get_url("/hello").replace("localhost", "[::1]")
# ipv6 is currently disabled by default and must be explicitly requested
self.http_client.fetch(url, self.stop)
response = self.wait()
self.assertEqual(response.code, 599)
self.http_client.fetch(url, self.stop, allow_ipv6=True)
response = self.wait()
self.assertEqual(response.body, b("Hello world!"))
simple_httpclient_test.py 文件源码
python
阅读 33
收藏 0
点赞 0
评论 0
评论列表
文章目录