Skip to content

Commit

Permalink
ASIFormDataRequests now use a UUID as part of the boundary for multip…
Browse files Browse the repository at this point in the history
…art/form-data
  • Loading branch information
pokeb committed Jun 4, 2011
1 parent 1fe1027 commit af5ac65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions Classes/ASIFormDataRequest.m
Expand Up @@ -221,8 +221,11 @@ - (void)buildMultipartFormDataPostBody

NSString *charset = (NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding([self stringEncoding]));

// 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";
// We don't bother to check if post data contains the boundary, since it's pretty unlikely that it does.
CFUUIDRef uuid = CFUUIDCreate(nil);
NSString *uuidString = [(NSString*)CFUUIDCreateString(nil, uuid) autorelease];
CFRelease(uuid);
NSString *stringBoundary = [NSString stringWithFormat:@"0xKhTmLbOuNdArY-%@",uuidString];

[self addRequestHeader:@"Content-Type" value:[NSString stringWithFormat:@"multipart/form-data; charset=%@; boundary=%@", charset, stringBoundary]];

Expand Down Expand Up @@ -329,7 +332,9 @@ - (void)appendPostDataFromFile:(NSString *)file

- (void)addToDebugBody:(NSString *)string
{
[self setDebugBodyString:[[self debugBodyString] stringByAppendingString:string]];
if (string) {
[self setDebugBodyString:[[self debugBodyString] stringByAppendingString:string]];
}
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion Classes/ASIHTTPRequest.m
Expand Up @@ -24,7 +24,7 @@
#import "ASIDataCompressor.h"

// Automatically set on build
NSString *ASIHTTPRequestVersion = @"v1.8.1 2011-06-04";
NSString *ASIHTTPRequestVersion = @"v1.8.1-2 2011-06-04";

static NSString *defaultUserAgent = nil;

Expand Down

0 comments on commit af5ac65

Please sign in to comment.