Re: URLWithString fails to fails with bad string
Re: URLWithString fails to fails with bad string
- Subject: Re: URLWithString fails to fails with bad string
- From: Jens Alfke <email@hidden>
- Date: Wed, 25 Nov 2009 10:52:27 -0800
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 (email@hidden)
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:
This email sent to email@hidden