From 509a4dbeba6aeccbe967edc4e49cf1abc7ea7621 Mon Sep 17 00:00:00 2001 From: unordered Date: Wed, 7 Dec 2016 21:25:08 +0800 Subject: [PATCH 1/2] fix ios formdata boundary include slash --- Libraries/Network/RCTNetworking.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Network/RCTNetworking.mm b/Libraries/Network/RCTNetworking.mm index 70d2ede18e45ba..5e6be28ef57034 100644 --- a/Libraries/Network/RCTNetworking.mm +++ b/Libraries/Network/RCTNetworking.mm @@ -117,7 +117,7 @@ - (RCTURLRequestCancellationBlock)handleResult:(NSDictionary *)r // We've processed the last item. Finish and return. [_multipartBody appendData:[[NSString stringWithFormat:@"--%@--\r\n", _boundary] dataUsingEncoding:NSUTF8StringEncoding]]; - NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", _boundary]; + NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=\"%@\"", _boundary]; return _callback(nil, @{@"body": _multipartBody, @"contentType": contentType}); } From f29983d0a2a44e36ec8add1c4e3ba884b06b4fdb Mon Sep 17 00:00:00 2001 From: unordered Date: Thu, 8 Dec 2016 09:23:18 +0800 Subject: [PATCH 2/2] fix formdata boundary contains illegal character --- Libraries/Network/RCTNetworking.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/Network/RCTNetworking.mm b/Libraries/Network/RCTNetworking.mm index 5e6be28ef57034..a8aa11a62849cf 100644 --- a/Libraries/Network/RCTNetworking.mm +++ b/Libraries/Network/RCTNetworking.mm @@ -49,7 +49,7 @@ @implementation RCTHTTPFormDataHelper static NSString *RCTGenerateFormBoundary() { const size_t boundaryLength = 70; - const char *boundaryChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_./"; + const char *boundaryChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_."; char *bytes = (char*)malloc(boundaryLength); size_t charCount = strlen(boundaryChars); @@ -117,7 +117,7 @@ - (RCTURLRequestCancellationBlock)handleResult:(NSDictionary *)r // We've processed the last item. Finish and return. [_multipartBody appendData:[[NSString stringWithFormat:@"--%@--\r\n", _boundary] dataUsingEncoding:NSUTF8StringEncoding]]; - NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=\"%@\"", _boundary]; + NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", _boundary]; return _callback(nil, @{@"body": _multipartBody, @"contentType": contentType}); }