Ben Copsey

Cleanups

@@ -55,12 +55,7 @@ @@ -55,12 +55,7 @@
55 // 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. 55 // 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.
56 NSString *stringBoundary = @"0xKhTmLbOuNdArY"; 56 NSString *stringBoundary = @"0xKhTmLbOuNdArY";
57 57
58 - //if ([fileData count] > 0) {  
59 - // We need to use multipart/form-data when using file upload  
60 [self addRequestHeader:@"Content-Type" value:[NSString stringWithFormat:@"multipart/form-data; boundary=%@",stringBoundary]]; 58 [self addRequestHeader:@"Content-Type" value:[NSString stringWithFormat:@"multipart/form-data; boundary=%@",stringBoundary]];
61 - //}  
62 -  
63 -  
64 59
65 [body appendData:[[NSString stringWithFormat:@"--%@\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; 60 [body appendData:[[NSString stringWithFormat:@"--%@\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
66 61
@@ -86,9 +81,7 @@ @@ -86,9 +81,7 @@
86 NSString *filePath = [fileData objectForKey:key]; 81 NSString *filePath = [fileData objectForKey:key];
87 [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n",key,[filePath lastPathComponent]] dataUsingEncoding:NSUTF8StringEncoding]]; 82 [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n",key,[filePath lastPathComponent]] dataUsingEncoding:NSUTF8StringEncoding]];
88 [body appendData:contentTypeHeader]; 83 [body appendData:contentTypeHeader];
89 - //[body appendData: [NSData dataWithContentsOfFile:filePath options:NSUncachedRead error:NULL]]; 84 + [body appendData: [NSData dataWithContentsOfFile:filePath options:NSUncachedRead error:NULL]];
90 - //[body appendData:[NSData dataWithContentsOfMappedFile:filePath]];  
91 - [body appendData:[NSData dataWithContentsOfFile:filePath]];  
92 i++; 85 i++;
93 // Only add the boundary if this is not the last item in the post body 86 // Only add the boundary if this is not the last item in the post body
94 if (i != [fileData count]) { 87 if (i != [fileData count]) {
@@ -139,8 +139,10 @@ @@ -139,8 +139,10 @@
139 // Also see the comments in ASINetworkQueue.h 139 // Also see the comments in ASINetworkQueue.h
140 BOOL showAccurateProgress; 140 BOOL showAccurateProgress;
141 141
  142 + //Used to ensure the progress indicator is only incremented once when showAccurateProgress = NO
142 BOOL updatedProgress; 143 BOOL updatedProgress;
143 144
  145 + //Prevents the body of the post being built more than once (largely for subclasses)
144 BOOL haveBuiltPostBody; 146 BOOL haveBuiltPostBody;
145 } 147 }
146 148
@@ -160,9 +162,6 @@ @@ -160,9 +162,6 @@
160 162
161 - (BOOL)isFinished; //Same thing, for NSOperationQueues to read 163 - (BOOL)isFinished; //Same thing, for NSOperationQueues to read
162 164
163 -// Get total amount of data received so far for this request  
164 -- (int)totalBytesRead;  
165 -  
166 // Returns the contents of the result as an NSString (not appropriate for binary data!) 165 // Returns the contents of the result as an NSString (not appropriate for binary data!)
167 - (NSString *)dataString; 166 - (NSString *)dataString;
168 167
@@ -285,4 +284,5 @@ @@ -285,4 +284,5 @@
285 @property (assign) BOOL useCachedContentLength; 284 @property (assign) BOOL useCachedContentLength;
286 @property (retain) ASIHTTPRequest *mainRequest; 285 @property (retain) ASIHTTPRequest *mainRequest;
287 @property (assign) BOOL showAccurateProgress; 286 @property (assign) BOOL showAccurateProgress;
  287 +@property (assign,readonly) unsigned int totalBytesRead;
288 @end 288 @end