You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to use addressable library to validate domain names users insert, but it is failing in my simple scenario, may be I am doing something wrong here:
However, Addressable does not verify domain names. Domain names are not part of the URI spec, so Addressable intentionally does not verify them. The URI implementation in the standard library partially validates them, but there are plenty of valid domains that it rejects and plenty of invalid ones that it misses, so I don't recommend using it for this purpose.
Also, I should add that the strings you're entering are in fact relative URIs, not domain names as far as the parse methods of both Addressable and the standard library are concerned. So yes, these will all be parsed without error, and that is 100% the correct result.
I would like to use addressable library to validate domain names users insert, but it is failing in my simple scenario, may be I am doing something wrong here:
C:>irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'uri'
=> true
irb(main):003:0> URI.parse('mic')
=> #<URI::Generic:0x4231f50 URL:mic>
How can I validate whether this string is a valid domain name?
The text was updated successfully, but these errors were encountered: