Skip to content

Commit

Permalink
Merge pull request #653 from HTTPArchive/dns
Browse files Browse the repository at this point in the history
Fixed DNS time processing from the netlog
  • Loading branch information
mjkozicki committed Apr 17, 2024
2 parents ad42151 + b0abeda commit 4536ff0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/support/netlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,12 @@ def post_process_events(self):
for dns_id in self.netlog['dns']:
dns = self.netlog['dns'][dns_id]
if 'host' in dns and 'start' in dns and 'end' in dns \
and dns['end'] >= dns['start'] and 'address_list' in dns:
and dns['end'] >= dns['start']:
hostname = dns['host']
separator = hostname.find('://')
if separator > 0:
separator += 3
hostname = hostname[separator:]
separator = hostname.find(':')
if separator > 0:
hostname = hostname[:separator]
Expand Down Expand Up @@ -731,7 +735,7 @@ def process_dns_event(self, event):
parent_id = params['source_dependency']['id']
if 'connect_job' in self.netlog and parent_id in self.netlog['connect_job']:
self.netlog['connect_job'][parent_id]['dns'] = request_id
if name == 'HOST_RESOLVER_IMPL_REQUEST' and 'phase' in event:
if (name == 'HOST_RESOLVER_IMPL_REQUEST' or name == 'HOST_RESOLVER_DNS_TASK') and 'phase' in event:
if event['phase'] == 'PHASE_BEGIN':
if 'start' not in entry or event['time'] < entry['start']:
entry['start'] = event['time']
Expand All @@ -751,8 +755,6 @@ def process_dns_event(self, event):
entry['end'] = event['time']
if 'host' not in entry and 'host' in params:
entry['host'] = params['host']
if 'address_list' in params:
entry['address_list'] = params['address_list']

def process_socket_event(self, event):
if 'socket' not in self.netlog:
Expand Down

0 comments on commit 4536ff0

Please sign in to comment.