A quick question. I have the following code which gets the mod date of a file on a server:
- (void) sendRequestForLastModifiedHeaders
{
/* send a request for file modification date */
NSURLRequest *modReq = [NSURLRequest requestWithURL:[NSURL URLWithString:URLInput.text]
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0f];
[[NSURLConnection alloc] initWithRequest:modReq delegate:self];
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
/* convert response into an NSHTTPURLResponse,
call the allHeaderFields property, then get the
Last-Modified key.
*/
NSHTTPURLResponse *foo = [(NSHTTPURLResponse *)response allHeaderFields];
NSString * last_modified = [NSString stringWithFormat:@"%@",
[[(NSHTTPURLResponse *)response allHeaderFields] objectForKey:@"Last-Modified"]];
NSLog(@"Last-Modified: %@", last_modified );
}
My main question is the following:
Does this call only send over the header? If the file is big I do not want the whole file being downloaded. That is why I'm checking the header.
+++++++++++++++++++++++++++++++++++++++ After the update this works... Thanks now looks like:
NSMutableURLRequest *modReq = [NSMutableURLRequest requestWithURL:[NSURL URLWithString: URLInput.text]
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0f];
[modReq setHTTPMethod:@"HEAD"];