Re: using NSURLConnection to get only the HTTP header
Re: using NSURLConnection to get only the HTTP header
- Subject: Re: using NSURLConnection to get only the HTTP header
- From: John Mikros <email@hidden>
- Date: Wed, 28 Jun 2006 11:23:14 -0700
John,
This is working great for me. Thank you!
It seems to be working fine for me on 10.3.9 as well. What kind of
buggy behavior were you seeing?
thanks
-john
On Jun 27, 2006, at 7:36 PM, John Pannell wrote:
Hi John-
If you are Tiger only, you can use the setHTTPMethod: method on
NSMutableURLRequest, like so...
NSMutableURLRequest *request = [NSMutableURLRequest
requestWithURL:myURL];
[request setHTTPMethod:@"HEAD"];
[request setValue:@"MySpecialUserAgent/1.0"
forHTTPHeaderField:@"User-Agent"];
[request setTimeoutInterval:15.0];
[request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
myConnection = [[NSURLConnection alloc] initWithRequest:request
delegate:someObject];
There are a number of parameters that can be configured in the
request before creating a connection; some are shown above. The
documentation says that setHTTPMethod has been around since 10.3,
but my experience on Panther was that there were issues with the
underlying URL Loading system (related to keep-alive or something?)
that made HEAD requests not work properly and buggy as well - sorry
I can't recall the details...
HTH!
John
John Pannell
Positive Spin Media
http://www.positivespinmedia.com
On Jun 27, 2006, at 8:04 PM, John Mikros wrote:
Hello all,
I'm using NSURLConnection to download a file from a web server.
However, now I need to be able to check the last modified date in
the HTTP header for the file without actually downloading the file.
Is this possible to do with NSURLConnection? I was hoping that I
could look at the header in
- (void)connection:(NSURLConnection *)connection
didReceiveResponse:(NSURLResponse *)response
and then cancel the download, but using tcpdump, I see that I'm
downloading the whole file anyway.
Anyone have any ideas how to do what I want?
thanks
-john
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden