From 884786890f31df21d5cf996ad866ae0a554af36d Mon Sep 17 00:00:00 2001 From: hs1512 Date: Tue, 22 Oct 2013 00:29:31 +0900 Subject: [PATCH 1/5] Update ASIHTTPRequest.m Don't move temp path to destination path when temp path equals destination. --- Classes/ASIHTTPRequest.m | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/Classes/ASIHTTPRequest.m b/Classes/ASIHTTPRequest.m index 31756d2b..9617bdf4 100644 --- a/Classes/ASIHTTPRequest.m +++ b/Classes/ASIHTTPRequest.m @@ -10,7 +10,7 @@ // Portions are based on the ImageClient example from Apple: // See: http://developer.apple.com/samplecode/ImageClient/listing37.html -#import "ASIHTTPRequest.h" +#import "ASIHTTPRequest.h"if (![[self class] removeFileAtPath:[self downloadDestinationPath] error:&moveError]) { #if TARGET_OS_IPHONE #import "Reachability.h" @@ -3458,22 +3458,25 @@ - (void)handleStreamComplete } else { - //Remove any file at the destination path - NSError *moveError = nil; - if (![[self class] removeFileAtPath:[self downloadDestinationPath] error:&moveError]) { - fileError = moveError; - - } - - //Move the temporary file to the destination path - if (!fileError) { - [[[[NSFileManager alloc] init] autorelease] moveItemAtPath:[self temporaryFileDownloadPath] toPath:[self downloadDestinationPath] error:&moveError]; - if (moveError) { - fileError = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASIFileManagementError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Failed to move file from '%@' to '%@'",[self temporaryFileDownloadPath],[self downloadDestinationPath]],NSLocalizedDescriptionKey,moveError,NSUnderlyingErrorKey,nil]]; + //James Jeong edited. + if (![[self temporaryFileDownloadPath] isEqualToString:[self downloadDestinationPath]]) { + //Remove any file at the destination path + NSError *moveError = nil; + if (![[self class] removeFileAtPath:[self downloadDestinationPath] error:&moveError]) { + fileError = moveError; + + } + + //Move the temporary file to the destination path + if (!fileError) { + [[[[NSFileManager alloc] init] autorelease] moveItemAtPath:[self temporaryFileDownloadPath] toPath:[self downloadDestinationPath] error:&moveError]; + if (moveError) { + fileError = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASIFileManagementError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Failed to move file from '%@' to '%@'",[self temporaryFileDownloadPath],[self downloadDestinationPath]],NSLocalizedDescriptionKey,moveError,NSUnderlyingErrorKey,nil]]; + } + //[self setTemporaryFileDownloadPath:nil]; } - [self setTemporaryFileDownloadPath:nil]; } - + [self setTemporaryFileDownloadPath:nil]; } } From 0f10a0797caede68618a2f321f16fd55131d70a3 Mon Sep 17 00:00:00 2001 From: hs1512 Date: Tue, 22 Oct 2013 11:49:30 +0900 Subject: [PATCH 2/5] Create asi-http-request.podspec --- asi-http-request.podspec | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 asi-http-request.podspec diff --git a/asi-http-request.podspec b/asi-http-request.podspec new file mode 100644 index 00000000..8c9aef1a --- /dev/null +++ b/asi-http-request.podspec @@ -0,0 +1,45 @@ +Pod::Spec.new do |s| + s.name = 'ASIHTTPRequest' + s.version = '1.8.1' + s.summary = 'Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone.' + s.homepage = 'http://allseeing-i.com/ASIHTTPRequest' + s.author = { 'Ben Copsey' => 'ben@allseeing-i.com' } + s.license = 'New BSD License' + s.source = { :git => 'https://github.com/hs1512/asi-http-request', :tag => 'v1.8.1' } + + s.description = %{ + ASIHTTPRequest is an easy to use wrapper around the CFNetwork API that + makes some of the more tedious aspects of communicating with web servers + easier. It is written in Objective-C and works in both Mac OS X and iPhone + applications. + + It is suitable performing basic HTTP requests and interacting with + REST-based services (GET / POST / PUT / DELETE). The included + ASIFormDataRequest subclass makes it easy to submit POST data and files + using multipart/form-data. + } + + s.source_files = 'Classes' + + s.ios.dependency 'Reachability' #, '~> 2.0', '>= 2.0.4' + s.ios.frameworks = 'MobileCoreServices', 'CFNetwork', 'CoreGraphics' + + s.osx.exclude_files = '**/*ASIAuthenticationDialog*' + s.osx.frameworks = 'SystemConfiguration', 'CoreServices' + + s.library = 'z.1' + + s.subspec 'ASIWebPageRequest' do |ws| + ws.source_files = 'Classes/ASIWebPageRequest/' + ws.library = 'xml2.2' + ws.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(SDKROOT)/usr/include/libxml2"' } + end + + s.subspec 'CloudFiles' do |cfs| + cfs.source_files = 'Classes/CloudFiles/' + end + + s.subspec 'S3' do |s3s| + s3s.source_files = 'Classes/S3/' + end +end From 6b0e970fa797936d680b905d00d87fde8f7d914e Mon Sep 17 00:00:00 2001 From: hs1512 Date: Tue, 22 Oct 2013 11:57:34 +0900 Subject: [PATCH 3/5] Delete asi-http-request.podspec --- asi-http-request.podspec | 45 ---------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 asi-http-request.podspec diff --git a/asi-http-request.podspec b/asi-http-request.podspec deleted file mode 100644 index 8c9aef1a..00000000 --- a/asi-http-request.podspec +++ /dev/null @@ -1,45 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'ASIHTTPRequest' - s.version = '1.8.1' - s.summary = 'Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone.' - s.homepage = 'http://allseeing-i.com/ASIHTTPRequest' - s.author = { 'Ben Copsey' => 'ben@allseeing-i.com' } - s.license = 'New BSD License' - s.source = { :git => 'https://github.com/hs1512/asi-http-request', :tag => 'v1.8.1' } - - s.description = %{ - ASIHTTPRequest is an easy to use wrapper around the CFNetwork API that - makes some of the more tedious aspects of communicating with web servers - easier. It is written in Objective-C and works in both Mac OS X and iPhone - applications. - - It is suitable performing basic HTTP requests and interacting with - REST-based services (GET / POST / PUT / DELETE). The included - ASIFormDataRequest subclass makes it easy to submit POST data and files - using multipart/form-data. - } - - s.source_files = 'Classes' - - s.ios.dependency 'Reachability' #, '~> 2.0', '>= 2.0.4' - s.ios.frameworks = 'MobileCoreServices', 'CFNetwork', 'CoreGraphics' - - s.osx.exclude_files = '**/*ASIAuthenticationDialog*' - s.osx.frameworks = 'SystemConfiguration', 'CoreServices' - - s.library = 'z.1' - - s.subspec 'ASIWebPageRequest' do |ws| - ws.source_files = 'Classes/ASIWebPageRequest/' - ws.library = 'xml2.2' - ws.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(SDKROOT)/usr/include/libxml2"' } - end - - s.subspec 'CloudFiles' do |cfs| - cfs.source_files = 'Classes/CloudFiles/' - end - - s.subspec 'S3' do |s3s| - s3s.source_files = 'Classes/S3/' - end -end From 34bdc492ae16129897c1f5e12eb026d7a2360005 Mon Sep 17 00:00:00 2001 From: hs1512 Date: Tue, 22 Oct 2013 11:57:56 +0900 Subject: [PATCH 4/5] Create ASIHTTPRequest.podspec --- ASIHTTPRequest.podspec | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 ASIHTTPRequest.podspec diff --git a/ASIHTTPRequest.podspec b/ASIHTTPRequest.podspec new file mode 100644 index 00000000..8c9aef1a --- /dev/null +++ b/ASIHTTPRequest.podspec @@ -0,0 +1,45 @@ +Pod::Spec.new do |s| + s.name = 'ASIHTTPRequest' + s.version = '1.8.1' + s.summary = 'Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone.' + s.homepage = 'http://allseeing-i.com/ASIHTTPRequest' + s.author = { 'Ben Copsey' => 'ben@allseeing-i.com' } + s.license = 'New BSD License' + s.source = { :git => 'https://github.com/hs1512/asi-http-request', :tag => 'v1.8.1' } + + s.description = %{ + ASIHTTPRequest is an easy to use wrapper around the CFNetwork API that + makes some of the more tedious aspects of communicating with web servers + easier. It is written in Objective-C and works in both Mac OS X and iPhone + applications. + + It is suitable performing basic HTTP requests and interacting with + REST-based services (GET / POST / PUT / DELETE). The included + ASIFormDataRequest subclass makes it easy to submit POST data and files + using multipart/form-data. + } + + s.source_files = 'Classes' + + s.ios.dependency 'Reachability' #, '~> 2.0', '>= 2.0.4' + s.ios.frameworks = 'MobileCoreServices', 'CFNetwork', 'CoreGraphics' + + s.osx.exclude_files = '**/*ASIAuthenticationDialog*' + s.osx.frameworks = 'SystemConfiguration', 'CoreServices' + + s.library = 'z.1' + + s.subspec 'ASIWebPageRequest' do |ws| + ws.source_files = 'Classes/ASIWebPageRequest/' + ws.library = 'xml2.2' + ws.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(SDKROOT)/usr/include/libxml2"' } + end + + s.subspec 'CloudFiles' do |cfs| + cfs.source_files = 'Classes/CloudFiles/' + end + + s.subspec 'S3' do |s3s| + s3s.source_files = 'Classes/S3/' + end +end From 793ebf93c03ce7f15eeb69313e4a75aada82ae15 Mon Sep 17 00:00:00 2001 From: hs1512 Date: Tue, 22 Oct 2013 11:58:26 +0900 Subject: [PATCH 5/5] Update ASIHTTPRequest.podspec --- ASIHTTPRequest.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ASIHTTPRequest.podspec b/ASIHTTPRequest.podspec index 8c9aef1a..ce7851e3 100644 --- a/ASIHTTPRequest.podspec +++ b/ASIHTTPRequest.podspec @@ -5,7 +5,7 @@ Pod::Spec.new do |s| s.homepage = 'http://allseeing-i.com/ASIHTTPRequest' s.author = { 'Ben Copsey' => 'ben@allseeing-i.com' } s.license = 'New BSD License' - s.source = { :git => 'https://github.com/hs1512/asi-http-request', :tag => 'v1.8.1' } + s.source = { :git => 'https://github.com/hs1512/ASIHTTPRequest', :tag => 'v1.8.1' } s.description = %{ ASIHTTPRequest is an easy to use wrapper around the CFNetwork API that