سؤال

I have a unit test where I need a invalid web address. I remember vaguely that the web ISO standard has one but for the life of me I can't find it.

So the question is what is the valid invalid web address (preferably ISO standard)?. www.invalid.org?? www.fake.net?? www.givemenothing.net

Cheers,

Choco

هل كانت مفيدة؟

المحلول

I don't think this is technically ISO, but I do think it's what you're looking for: http://www.iana.org/domains/reserved

Example domains

As described in RFC 2606, a number of domains such as example.com and example.org for documentation purposes. These domains may be used as illustrative examples in documents without prior coordination with us. They are not available for registration or transfer.

(example.net is another one of those, not mentioned there.)

Clicking through to the RFC shows some other valid options:

[...] four domain names are reserved as listed and described below.

.test
.example
.invalid
.localhost

".test" is recommended for use in testing of current or new DNS related code.

".example" is recommended for use in documentation or as examples.

".invalid" is intended for use in online construction of domain names that are sure to be invalid and which it is obvious at a glance are invalid.

The ".localhost" TLD has traditionally been statically defined in host DNS implementations as having an A record pointing to the loop back IP address and is reserved for such use. Any other use would conflict with widely deployed code which assumes this use.

Personally, in your case, I'd go with example.org. None of the four top-level domain names seem to qualify for your needs.

نصائح أخرى

The generic systax for URI is defined in

Uniform Resource Identifier (URI): Generic Syntax

https://www.rfc-editor.org/rfc/rfc3986

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top