diff --git a/Core/HTTPConnection.m b/Core/HTTPConnection.m index d4ac82f5..32810c08 100644 --- a/Core/HTTPConnection.m +++ b/Core/HTTPConnection.m @@ -18,7 +18,7 @@ // Log levels: off, error, warn, info, verbose // Other flags: trace -static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE; +static const int httpLogLevel = HTTP_LOG_LEVEL_WARN | HTTP_LOG_LEVEL_VERBOSE; // | HTTP_LOG_FLAG_TRACE; // Define chunk size used to read in data for responses // This is how much data will be read from disk into RAM at a time diff --git a/Core/HTTPMessage.h b/Core/HTTPMessage.h index 20ea921c..f90bf5a3 100644 --- a/Core/HTTPMessage.h +++ b/Core/HTTPMessage.h @@ -18,6 +18,8 @@ CFHTTPMessageRef message; } +@property(nonatomic, assign, readonly) CFHTTPMessageRef message; + - (id)initEmptyRequest; - (id)initRequestWithMethod:(NSString *)method URL:(NSURL *)url version:(NSString *)version; diff --git a/Core/HTTPMessage.m b/Core/HTTPMessage.m index e2c7e007..6888a4e6 100644 --- a/Core/HTTPMessage.m +++ b/Core/HTTPMessage.m @@ -7,6 +7,10 @@ @implementation HTTPMessage +- (CFHTTPMessageRef) message { + return message; +} + - (id)initEmptyRequest { if ((self = [super init])) diff --git a/Core/Mime/MultipartFormDataParser.m b/Core/Mime/MultipartFormDataParser.m index 4a19aee5..87bfa1f3 100644 --- a/Core/Mime/MultipartFormDataParser.m +++ b/Core/Mime/MultipartFormDataParser.m @@ -14,7 +14,7 @@ #ifdef __x86_64__ #define FMTNSINT "li" #else -#define FMTNSINT "i" +#define FMTNSINT "lu" #endif @@ -29,7 +29,7 @@ + (NSData*) decodedDataFromData:(NSData*) data encoding:(int) encoding; - (int) findHeaderEnd:(NSData*) workingData fromOffset:(int) offset; - (int) findContentEnd:(NSData*) data fromOffset:(int) offset; -- (int) numberOfBytesToLeavePendingWithData:(NSData*) data length:(NSUInteger) length encoding:(int) encoding; +- (int) numberOfBytesToLeavePendingWithData:(NSData*) data length:(int) length encoding:(int) encoding; - (int) offsetTillNewlineSinceOffset:(int) offset inData:(NSData*) data; - (int) processPreamble:(NSData*) workingData; @@ -247,7 +247,7 @@ - (BOOL) appendData:(NSData *)data { NSUInteger sizeToPass = workingData.length - offset - sizeToLeavePending; // if we parse BASE64 encoded data, or Quoted-Printable data, we will make sure we don't break the format - int leaveTrailing = [self numberOfBytesToLeavePendingWithData:data length:sizeToPass encoding:currentEncoding]; + int leaveTrailing = [self numberOfBytesToLeavePendingWithData:data length:(int)sizeToPass encoding:currentEncoding]; sizeToPass -= leaveTrailing; if( sizeToPass <= 0 ) { @@ -261,7 +261,7 @@ - (BOOL) appendData:(NSData *)data { NSData* decodedData = [MultipartFormDataParser decodedDataFromData:[NSData dataWithBytesNoCopy:(char*)workingData.bytes + offset length:workingData.length - offset - sizeToLeavePending freeWhenDone:NO] encoding:currentEncoding]; if( [delegate respondsToSelector:@selector(processContent:WithHeader:)] ) { - HTTPLogVerbose(@"MultipartFormDataParser: Processed %"FMTNSINT" bytes of body",sizeToPass); + HTTPLogVerbose(@"MultipartFormDataParser: Processed %"FMTNSINT" bytes of body",(unsigned long)sizeToPass); [delegate processContent: decodedData WithHeader:currentHeader]; } diff --git a/Core/WebSocket.m b/Core/WebSocket.m index 9051ac3e..58911a95 100644 --- a/Core/WebSocket.m +++ b/Core/WebSocket.m @@ -11,7 +11,7 @@ // Log levels: off, error, warn, info, verbose // Other flags : trace -static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE; +static const int httpLogLevel = HTTP_LOG_LEVEL_WARN | HTTP_LOG_LEVEL_VERBOSE; // | HTTP_LOG_FLAG_TRACE; #define TIMEOUT_NONE -1 #define TIMEOUT_REQUEST_BODY 10 @@ -36,10 +36,10 @@ #define WS_OP_PING 9 #define WS_OP_PONG 10 -static inline BOOL WS_OP_IS_FINAL_FRAGMENT(UInt8 frame) -{ - return (frame & 0x80) ? YES : NO; -} +//static inline BOOL WS_OP_IS_FINAL_FRAGMENT(UInt8 frame) +//{ +// return (frame & 0x80) ? YES : NO; +//} static inline BOOL WS_PAYLOAD_IS_MASKED(UInt8 frame) { diff --git a/Vendor/CocoaAsyncSocket/GCDAsyncSocket.m b/Vendor/CocoaAsyncSocket/GCDAsyncSocket.m index 1ecc94af..7cc651b5 100644 --- a/Vendor/CocoaAsyncSocket/GCDAsyncSocket.m +++ b/Vendor/CocoaAsyncSocket/GCDAsyncSocket.m @@ -5865,7 +5865,8 @@ - (void)maybeStartTLS NSDictionary *tlsSettings = tlsPacket->tlsSettings; NSNumber *value; - + +#ifndef __IPHONE_4_0 value = [tlsSettings objectForKey:(NSString *)kCFStreamSSLAllowsAnyRoot]; if (value && [value boolValue] == YES) canUseSecureTransport = NO; @@ -5873,14 +5874,17 @@ - (void)maybeStartTLS value = [tlsSettings objectForKey:(NSString *)kCFStreamSSLAllowsExpiredRoots]; if (value && [value boolValue] == YES) canUseSecureTransport = NO; - +#endif + value = [tlsSettings objectForKey:(NSString *)kCFStreamSSLValidatesCertificateChain]; if (value && [value boolValue] == NO) canUseSecureTransport = NO; - + +#ifndef __IPHONE_4_0 value = [tlsSettings objectForKey:(NSString *)kCFStreamSSLAllowsExpiredCertificates]; if (value && [value boolValue] == YES) canUseSecureTransport = NO; +#endif } #endif @@ -6230,6 +6234,7 @@ - (void)ssl_startTLS // 2. kCFStreamSSLAllowsAnyRoot +#ifndef __IPHONE_4_0 value = [tlsSettings objectForKey:(NSString *)kCFStreamSSLAllowsAnyRoot]; if (value) { @@ -6248,9 +6253,11 @@ - (void)ssl_startTLS #endif } - +#endif + // 3. kCFStreamSSLAllowsExpiredRoots +#ifndef __IPHONE_4_0 value = [tlsSettings objectForKey:(NSString *)kCFStreamSSLAllowsExpiredRoots]; if (value) { @@ -6269,7 +6276,8 @@ - (void)ssl_startTLS #endif } - +#endif + // 4. kCFStreamSSLValidatesCertificateChain value = [tlsSettings objectForKey:(NSString *)kCFStreamSSLValidatesCertificateChain]; @@ -6292,7 +6300,7 @@ - (void)ssl_startTLS } // 5. kCFStreamSSLAllowsExpiredCertificates - +#ifndef __IPHONE_4_0 value = [tlsSettings objectForKey:(NSString *)kCFStreamSSLAllowsExpiredCertificates]; if (value) { @@ -6311,7 +6319,8 @@ - (void)ssl_startTLS #endif } - +#endif + // 6. kCFStreamSSLCertificates value = [tlsSettings objectForKey:(NSString *)kCFStreamSSLCertificates]; @@ -6743,6 +6752,10 @@ + (void)cfstreamThread { @autoreleasepool LogInfo(@"CFStreamThread: Stopped"); }} ++ (void) doNothingAtAll:(id)sender { + NSAssert(NO, @"Never go here."); +} + + (void)scheduleCFStreams:(GCDAsyncSocket *)asyncSocket { LogTrace(); diff --git a/Vendor/CocoaLumberjack/DDTTYLogger.m b/Vendor/CocoaLumberjack/DDTTYLogger.m index 2906463c..d566be03 100755 --- a/Vendor/CocoaLumberjack/DDTTYLogger.m +++ b/Vendor/CocoaLumberjack/DDTTYLogger.m @@ -685,7 +685,7 @@ + (void)getRed:(CGFloat *)rPtr green:(CGFloat *)gPtr blue:(CGFloat *)bPtr fromCo CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB(); unsigned char pixel[4]; - CGContextRef context = CGBitmapContextCreate(&pixel, 1, 1, 8, 4, rgbColorSpace, kCGImageAlphaNoneSkipLast); + CGContextRef context = CGBitmapContextCreate(&pixel, 1, 1, 8, 4, rgbColorSpace, kCGBitmapAlphaInfoMask); CGContextSetFillColorWithColor(context, [color CGColor]); CGContextFillRect(context, CGRectMake(0, 0, 1, 1));