@@ -24,10 +24,11 @@ #import "OFString.h" #import "OFURL.h" #import "OFTCPSocket.h" #import "OFDictionary.h" #import "OFDataArray.h" +#import "OFSystemInfo.h" #import "OFHTTPRequestFailedException.h" #import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFInvalidServerReplyException.h" @@ -129,10 +130,11 @@ OFString *key, *object, *contentLengthHeader; int status; const char *type = NULL; size_t contentLength = 0; BOOL chunked; + size_t pageSize; char *buffer; size_t bytesReceived; if (![scheme isEqual: @"http"] && ![scheme isEqual: @"https"]) @throw [OFUnsupportedProtocolException @@ -359,11 +361,12 @@ if (contentLength > SIZE_MAX) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; } - buffer = [self allocMemoryWithSize: of_pagesize]; + pageSize = [OFSystemInfo pageSize]; + buffer = [self allocMemoryWithSize: pageSize]; bytesReceived = 0; @try { if (chunked) { for (;;) { void *pool2 = objc_autoreleasePoolPush(); @@ -394,12 +397,12 @@ (contentLengthHeader != nil && contentLength >= bytesReceived)) break; while (toRead > 0) { - size_t length = (toRead < of_pagesize - ? toRead : of_pagesize); + size_t length = (toRead < pageSize + ? toRead : pageSize); length = [sock readIntoBuffer: buffer length: length]; if ([delegate respondsToSelector: @@ -438,11 +441,11 @@ while (![sock isAtEndOfStream]) { void *pool2; length = [sock readIntoBuffer: buffer - length: of_pagesize]; + length: pageSize]; pool2 = objc_autoreleasePoolPush(); if ([delegate respondsToSelector: @selector(client:didReceiveData:length: