• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSURLRequest conditional GET
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSURLRequest conditional GET


  • Subject: NSURLRequest conditional GET
  • From: Marc Monguio <email@hidden>
  • Date: Wed, 18 Jun 2008 12:01:52 +0200

Some weird things seem to happen with NSURLRequest when used with NSURLRequestUseProtocolCachePolicy :

1)
The documentation I've found about "Conditional GET" in the web says I should be sending "If-Modified-Since" and "If-None-Match" headers with the contents of "Last-Modified" and ETag" headers from the last server's answer. However it doesn't look like a NSURLRequest with a NSURLRequestUseProtocolCachePolicy is adding the "If-None-Match" header. Fortunately it adds the "Last-Modified" header automatically so I've tweaked my server-side to be able to work just with this header for caching.


Is this a bug in NSURLRequestUseProtocolCachePolicy ?

2)
When debugging the status in the "connection:didReceiveResponse:" delegate method the statusCode is always 200. I knew for sure than in fact it was being cached so I ran "tcpdump" and I saw that except the first call the rest were always Status Code 304 Not Modified. Why I can't see what I really get from the server in my code?


- (void)connection:(NSURLConnection *)connection didReceiveResponse: (NSURLResponse *)response;
{
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
int statusCode = [httpResponse statusCode];
NSLog(@"StatusCode: %d", statusCode);
// ...


regards,
Marc
_______________________________________________

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


  • Follow-Ups:
    • Re: NSURLRequest conditional GET
      • From: Jens Alfke <email@hidden>
  • Prev by Date: [MODERATOR] Re: Two basic questions regarding UITableViewController and ObjC-2.0
  • Next by Date: Binding the enabled property of a NSMatrix instance to wether or not a multiple selection on a array controller is made.
  • Previous by thread: Re: [MODERATOR] Re: Two basic questions regarding UITableViewController and ObjC-2.0
  • Next by thread: Re: NSURLRequest conditional GET
  • Index(es):
    • Date
    • Thread