Revision 0a4b9bd3 asi-http-request-with-pithos/Classes/Pithos/ASIPithosRequest.m
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosRequest.m | ||
---|---|---|
295 | 295 |
[threadDict setObject:dateFormatter forKey:dateFormatterKey]; |
296 | 296 |
break; |
297 | 297 |
case 1: |
298 |
// date format: Wed, 20 Jul 2011 13:39:19 GMT
|
|
298 |
// date to format (RFC 1123): Sun, 06 Nov 1994 08:49:37 GMT
|
|
299 | 299 |
// Needed for reading X-Account-Until-Timestamp, Last-Modified |
300 |
// and writing If-Modified-Since, If-Unmodified-Since in the request headers |
|
300 | 301 |
dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; |
301 |
[dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]]; |
|
302 |
[dateFormatter setDateFormat:@"eee, dd MMM yyyy HH:mm:ss zzz"]; |
|
303 |
[threadDict setObject:dateFormatter forKey:dateFormatterKey]; |
|
304 |
break; |
|
305 |
case 2: |
|
306 |
// date to format: Thu Jul 21 10:54:45 2010 |
|
307 |
// Can be used to write If-Modified-Since, If-Unmodified-Since in the request headers |
|
308 |
dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; |
|
309 |
[dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]]; |
|
310 |
[dateFormatter setDateFormat:@"eee MMM dd HH:mm:ss yyyy"]; |
|
302 |
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]]; |
|
303 |
[dateFormatter setDateFormat:@"eee, dd MMM yyyy HH:mm:ss 'GMT'"]; |
|
311 | 304 |
[threadDict setObject:dateFormatter forKey:dateFormatterKey]; |
312 | 305 |
break; |
313 | 306 |
default: |
... | ... | |
322 | 315 |
|
323 | 316 |
- (void)addRequestIfModifiedSinceHeader:(NSDate *)sinceTimestamp { |
324 | 317 |
if (sinceTimestamp) |
325 |
[self addRequestHeader:@"If-Modified-Since" value:[[self dateFormatterWithFormatId:2] stringFromDate:sinceTimestamp]];
|
|
318 |
[self addRequestHeader:@"If-Modified-Since" value:[[self dateFormatterWithFormatId:1] stringFromDate:sinceTimestamp]];
|
|
326 | 319 |
} |
327 | 320 |
|
328 | 321 |
- (void)addRequestIfUnmodifiedSinceHeader:(NSDate *)sinceTimestamp { |
329 | 322 |
if (sinceTimestamp) |
330 |
[self addRequestHeader:@"If-Unmodified-Since" value:[[self dateFormatterWithFormatId:2] stringFromDate:sinceTimestamp]];
|
|
323 |
[self addRequestHeader:@"If-Unmodified-Since" value:[[self dateFormatterWithFormatId:1] stringFromDate:sinceTimestamp]];
|
|
331 | 324 |
} |
332 | 325 |
|
333 | 326 |
- (void)addRequestIfMatchHeader:(NSString *)matchETag { |
... | ... | |
357 | 350 |
if (rangeString) { |
358 | 351 |
[self addRequestHeader:@"Range" value:rangeString]; |
359 | 352 |
if (rangeTimestamp) |
360 |
[self addRequestHeader:@"If-Range" value:[[self dateFormatterWithFormatId:2] stringFromDate:rangeTimestamp]];
|
|
353 |
[self addRequestHeader:@"If-Range" value:[[self dateFormatterWithFormatId:1] stringFromDate:rangeTimestamp]];
|
|
361 | 354 |
} |
362 | 355 |
} |
363 | 356 |
|
Also available in: Unified diff