Showing
2 changed files
with
22 additions
and
7 deletions
| @@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
| 21 | #import "ASIInputStream.h" | 21 | #import "ASIInputStream.h" |
| 22 | 22 | ||
| 23 | // Automatically set on build | 23 | // Automatically set on build |
| 24 | -NSString *ASIHTTPRequestVersion = @"v1.5-36 2010-01-29"; | 24 | +NSString *ASIHTTPRequestVersion = @"v1.5-37 2010-01-29"; |
| 25 | 25 | ||
| 26 | NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain"; | 26 | NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain"; |
| 27 | 27 | ||
| @@ -1005,8 +1005,6 @@ static BOOL isiPhoneOS2; | @@ -1005,8 +1005,6 @@ static BOOL isiPhoneOS2; | ||
| 1005 | return; | 1005 | return; |
| 1006 | } | 1006 | } |
| 1007 | 1007 | ||
| 1008 | - | ||
| 1009 | - | ||
| 1010 | [[self cancelledLock] unlock]; | 1008 | [[self cancelledLock] unlock]; |
| 1011 | 1009 | ||
| 1012 | if (shouldResetProgressIndicators) { | 1010 | if (shouldResetProgressIndicators) { |
| @@ -1147,8 +1145,15 @@ static BOOL isiPhoneOS2; | @@ -1147,8 +1145,15 @@ static BOOL isiPhoneOS2; | ||
| 1147 | 1145 | ||
| 1148 | // Find out how much data we've uploaded so far | 1146 | // Find out how much data we've uploaded so far |
| 1149 | [self setTotalBytesSent:[[(NSNumber *)CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount) autorelease] unsignedLongLongValue]]; | 1147 | [self setTotalBytesSent:[[(NSNumber *)CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount) autorelease] unsignedLongLongValue]]; |
| 1150 | - [ASIHTTPRequest incrementBandwidthUsedInLastSecond:(unsigned long)(totalBytesSent-lastBytesSent)]; | 1148 | + if (totalBytesSent > lastBytesSent) { |
| 1151 | - | 1149 | + [ASIHTTPRequest incrementBandwidthUsedInLastSecond:(unsigned long)(totalBytesSent-lastBytesSent)]; |
| 1150 | + | ||
| 1151 | + #if DEBUG_REQUEST_STATUS | ||
| 1152 | + if ([self totalBytesSent] == [self postLength]) { | ||
| 1153 | + NSLog(@"Request %@ finished uploading data",self); | ||
| 1154 | + } | ||
| 1155 | + #endif | ||
| 1156 | + } | ||
| 1152 | } | 1157 | } |
| 1153 | 1158 | ||
| 1154 | [self updateProgressIndicators]; | 1159 | [self updateProgressIndicators]; |
| @@ -1608,7 +1613,13 @@ static BOOL isiPhoneOS2; | @@ -1608,7 +1613,13 @@ static BOOL isiPhoneOS2; | ||
| 1608 | return; | 1613 | return; |
| 1609 | } | 1614 | } |
| 1610 | if (CFHTTPMessageIsHeaderComplete(headers)) { | 1615 | if (CFHTTPMessageIsHeaderComplete(headers)) { |
| 1611 | - | 1616 | + |
| 1617 | +#if DEBUG_REQUEST_STATUS | ||
| 1618 | + if ([self totalBytesSent] == [self postLength]) { | ||
| 1619 | + NSLog(@"Request %@ received response headers",self); | ||
| 1620 | + } | ||
| 1621 | +#endif | ||
| 1622 | + | ||
| 1612 | CFDictionaryRef headerFields = CFHTTPMessageCopyAllHeaderFields(headers); | 1623 | CFDictionaryRef headerFields = CFHTTPMessageCopyAllHeaderFields(headers); |
| 1613 | [self setResponseHeaders:(NSDictionary *)headerFields]; | 1624 | [self setResponseHeaders:(NSDictionary *)headerFields]; |
| 1614 | 1625 | ||
| @@ -2473,6 +2484,10 @@ static BOOL isiPhoneOS2; | @@ -2473,6 +2484,10 @@ static BOOL isiPhoneOS2; | ||
| 2473 | 2484 | ||
| 2474 | - (void)handleStreamComplete | 2485 | - (void)handleStreamComplete |
| 2475 | { | 2486 | { |
| 2487 | +#if DEBUG_REQUEST_STATUS | ||
| 2488 | + NSLog(@"Request %@ finished downloading data",self); | ||
| 2489 | +#endif | ||
| 2490 | + | ||
| 2476 | if (![self responseHeaders]) { | 2491 | if (![self responseHeaders]) { |
| 2477 | [self readResponseHeaders]; | 2492 | [self readResponseHeaders]; |
| 2478 | } | 2493 | } |
| @@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
| 13 | 13 | ||
| 14 | // When set to 1 ASIHTTPRequests will print information about what a request is doing | 14 | // When set to 1 ASIHTTPRequests will print information about what a request is doing |
| 15 | #ifndef DEBUG_REQUEST_STATUS | 15 | #ifndef DEBUG_REQUEST_STATUS |
| 16 | - #define DEBUG_REQUEST_STATUS 0 | 16 | + #define DEBUG_REQUEST_STATUS 1 |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | // When set to 1, ASIFormDataRequests will print information about the request body to the console | 19 | // When set to 1, ASIFormDataRequests will print information about the request body to the console |
-
Please register or login to post a comment