MCPcopy Create free account
hub / github.com/catchpoint/WebPageTest.tsproxy / HandleResolve

Method HandleResolve

tsproxy.py:329–353  ·  view source on GitHub ↗
(self, message)

Source from the content-addressed store, hash-verified

327 pass
328
329 def HandleResolve(self, message):
330 global in_pipe, map_localhost, lock, background_activity_count
331 self.did_resolve = True
332 is_localhost = False
333 if 'hostname' in message:
334 self.hostname = message['hostname']
335 self.port = 0
336 if 'port' in message:
337 self.port = message['port']
338 logging.info('[{0:d}] Resolving {1}:{2:d}'.format(self.client_id, self.hostname, self.port))
339 if self.hostname == 'localhost':
340 self.hostname = '127.0.0.1'
341 if self.hostname == '127.0.0.1':
342 logging.info('[{0:d}] Connection to localhost detected'.format(self.client_id))
343 is_localhost = True
344 if (dest_addresses is not None) and (not is_localhost or map_localhost):
345 logging.info('[{0:d}] Resolving {1}:{2:d} to mapped address {3}'.format(self.client_id, self.hostname, self.port, dest_addresses))
346 self.SendMessage('resolved', {'addresses': dest_addresses, 'localhost': False})
347 else:
348 lock.acquire()
349 background_activity_count += 1
350 lock.release()
351 self.state = self.STATE_RESOLVING
352 self.dns_thread = AsyncDNS(self.client_id, self.hostname, self.port, is_localhost, in_pipe)
353 self.dns_thread.start()
354
355 def HandleConnect(self, message):
356 global map_localhost

Callers 1

handle_messageMethod · 0.95

Calls 2

SendMessageMethod · 0.95
AsyncDNSClass · 0.85

Tested by

no test coverage detected