Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Unified Diff: lib/src/multipart_request.dart

Issue 2125783003: Properly specify Content-Transfer-Encoding. (Closed) Base URL: git@github.com:dart-lang/http@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/multipart_request.dart
diff --git a/lib/src/multipart_request.dart b/lib/src/multipart_request.dart
index f589eaaeef1b0cb4aee6551596247297e8d50fa6..9e145c72f2391262eaadd14b10dde26e5b69714f 100644
--- a/lib/src/multipart_request.dart
+++ b/lib/src/multipart_request.dart
@@ -18,8 +18,7 @@ final _newlineRegExp = new RegExp(r"\r\n|\r|\n");
/// [files].
///
/// This request automatically sets the Content-Type header to
-/// `multipart/form-data` and the Content-Transfer-Encoding header to `binary`.
-/// These values will override any values set by the user.
+/// `multipart/form-data`. This value will override any value set by the user.
///
/// var uri = Uri.parse("http://pub.dartlang.org/packages/create");
/// var request = new http.MultipartRequest("POST", url);
@@ -85,7 +84,6 @@ class MultipartRequest extends BaseRequest {
// TODO(nweiz): freeze fields and files
var boundary = _boundaryString();
headers['content-type'] = 'multipart/form-data; boundary="$boundary"';
- headers['content-transfer-encoding'] = 'binary';
super.finalize();
var controller = new StreamController<List<int>>(sync: true);
@@ -135,7 +133,9 @@ class MultipartRequest extends BaseRequest {
var header =
'content-disposition: form-data; name="${_browserEncode(name)}"';
if (!isPlainAscii(value)) {
- header = '$header\r\ncontent-type: text/plain; charset=utf-8';
+ header = '$header\r\n'
+ 'content-type: text/plain; charset=utf-8\r\n'
+ 'content-transfer-encoding: binary\r\n';
}
return '$header\r\n\r\n';
}
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698