Re: openURL Question
Re: openURL Question
- Subject: Re: openURL Question
- From: ettore <email@hidden>
- Date: Tue, 10 Jun 2003 18:59:53 -0700
On 2003-06-10 01:32:52 +0100 Matt Wood <email@hidden> wrote:
Perhaps openURL is checking to see if any HTML is returned, rather than what the web server response is?
I think openURL: only checks whether the URL is well-formed: see below....
If your non-existant URL is pointing to a page that doesn't exist, on a server which does exist, it may be set up to return the normal 404 'page not found' error - or perhaps one of the fancy custom error pages that Apache lets you set up - both of which would return HTML, which may fool openURL into thinking a connection has been made.
I partially agree: if a HTTP 404 message is returned, the URL appears to be "successfully opened" for openURL: (returns YES). But I noticed that openURL: returns YES also for URLs related to non-existant servers, and only returns NO for malformed URLs. Examples:
// well-formed URL, existant server, existant page
[workspace openURL:[NSURL URLWithString:@"
http://localhost/"]]; //returns YES
// well-formed URL, non-existant server, existant page
[workspace openURL:[NSURL URLWithString:@"
http://localhostt/"]]; //returns YES
// well-formed URL, existant server, non existant page
[workspace openURL:[NSURL URLWithString:@"
http://localhost/abc.html"]]; //returns YES
but:
// malformed URL, existant server, existant page
[workspace openURL:[NSURL URLWithString:@"htt://localhost/"]]; //returns NO and
and also I get the error:
LSOpenCFURLRef() returned -10814 for URL htt://localhost/
On Monday, June 9, 2003, at 10:14 pm, Henry McGilton wrote:
However, I expected the openURL method to return NO to
indicate that the URL was not opened successfully.
me too.... :)
The documentation states:
'returns YES if the location was successfully opened,
NO otherwise'
So, what does the documentation story *really* mean?
So, IMO it seems that the documentation is wrong, since openURL: just checks whether the URL is well-formed or not.... correct me if i'm wrong. :)
Ettore
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.