Objective-C
Objective-C
Setting a HTTP Max Response Size
Demonstrates theMaxResponseSize property.
Chilkat Objective-C Downloads
#import <CkoHttp.h>
#import <NSString.h>
BOOL success = NO;
CkoHttp *http = [[CkoHttp alloc] init];
unsigned long maxSz = 16384;
http.MaxResponseSize = [NSNumber numberWithUnsignedInt: maxSz];
// Try to get something larger, such as hamlet.xml which is 279658 bytes
NSString *xmlStr = [http QuickGetStr: @"https://chilkatsoft.com/hamlet.xml"];
if (http.LastMethodSuccess == NO) {
// If the LastErrorText contains the string "MaxResponseSize",
// then the HTTP request failed because the response body would've been larger than the max allowed response size.
NSLog(@"%@",http.LastErrorText);
return;
}
NSLog(@"%@",@"OK");