diff --git a/Source/GSHTTPURLHandle.m b/Source/GSHTTPURLHandle.m index 41a8c0445..bf7d77768 100644 --- a/Source/GSHTTPURLHandle.m +++ b/Source/GSHTTPURLHandle.m @@ -308,7 +308,10 @@ static void debugWrite(NSData *data) * Don't start a load if one is in progress. */ if (connectionState != idle) - return; + { + NSLog(@"Attempt to load an http handle which is not idle ... ignored"); + return; + } [dat setLength: 0]; RELEASE(document); @@ -316,8 +319,11 @@ static void debugWrite(NSData *data) parser = [GSMimeParser new]; document = RETAIN([parser document]); [self beginLoadInBackground]; - [sock closeFile]; - DESTROY(sock); + if (sock != nil) + { + [sock closeFile]; + DESTROY(sock); + } contentLength = 0; if ([[request objectForKey: GSHTTPPropertyProxyHostKey] length] == 0) { diff --git a/Source/GSMime.m b/Source/GSMime.m index 93cfa1d46..bc9484cef 100644 --- a/Source/GSMime.m +++ b/Source/GSMime.m @@ -2077,10 +2077,12 @@ parseCharacterSet(NSString *token) - (BOOL) _unfoldHeader { - char c = 0; + char c; BOOL unwrappingComplete = NO; lineStart = lineEnd; + NSDebugMLLog(@"GSMime", @"entry: input:%u dataEnd:%u lineStart:%u '%*.*s'", + input, dataEnd, lineStart, dataEnd - input, dataEnd - input, &bytes[input]); /* * RFC822 lets header fields break across lines, with continuation * lines beginning with whitespace. This is called folding - and the @@ -2099,7 +2101,7 @@ parseCharacterSet(NSString *token) } if (pos == dataEnd) { - return NO; /* need more data */ + break; /* need more data */ } pos++; if (c == '\r' && pos < dataEnd && bytes[pos] == '\n') @@ -2108,7 +2110,7 @@ parseCharacterSet(NSString *token) } if (pos == dataEnd) { - return NO; /* need more data */ + break; /* need more data */ } /* * Copy data up to end of line, and skip past end. @@ -2163,6 +2165,9 @@ parseCharacterSet(NSString *token) } } } + NSDebugMLLog(@"GSMime", @"exit: inBody:%d unwrappingComplete: %d " + @"input:%u dataEnd:%u lineStart:%u '%*.*s'", inBody, unwrappingComplete, + input, dataEnd, lineStart, dataEnd - input, dataEnd - input, &bytes[input]); return unwrappingComplete; } @end