Re: URLAccess Stalls
Re: URLAccess Stalls
- Subject: Re: URLAccess Stalls
- From: Becky Willrich <email@hidden>
- Date: Thu, 15 Dec 2005 11:19:40 -0800
We highly encourage you to make the transition to CFNetwork.
Here's some sample code to get you started. None of it contains
any Objective-C.
<http://developer.apple.com/samplecode/CFFTPSample/CFFTPSample.html>
<http://developer.apple.com/samplecode/CFNetworkHTTPDownload/
CFNetworkHTTPDownload.html>
Thanx, the examples don't look too bad. I'll just say if( OSX ) in
my class to decide whether to use URLAccess or CF, unless there is
a certain version of OS X where it would be a good idea to still
use URLAccess, like say 10.1?
On 10.0, you'll have to use URLAccess - CFNetwork didn't exist yet.
CFNetwork on 10.1 had a known list of gotchas, but URL Access had its
list of gotchas, too, so you sort of have to pick your poison. The
list of CFNetwork gotchas can be found in the archives of this list;
look for posts made by me over a year ago. I'm afraid I can't help
you figure out the URL Access gotchas on 10.1; maybe someone else
can. Starting with 10.2, you should definitely use CFNetwork in
preference to URL Access.
OK, I actually have used http enough that I can run it from telnet,
I have functions to parse the headers and cookies, etc. I have
made Get/Set operators for key/valye pairs that act a lot like
associative arrays in javascript. So I could probably program the
whole thing now over a socket, although it would be ugly. Do NSURL
or CFHTTPStream, or even CFNetwork have functions for individual
items in the header?
Both CFNetwork and Foundation allow you to customize the header to
your heart's content. In CFNetwork, you would be using CFHTTPMessage
(look in CFNetwork/CFHTTPMessage.h); in Foundation, you would be
using the NSHTTPURLRequest category on NSMutableURLRequest (look in
in Foundation/NSURLRequest.h). Note that in Foundation, you
automatically get integration with the user's cookie store, and you'd
have to go to some effort to circumvent that if for some reason you
wanted to keep your cookies separate from the user's cookies (set by
Safari, for instance).
And what I really need is SSL support. I want to be able to just
type https in the URL and have it "just work". I'm wondering which
of the methods is better for that.
Both CFNetwork and Foundation will automatically use SSL for https
URLs. CFNetwork has better hooks for controlling when the server
certificate is accepted than Foundation at this time; otherwise,
neither one is any better than the other (and in fact, Foundation
uses CFNetwork to do all the heavy listing with SSL, so they're
functionally identical).
Also, I have never done anything with a proxy server, but should I
need that, is there a way to just add it in, and which of these
would be better for that?
Foundation automatically uses the default proxy configuration on the
system. CFNetwork requires that you specify which proxy to use; the
ImageClient sample code from this year's WWDC shows how to get
CFNetwork to use the default proxy configuration (it's 2 lines of
code, if I recall). If you need to use a custom proxy configuration
(i.e. not what the user has configured), you will have to use CFNetwork.
Hope that helps; let us know how it goes,
REW
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden