MCPcopy Index your code
hub / github.com/catchpoint/WebPageTest.tsproxy / HandleConnect

Method HandleConnect

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

Source from the content-addressed store, hash-verified

353 self.dns_thread.start()
354
355 def HandleConnect(self, message):
356 global map_localhost
357 if 'addresses' in message and len(message['addresses']):
358 self.state = self.STATE_CONNECTING
359 is_localhost = False
360 if 'localhost' in message:
361 is_localhost = message['localhost']
362 elif not self.did_resolve and message['addresses'][0] == '127.0.0.1':
363 logging.info('[{0:d}] Connection to localhost detected'.format(self.client_id))
364 is_localhost = True
365 if (dest_addresses is not None) and (not is_localhost or map_localhost):
366 self.addr = dest_addresses[0]
367 else:
368 self.addr = message['addresses'][0]
369 self.create_socket(self.addr[0], socket.SOCK_STREAM)
370 addr = self.addr[4][0]
371 if not is_localhost or map_localhost:
372 port = GetDestPort(message['port'])
373 else:
374 port = message['port']
375 logging.info('[{0:d}] Connecting to {1}:{2:d}'.format(self.client_id, addr, port))
376 self.connect((addr, port))
377
378
379########################################################################################################################

Callers 1

handle_messageMethod · 0.95

Calls 1

GetDestPortFunction · 0.85

Tested by

no test coverage detected