Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanups

  • Loading branch information...
commit 90cd6b9bee2498ee4d233c2737ecb6a23dd6b158 1 parent 54b83f7
Ben Copsey authored
Showing with 4 additions and 11 deletions.
  1. +1 −8 ASIFormDataRequest.m
  2. +3 −3 ASIHTTPRequest.h
9 ASIFormDataRequest.m
View
@@ -55,12 +55,7 @@ - (void)buildPostBody
// Set your own boundary string only if really obsessive. We don't bother to check if post data contains the boundary, since it's pretty unlikely that it does.
NSString *stringBoundary = @"0xKhTmLbOuNdArY";
- //if ([fileData count] > 0) {
- // We need to use multipart/form-data when using file upload
[self addRequestHeader:@"Content-Type" value:[NSString stringWithFormat:@"multipart/form-data; boundary=%@",stringBoundary]];
- //}
-
-
[body appendData:[[NSString stringWithFormat:@"--%@\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
@@ -86,9 +81,7 @@ - (void)buildPostBody
NSString *filePath = [fileData objectForKey:key];
[body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n",key,[filePath lastPathComponent]] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:contentTypeHeader];
- //[body appendData: [NSData dataWithContentsOfFile:filePath options:NSUncachedRead error:NULL]];
- //[body appendData:[NSData dataWithContentsOfMappedFile:filePath]];
- [body appendData:[NSData dataWithContentsOfFile:filePath]];
+ [body appendData: [NSData dataWithContentsOfFile:filePath options:NSUncachedRead error:NULL]];
i++;
// Only add the boundary if this is not the last item in the post body
if (i != [fileData count]) {
6 ASIHTTPRequest.h
View
@@ -139,8 +139,10 @@
// Also see the comments in ASINetworkQueue.h
BOOL showAccurateProgress;
+ //Used to ensure the progress indicator is only incremented once when showAccurateProgress = NO
BOOL updatedProgress;
+ //Prevents the body of the post being built more than once (largely for subclasses)
BOOL haveBuiltPostBody;
}
@@ -160,9 +162,6 @@
- (BOOL)isFinished; //Same thing, for NSOperationQueues to read
-// Get total amount of data received so far for this request
-- (int)totalBytesRead;
-
// Returns the contents of the result as an NSString (not appropriate for binary data!)
- (NSString *)dataString;
@@ -285,4 +284,5 @@
@property (assign) BOOL useCachedContentLength;
@property (retain) ASIHTTPRequest *mainRequest;
@property (assign) BOOL showAccurateProgress;
+@property (assign,readonly) unsigned int totalBytesRead;
@end
Please sign in to comment.
Something went wrong with that request. Please try again.