Permalink
Browse files

Added lots of comments

Added missing setDownloadProgressDelegate to ASIHTTPRequest
  • Loading branch information...
1 parent 53e0ced commit 62f3a7a33ecbda6f72c12b9db66183943246e710 @pokeb committed Nov 9, 2008
Showing with 174 additions and 156 deletions.
  1. +4 −4 ASIFormDataRequest.h
  2. +6 −6 ASIFormDataRequest.m
  3. +5 −2 ASIHTTPRequest.h
  4. +93 −74 ASIHTTPRequest.m
  5. +0 −1 ASIHTTPRequestTests.h
  6. +0 −60 ASIHTTPRequestTests.m
  7. +22 −5 ASINetworkQueue.h
  8. +6 −1 ASINetworkQueue.m
  9. +38 −3 ASINetworkQueueTests.m
View
@@ -10,20 +10,20 @@
@interface ASIFormDataRequest : ASIHTTPRequest {
- //Parameters that will be POSTed to the url
+ // Parameters that will be POSTed to the url
NSMutableDictionary *postData;
- //Files that will be POSTed to the url
+ // Files that will be POSTed to the url
NSMutableDictionary *fileData;
}
#pragma mark setup request
-//Add a POST variable to the request
+// Add a POST variable to the request
- (void)setPostValue:(id)value forKey:(NSString *)key;
-//Add the contents of a local file as a POST variable to the request
+// Add the contents of a local file as a POST variable to the request
- (void)setFile:(NSString *)filePath forKey:(NSString *)key;
@end
View
@@ -61,19 +61,19 @@ - (void)main
NSMutableData *body = [[[NSMutableData alloc] init] autorelease];
- //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.
+ // 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
+ // 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]];
- //Adds post data
+ // Adds post data
NSData *endItemBoundary = [[NSString stringWithFormat:@"\r\n--%@\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding];
NSEnumerator *e = [postData keyEnumerator];
NSString *key;
@@ -87,7 +87,7 @@ - (void)main
}
}
- //Adds files to upload
+ // Adds files to upload
NSData *contentTypeHeader = [[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding];
e = [fileData keyEnumerator];
i=0;
@@ -97,14 +97,14 @@ - (void)main
[body appendData:contentTypeHeader];
[body appendData:[NSData dataWithContentsOfMappedFile:filePath]];
i++;
- if (i != [fileData count]) { //Only add the boundary if this is not the last item in the post body
+ // Only add the boundary if this is not the last item in the post body
+ if (i != [fileData count]) {
[body appendData:endItemBoundary];
}
}
[body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
- //Since we've got post data, let's set the post body to an empty NSMutableData object
[self setPostBody:body];
//Now we've created our post data, construct the request
View
@@ -163,8 +163,13 @@
- (void)updateUploadProgress;
- (void)resetDownloadProgress:(NSNumber *)max;
- (void)updateDownloadProgress;
+
+// Called when authorisation is needed, as we only find out we don't have permission to something when the upload is complete
- (void)removeUploadProgressSoFar;
+// Helper method for interacting with progress indicators to abstract the details of different APIS (NSProgressIndicator and UIProgressView)
++ (void)setProgress:(double)progress forProgressIndicator:(id)indicator;
+
#pragma mark handling request complete / failure
// Called when a request completes successfully - defaults to: @selector(requestFinished:)
@@ -228,8 +233,6 @@
// Dump all session data (authentication and cookies)
+ (void)clearSession;
-//Helper method for interacting with progress indicators to abstract the details of different APIS for cocoa and cocoa touch
-+ (void)setProgress:(double)progress forProgressIndicator:(id)indicator;
@property (retain) NSString *username;
@property (retain) NSString *password;
Oops, something went wrong.

0 comments on commit 62f3a7a

Please sign in to comment.