RFC 2168 Resolution of URIs Using the DNS June 1997
We extract the prefix, "http", and lookup NAPTR records for
http.urn.net. This might return a record of the form
http.urn.net IN NAPTR
;; order pref flags service regexp replacement
100 90 "" "" "!http://([^/:]+)!\1!i" .
This expression returns everything after the first double slash and
before the next slash or colon. (We use the '!' character to delimit
the parts of the substitution expression. Otherwise we would have to
use backslashes to escape the forward slashes, and would have a
regexp in the zone file that looked like
"/http:\\/\\/([^\\/:]+)/\\1/i".).
Applying this pattern to the URL extracts "www.foo.com". Looking up
NAPTR records for that might return:
www.foo.com
;; order pref flags service regexp replacement
IN NAPTR 100 100 "s" "http+L2R" "" http.tcp.foo.com
IN NAPTR 100 100 "s" "ftp+L2R" "" ftp.tcp.foo.com
Looking up SRV records for http.tcp.foo.com would return information
on the hosts that foo.com has designated to be its mirror sites. The
client can then pick one for the user.
NAPTR RR Format
===============
The format of the NAPTR RR is given below. The DNS type code for
NAPTR is 35.
Domain TTL Class Order Preference Flags Service Regexp
Replacement
where:
Domain
The domain name this resource record refers to.
TTL
Standard DNS Time To Live field
Class
Standard DNS meaning
RFC 2168 Resolution of URIs Using the DNS June 1997
Order
A 16-bit integer specifying the order in which the NAPTR
records MUST be processed to ensure correct delegation of
portions of the namespace over time. Low numbers are processed
before high numbers, and once a NAPTR is found that "matches"
a URN, the client MUST NOT consider any NAPTRs with a higher
value for order.
Preference
A 16-bit integer which specifies the order in which NAPTR
records with equal "order" values SHOULD be processed, low
numbers being processed before high numbers. This is similar
to the preference field in an MX record, and is used so domain
administrators can direct clients towards more capable hosts
or lighter weight protocols.
Flags
A String giving flags to control aspects of the rewriting and
interpretation of the fields in the record. Flags are single
characters from the set [A-Z0-9]. The case of the alphabetic
characters is not significant.
At this time only three flags, "S", "A", and "P", are defined.
"S" means that the next lookup should be for SRV records
instead of NAPTR records. "A" means that the next lookup
should be for A records. The "P" flag says that the remainder
of the resolution shall be carried out in a Protocol-specific
fashion, and we should not do any more DNS queries.
The remaining alphabetic flags are reserved. The numeric flags
may be used for local experimentation. The S, A, and P flags
are all mutually exclusive, and resolution libraries MAY
signal an error if more than one is given. (Experimental code
and code for assisting in the creation of NAPTRs would be more
=6= |