|
@@ -764,15 +764,19 @@ static inline NSUInteger _ScanHexNumber(const void* bytes, NSUInteger size) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25
|
|
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26
|
|
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26
|
|
static inline BOOL _CompareResources(NSString* responseETag, NSString* requestETag, NSDate* responseLastModified, NSDate* requestLastModified) {
|
|
static inline BOOL _CompareResources(NSString* responseETag, NSString* requestETag, NSDate* responseLastModified, NSDate* requestLastModified) {
|
|
- if ([requestETag isEqualToString:@"*"] && (!responseLastModified || !requestLastModified || ([responseLastModified compare:requestLastModified] != NSOrderedDescending))) {
|
|
|
|
- return YES;
|
|
|
|
- } else {
|
|
|
|
- if ([responseETag isEqualToString:requestETag]) {
|
|
|
|
|
|
+ if (requestLastModified && responseLastModified) {
|
|
|
|
+ if ([responseLastModified compare:requestLastModified] != NSOrderedDescending) {
|
|
|
|
+ return YES;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (requestETag && responseETag) { // Per the specs "If-None-Match" must be checked after "If-Modified-Since"
|
|
|
|
+ if ([requestETag isEqualToString:@"*"]) {
|
|
return YES;
|
|
return YES;
|
|
}
|
|
}
|
|
- if (responseLastModified && requestLastModified && ([responseLastModified compare:requestLastModified] != NSOrderedDescending)) {
|
|
|
|
|
|
+ if ([responseETag isEqualToString:requestETag]) {
|
|
return YES;
|
|
return YES;
|
|
}
|
|
}
|
|
}
|
|
}
|