Dominic Dagradi

resolve leaking file descriptors when included in a project with GC

@@ -1169,7 +1169,7 @@ static NSOperationQueue *sharedQueue = nil; @@ -1169,7 +1169,7 @@ static NSOperationQueue *sharedQueue = nil;
1169 } else { 1169 } else {
1170 [self setPostBodyReadStream:[ASIInputStream inputStreamWithFileAtPath:[self postBodyFilePath] request:self]]; 1170 [self setPostBodyReadStream:[ASIInputStream inputStreamWithFileAtPath:[self postBodyFilePath] request:self]];
1171 } 1171 }
1172 - [self setReadStream:[(NSInputStream *)CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream]) autorelease]]; 1172 + [self setReadStream:[(NSInputStream *)CFMakeCollectable(CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream])) autorelease]];
1173 } else { 1173 } else {
1174 1174
1175 // If we have a request body, we'll stream it from memory using our custom stream, so that we can measure bandwidth use and it can be bandwidth-throttled if necessary 1175 // If we have a request body, we'll stream it from memory using our custom stream, so that we can measure bandwidth use and it can be bandwidth-throttled if necessary
@@ -1179,10 +1179,10 @@ static NSOperationQueue *sharedQueue = nil; @@ -1179,10 +1179,10 @@ static NSOperationQueue *sharedQueue = nil;
1179 } else if ([self postBody]) { 1179 } else if ([self postBody]) {
1180 [self setPostBodyReadStream:[ASIInputStream inputStreamWithData:[self postBody] request:self]]; 1180 [self setPostBodyReadStream:[ASIInputStream inputStreamWithData:[self postBody] request:self]];
1181 } 1181 }
1182 - [self setReadStream:[(NSInputStream *)CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream]) autorelease]]; 1182 + [self setReadStream:[(NSInputStream *)CFMakeCollectable(CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream])) autorelease]];
1183 1183
1184 } else { 1184 } else {
1185 - [self setReadStream:[(NSInputStream *)CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request) autorelease]]; 1185 + [self setReadStream:[(NSInputStream *)CFMakeCollectable(CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request)) autorelease]];
1186 } 1186 }
1187 } 1187 }
1188 1188
@@ -2132,9 +2132,9 @@ static NSOperationQueue *sharedQueue = nil; @@ -2132,9 +2132,9 @@ static NSOperationQueue *sharedQueue = nil;
2132 } 2132 }
2133 #endif 2133 #endif
2134 2134
2135 - [self setResponseHeaders:[(NSDictionary *)CFHTTPMessageCopyAllHeaderFields(message) autorelease]]; 2135 + [self setResponseHeaders:[(NSDictionary *)CFMakeCollectable(CFHTTPMessageCopyAllHeaderFields(message)) autorelease]];
2136 [self setResponseStatusCode:(int)CFHTTPMessageGetResponseStatusCode(message)]; 2136 [self setResponseStatusCode:(int)CFHTTPMessageGetResponseStatusCode(message)];
2137 - [self setResponseStatusMessage:[(NSString *)CFHTTPMessageCopyResponseStatusLine(message) autorelease]]; 2137 + [self setResponseStatusMessage:[(NSString *)CFMakeCollectable(CFHTTPMessageCopyResponseStatusLine(message)) autorelease]];
2138 2138
2139 if ([self downloadCache] && ([[self downloadCache] canUseCachedDataForRequest:self])) { 2139 if ([self downloadCache] && ([[self downloadCache] canUseCachedDataForRequest:self])) {
2140 2140
@@ -2749,7 +2749,7 @@ static NSOperationQueue *sharedQueue = nil; @@ -2749,7 +2749,7 @@ static NSOperationQueue *sharedQueue = nil;
2749 CFHTTPMessageRef responseHeader = (CFHTTPMessageRef) CFReadStreamCopyProperty((CFReadStreamRef)[self readStream],kCFStreamPropertyHTTPResponseHeader); 2749 CFHTTPMessageRef responseHeader = (CFHTTPMessageRef) CFReadStreamCopyProperty((CFReadStreamRef)[self readStream],kCFStreamPropertyHTTPResponseHeader);
2750 proxyAuthentication = CFHTTPAuthenticationCreateFromResponse(NULL, responseHeader); 2750 proxyAuthentication = CFHTTPAuthenticationCreateFromResponse(NULL, responseHeader);
2751 CFRelease(responseHeader); 2751 CFRelease(responseHeader);
2752 - [self setProxyAuthenticationScheme:[(NSString *)CFHTTPAuthenticationCopyMethod(proxyAuthentication) autorelease]]; 2752 + [self setProxyAuthenticationScheme:[(NSString *)CFMakeCollectable(CFHTTPAuthenticationCopyMethod(proxyAuthentication)) autorelease]];
2753 } 2753 }
2754 2754
2755 // If we haven't got a CFHTTPAuthenticationRef by now, something is badly wrong, so we'll have to give up 2755 // If we haven't got a CFHTTPAuthenticationRef by now, something is badly wrong, so we'll have to give up
@@ -2762,7 +2762,7 @@ static NSOperationQueue *sharedQueue = nil; @@ -2762,7 +2762,7 @@ static NSOperationQueue *sharedQueue = nil;
2762 // Get the authentication realm 2762 // Get the authentication realm
2763 [self setProxyAuthenticationRealm:nil]; 2763 [self setProxyAuthenticationRealm:nil];
2764 if (!CFHTTPAuthenticationRequiresAccountDomain(proxyAuthentication)) { 2764 if (!CFHTTPAuthenticationRequiresAccountDomain(proxyAuthentication)) {
2765 - [self setProxyAuthenticationRealm:[(NSString *)CFHTTPAuthenticationCopyRealm(proxyAuthentication) autorelease]]; 2765 + [self setProxyAuthenticationRealm:[(NSString *)CFMakeCollectable(CFHTTPAuthenticationCopyRealm(proxyAuthentication)) autorelease]];
2766 } 2766 }
2767 2767
2768 // See if authentication is valid 2768 // See if authentication is valid
@@ -2926,7 +2926,7 @@ static NSOperationQueue *sharedQueue = nil; @@ -2926,7 +2926,7 @@ static NSOperationQueue *sharedQueue = nil;
2926 CFHTTPMessageRef responseHeader = (CFHTTPMessageRef) CFReadStreamCopyProperty((CFReadStreamRef)[self readStream],kCFStreamPropertyHTTPResponseHeader); 2926 CFHTTPMessageRef responseHeader = (CFHTTPMessageRef) CFReadStreamCopyProperty((CFReadStreamRef)[self readStream],kCFStreamPropertyHTTPResponseHeader);
2927 requestAuthentication = CFHTTPAuthenticationCreateFromResponse(NULL, responseHeader); 2927 requestAuthentication = CFHTTPAuthenticationCreateFromResponse(NULL, responseHeader);
2928 CFRelease(responseHeader); 2928 CFRelease(responseHeader);
2929 - [self setAuthenticationScheme:[(NSString *)CFHTTPAuthenticationCopyMethod(requestAuthentication) autorelease]]; 2929 + [self setAuthenticationScheme:[(NSString *)CFMakeCollectable(CFHTTPAuthenticationCopyMethod(requestAuthentication)) autorelease]];
2930 } 2930 }
2931 2931
2932 if (!requestAuthentication) { 2932 if (!requestAuthentication) {
@@ -2942,7 +2942,7 @@ static NSOperationQueue *sharedQueue = nil; @@ -2942,7 +2942,7 @@ static NSOperationQueue *sharedQueue = nil;
2942 // Get the authentication realm 2942 // Get the authentication realm
2943 [self setAuthenticationRealm:nil]; 2943 [self setAuthenticationRealm:nil];
2944 if (!CFHTTPAuthenticationRequiresAccountDomain(requestAuthentication)) { 2944 if (!CFHTTPAuthenticationRequiresAccountDomain(requestAuthentication)) {
2945 - [self setAuthenticationRealm:[(NSString *)CFHTTPAuthenticationCopyRealm(requestAuthentication) autorelease]]; 2945 + [self setAuthenticationRealm:[(NSString *)CFMakeCollectable(CFHTTPAuthenticationCopyRealm(requestAuthentication)) autorelease]];
2946 } 2946 }
2947 2947
2948 #if DEBUG_HTTP_AUTHENTICATION 2948 #if DEBUG_HTTP_AUTHENTICATION