Handle CFHTTPMessageCopyBody() now returning NULL for valid messages without a body

This commit is contained in:
Pierre-Olivier Latour
2019-01-03 16:00:19 -08:00
parent c46a2ddb22
commit acc54ceac3
+1 -1
View File
@@ -1236,7 +1236,7 @@ static void _LogResult(NSString* format, ...) {
if ([actualContentLength isEqualToString:expectedContentLength] && (actualBody.length > expectedBody.length)) { // Handle web browser closing connection before retrieving entire body (e.g. when playing a video file)
actualBody = [actualBody subdataWithRange:NSMakeRange(0, expectedBody.length)];
}
if (![actualBody isEqualToData:expectedBody]) {
if ((actualBody && expectedBody && ![actualBody isEqualToData:expectedBody]) || (actualBody && !expectedBody) || (!actualBody && expectedBody)) {
_LogResult(@" Bodies not matching:\n Expected: %lu bytes\n Actual: %lu bytes", (unsigned long)expectedBody.length, (unsigned long)actualBody.length);
success = NO;
#if !TARGET_OS_IPHONE