diff --git a/ChangeLog b/ChangeLog index 274cd6ce6..0af2e39da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-07 Richard Frith-Macdonald + + * Source/GSHTTPURLHandle.m: Mimic MacOS-X behavior and cancel loading + if http status code is not in the 200-299 (success) range. + 2007-03-07 Richard Frith-Macdonald * Tools/objctidy.m: Removed ... should not have been added really as diff --git a/Source/GSHTTPURLHandle.m b/Source/GSHTTPURLHandle.m index cd5c7fc1d..0b0748b69 100644 --- a/Source/GSHTTPURLHandle.m +++ b/Source/GSHTTPURLHandle.m @@ -617,6 +617,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data) GSMimeHeader *info; NSString *val; float ver; + int code; connectionState = idle; [nc removeObserver: self name: nil object: sock]; @@ -635,7 +636,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data) */ info = [document headerNamed: @"http"]; val = [info objectForKey: NSHTTPPropertyStatusCodeKey]; - if ([val intValue] == 401 && self->challenged < 2) + code = [val intValue]; + if (code == 401 && self->challenged < 2) { GSMimeHeader *ah; @@ -734,8 +736,17 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data) bodyPos = 0; DESTROY(wData); NSResetMapTable(wProperties); - [self didLoadBytes: [d subdataWithRange: r] - loadComplete: YES]; + if (code >= 200 && code < 300) + { + [self didLoadBytes: [d subdataWithRange: r] + loadComplete: YES]; + } + else + { + [self didLoadBytes: [d subdataWithRange: r] + loadComplete: NO]; + [self cancelLoadInBackground]; + } } else {