DNS-SD TXT record format

General format rules for DNS TXT records

General rules for DNS TXT records are given in Section 6 of DNS-Based Service Discovery

DNS-SD TXT Records for _http._tcp service

Currently three keys are defined for _http._tcp service: u (user), p (password) and path (path).

The value of the path key is everything that comes after the optional port number in an HTTP URL, as defined in section 3.2.2 of RFC 2616 ("HTTP/1.1"):

3.2.2 http URL

http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]

If you are writing a web browser, then the path key gives you the text that should appear directly after "GET " in an HTTP "GET" request.

If you are writing a tool to generate a URL to send to a web browser for display, then you should generate a URL of the form shown below, where {host} and {port} are obtained from the information in the service's SRV record, and {path} is obtained from the "path" key in the TXT record:

http://{host}:{port}{path}

The path key in the TXT record MUST include the leading slash of the abs_path, e.g. the following is a legal DNS-SD TXT record for an _http._tcp service:

path=/thepage.html

If the path key is missing, or present with no value or empty value, or otherwise invalid, then the path is assumed to be "/".

Although, strictly speaking, usernames and passwords are not supposed to appear in HTTP URLs, people frequently use them. If "u=<user>" appears in the text record, it specifies the username to use, and likewise for "p=<password>". If you are writing a tool to generate a URL to send to a web browser for display, then you should generate a URL of the form shown below:

http://{user}:{password}@{host}:{port}{path}

http://www.dns-sd.org