diff --git a/ChangeLog b/ChangeLog index c5cdc1c8d..b1e2aa663 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-03-02 Richard Frith-Macdonald + + * Headers/Foundation/NSURLHandle.h: Add new key. + * Source/NSURLHandle.m: Ditto + * Source/GSHTTPURLHandle.m: When a request completes with an HTTP + status code outside the 200-299 range, report it as a load complete + rather than cancelling the load is the new 'ReturnAll' key is set. + 2009-03-01 Fred Kiefer * Source/NSBundle.m (-localizedStringForKey:value:table): Correct diff --git a/Headers/Foundation/NSURLHandle.h b/Headers/Foundation/NSURLHandle.h index 543d98d85..242c7e039 100644 --- a/Headers/Foundation/NSURLHandle.h +++ b/Headers/Foundation/NSURLHandle.h @@ -115,6 +115,13 @@ GS_EXPORT NSString * const GSHTTPPropertyKeyFileKey; */ GS_EXPORT NSString * const GSHTTPPropertyPasswordKey; +/** + * Key for passing to [NSURLHandle]'s propertyForKey.. methods to + * specify that all results should be returned, not just those where the + * HTTP status code is in the 200-299 range. + */ +GS_EXPORT NSString * const GSHTTPPropertyReturnAllKey; + #endif /** diff --git a/Source/GSHTTPURLHandle.m b/Source/GSHTTPURLHandle.m index c194c9b15..dfa80a3b2 100644 --- a/Source/GSHTTPURLHandle.m +++ b/Source/GSHTTPURLHandle.m @@ -744,7 +744,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data) bodyPos = 0; DESTROY(wData); NSResetMapTable(wProperties); - if (code >= 200 && code < 300) + if ((code >= 200 && code < 300) + || [[request objectForKey: GSHTTPPropertyReturnAllKey] boolValue]) { [self didLoadBytes: [d subdataWithRange: r] loadComplete: YES]; @@ -1513,6 +1514,11 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data) * to 8080 for http and 4430 for https. * * + * GSHTTPPropertyReturnAllKey - specify whether the handle is to + * return all HTTP responses, or only those where the code is in + * the range from 200 to 299. + * + * * Any NSHTTPProperty... key * * diff --git a/Source/NSURLHandle.m b/Source/NSURLHandle.m index 241587af4..66b5dbcf2 100644 --- a/Source/NSURLHandle.m +++ b/Source/NSURLHandle.m @@ -88,6 +88,9 @@ NSString * const GSHTTPPropertyKeyFileKey NSString * const GSHTTPPropertyPasswordKey = @"GSHTTPPropertyPasswordKey"; +NSString * const GSHTTPPropertyReturnAllKey + = @"GSHTTPPropertyReturnAllKey"; + /** *