Ben Copsey

Fix some issues with progress create by last changeset

... ... @@ -398,17 +398,15 @@ static NSError *ASIUnableToCreateRequestError;
lastBytesRead = 0;
// If we're retrying a request after an authentication failure, let's remove any progress we made
if (lastBytesSent > 0 && uploadProgressDelegate) {
if (lastBytesSent > 0) {
[self removeUploadProgressSoFar];
}
lastBytesSent = 0;
if (shouldResetProgressIndicators) {
contentLength = 0;
if (downloadProgressDelegate) {
[self resetDownloadProgress:0];
}
}
[self setResponseHeaders:nil];
if (![self downloadDestinationPath]) {
[self setRawResponseData:[[[NSMutableData alloc] init] autorelease]];
... ... @@ -633,17 +631,6 @@ static NSError *ASIUnableToCreateRequestError;
{
[progressLock lock];
//We're using a progress queue or compatible controller to handle progress
SEL selector = @selector(incrementUploadSizeBy:);
if ([queue respondsToSelector:selector]) {
NSMethodSignature *signature = [[queue class] instanceMethodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setTarget:queue];
[invocation setSelector:selector];
[invocation setArgument:&value atIndex:2];
[invocation invoke];
}
// Request this request's own upload progress delegate
if (uploadProgressDelegate) {
[ASIHTTPRequest setProgress:0 forProgressIndicator:uploadProgressDelegate];
... ...
... ... @@ -137,6 +137,7 @@
//Tell the request not to reset the progress indicator when it gets a content-length, as we will get the length from the HEAD request
[request setShouldResetProgressIndicators:NO];
[request addDependency:HEADRequest];
// If we want to track uploading for this request accurately, we need to add the size of the post content to the total
... ... @@ -147,6 +148,7 @@
}
[request setShowAccurateProgress:showAccurateProgress];
[request setQueue:self];
[super addOperation:request];
}
... ...