Fixing HTTPMultipartUpload.

The ending boundary for multipart must replace the last boundary, not added
after it.
Review URL: https://breakpad.appspot.com/390002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@965 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
qsr@chromium.org 2012-05-15 15:41:08 +00:00
parent bbc3789df1
commit d3ad7c4c99

View file

@ -32,6 +32,8 @@
@interface HTTPMultipartUpload(PrivateMethods) @interface HTTPMultipartUpload(PrivateMethods)
- (NSString *)multipartBoundary; - (NSString *)multipartBoundary;
// Each of the following methods will append the starting multipart boundary,
// but not the ending one.
- (NSData *)formDataForKey:(NSString *)key value:(NSString *)value; - (NSData *)formDataForKey:(NSString *)key value:(NSString *)value;
- (NSData *)formDataForFileContents:(NSData *)contents name:(NSString *)name; - (NSData *)formDataForFileContents:(NSData *)contents name:(NSString *)name;
- (NSData *)formDataForFile:(NSString *)file name:(NSString *)name; - (NSData *)formDataForFile:(NSString *)file name:(NSString *)name;
@ -67,11 +69,9 @@
NSString *fmt = @"--%@\r\nContent-Disposition: form-data; name=\"%@\"; " NSString *fmt = @"--%@\r\nContent-Disposition: form-data; name=\"%@\"; "
"filename=\"minidump.dmp\"\r\nContent-Type: application/octet-stream\r\n\r\n"; "filename=\"minidump.dmp\"\r\nContent-Type: application/octet-stream\r\n\r\n";
NSString *pre = [NSString stringWithFormat:fmt, boundary_, escaped]; NSString *pre = [NSString stringWithFormat:fmt, boundary_, escaped];
NSString *post = [NSString stringWithFormat:@"\r\n--%@\r\n", boundary_];
[data appendData:[pre dataUsingEncoding:NSUTF8StringEncoding]]; [data appendData:[pre dataUsingEncoding:NSUTF8StringEncoding]];
[data appendData:contents]; [data appendData:contents];
[data appendData:[post dataUsingEncoding:NSUTF8StringEncoding]];
return data; return data;
} }