Ben Copsey

Fix issue with new encoding parsing code

All tests now pass on Mac and iPhone
... ... @@ -25,7 +25,11 @@
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
NSDate *d = [NSDate new];
#if TARGET_OS_IPHONE
NSValue *v = [NSValue valueWithCGRect:CGRectMake(0, 0, 200, 200)];
#else
NSValue *v = [NSValue valueWithRect:NSMakeRect(0, 0, 200, 200)];
#endif
[request setPostValue:@"foo" forKey:@"post_var"];
[request setPostValue:d forKey:@"post_var2"];
[request setPostValue:v forKey:@"post_var3"];
... ...
... ... @@ -593,11 +593,13 @@ static NSError *ASIUnableToCreateRequestError;
- (void)updateDownloadProgress
{
unsigned long long bytesReadSoFar = totalBytesRead;
// We won't update download progress until we've examined the headers, since we might need to authenticate
if (responseHeaders) {
unsigned long long bytesReadSoFar = totalBytesRead;
if (bytesReadSoFar > lastBytesRead) {
[self setLastActivityTime:[NSDate date]];
}
... ... @@ -774,8 +776,9 @@ static NSError *ASIUnableToCreateRequestError;
NSScanner *charsetScanner = [NSScanner scannerWithString: contentType];
NSString *IANAEncoding = nil;
if ([charsetScanner scanUpToString: charsetSeparator intoString: NULL])
if ([charsetScanner scanUpToString: charsetSeparator intoString: NULL] && [charsetScanner scanLocation] < [contentType length])
{
NSLog(@"%hi %hi",[charsetScanner scanLocation],[charsetSeparator length]);
[charsetScanner setScanLocation: [charsetScanner scanLocation] + [charsetSeparator length]];
[charsetScanner scanUpToString: @";" intoString: &IANAEncoding];
}
... ...
... ... @@ -166,7 +166,6 @@
BOOL success = [[NSString stringWithContentsOfURL:[NSURL fileURLWithPath:path]] isEqualToString:@"This is the expected content for the first string"];
GHAssertTrue(success,@"Failed to download data to a file");
}
... ... @@ -183,6 +182,12 @@
}
- (void)setProgress:(float)newProgress;
{
progress = newProgress;
}
- (void)testUploadProgress
{
progress = 0;
... ... @@ -196,11 +201,6 @@
}
- (void)setProgress:(float)newProgress;
{
progress = newProgress;
}
- (void)testCookies
... ...
This diff was suppressed by a .gitattributes entry.