On Nov 25, 2009, at 9:34 AM, Dave Carrigan wrote:

The only way to determine the validity of a well-formed url is to attempt to retrieve it.

The two of you are using different terminology. He's asking how to tell if a URL is well-formed.

Lorenzo: If you want to know if you can retrieve a URL by HTTP, then simply check whether it's an HTTP URL, by getting its -scheme property and doing a case-insensitive compare with 'http' or 'https'.

What I'm doing exactly, is downloading batches of web pages via http. I don't want to make the attempt if the url is not valid.

You definitely don't want to try to retrieve every URL then, or your app is letting an arbitrary untrusted web page let it open any imaginable URL. I can't immediately think of a serious exploit using this, but the results of opening arbitrary 'file:' URLs can be unexpected. For instance, trying to fetch "file:///dev/random" will lock up your app and possibly bring the computer to a crawl as it fills your address space with random bytes :)

—Jens_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to