@@ -55,8 +55,8 @@ def __init__(self, test_object, request_handler):
55
55
self .test_object = test_object
56
56
57
57
def run (self ):
58
- self .server = HTTPServer (('' , 0 ), self .request_handler )
59
- self .test_object .PORT = self .server .socket .getsockname ()[ 1 ]
58
+ self .server = HTTPServer (('localhost ' , 0 ), self .request_handler )
59
+ self .test_object .HOST , self . test_object . PORT = self .server .socket .getsockname ()
60
60
self .test_object .server_started .set ()
61
61
self .test_object = None
62
62
try :
@@ -84,7 +84,7 @@ def tearDown(self):
84
84
test_support .threading_cleanup (* self ._threads )
85
85
86
86
def request (self , uri , method = 'GET' , body = None , headers = {}):
87
- self .connection = httplib .HTTPConnection ('localhost' , self .PORT )
87
+ self .connection = httplib .HTTPConnection (self . HOST , self .PORT )
88
88
self .connection .request (method , uri , body , headers )
89
89
return self .connection .getresponse ()
90
90
@@ -187,7 +187,7 @@ def do_HEAD(self):
187
187
188
188
def setUp (self ):
189
189
BaseTestCase .setUp (self )
190
- self .con = httplib .HTTPConnection ('localhost' , self .PORT )
190
+ self .con = httplib .HTTPConnection (self . HOST , self .PORT )
191
191
self .con .connect ()
192
192
193
193
def test_command (self ):
0 commit comments