Ask Your Question

Revision history [back]

How does a web browser parse the raw bytes of each part of a DNS name to a human readable form?

My focus is to parse the structure of a DNS packet programmatically using python. Consider the snap where my browser send a large domain name through the pipe without even complaining.

image description

Let's take a close look at the byte string: b'\x03www99dksjfhkdfgh534534534dkfghkldfhglksdfhg435634634dkfghlkd\x03com\x00'

image description

I can programmatically write my codes in python with a logic like this image description

So my question is: How does a web browser parse the raw bytes of each part of a DNS name to a human readable form? Any form of advice/help is welcomed.