You need to provide your definition of "valid". From the code fragment you have there, it seems to involve actually connecting to the URL. That's different from most ordinary definitions of "valid", which tend to only concern themselves with whether the URL is well-formed. Seeing if you can connect to the URL opens up a big can of worms. Like: what if the URL requires authentication? How long do you want to wait if there's no response before timing out, and then what? How many minutes (hours, days) do you want to retry over until you're convinced that the URL's host is not just down for maintenance or something?

Tom Landry

Ranch Hand

Posts: 76

posted 4 years ago

Paul Clapham wrote:You need to provide your definition of "valid". From the code fragment you have there, it seems to involve actually connecting to the URL. That's different from most ordinary definitions of "valid", which tend to only concern themselves with whether the URL is well-formed. Seeing if you can connect to the URL opens up a big can of worms. Like: what if the URL requires authentication? How long do you want to wait if there's no response before timing out, and then what? How many minutes (hours, days) do you want to retry over until you're convinced that the URL's host is not just down for maintenance or something?

Not sure exactly what is being done behind the scenes but the original object (UrlValidator ) did some sort of validation.
It appears to attempt to connect.
Only attempted it against non-verification type pages so your point about what if the URL prompts for username/pwd would it hang or something.
May just still with format of the URL simply being well formed.