ogt / valid-url

Node module that provides URI validation functions
https://npmjs.org/package/valid-url
Other
215 stars 26 forks source link

False positives #7

Open atuttle opened 9 years ago

atuttle commented 9 years ago
var validator = require('valid-url');
console.log( validator.isWebUri('http://foo') );

prints http://foo (e.g. true), which is not correct. There is no TLD. Valid URLs will have at least one dot and 1 character after the dot.

ogt commented 9 years ago

Let me check whether this is the behavior of the original perl module or whether it is a bug introduced by me in the "translation". It appears that based on the original spec, the perl module would reject "relative hostnames" as opposed to accept them per RFC, which is the behavior you advocate as well image

ogt commented 9 years ago

So, in summary what you are pointing is a bug. i couldn't find anywhere in the perl code the part that is enforcing what he describes in the spec, ie that the authority is an actual TLD. It may take me a couple days to find the time to fix this. (out of job - trying to start my next company)

KhodeN commented 7 years ago

This is not bug. It is a valid URL. For example, you can declare 'foo' in /etc/hosts file for localhost or in your local network DNS-server for resolving internal hosts.