Skip to content

Commit e6d0ccc

Browse files
committed
Properly specify Content-Transfer-Encoding.
Closes #39 [email protected] Review URL: https://codereview.chromium.org//2125783003 .
1 parent 77d9e87 commit e6d0ccc

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.11.3+8
2+
3+
* Properly specify `Content-Transfer-Encoding` for multipart chunks.
4+
15
## 0.11.3+7
26

37
* Declare compatibility with `http_parser` 3.0.0.

lib/src/multipart_request.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ final _newlineRegExp = new RegExp(r"\r\n|\r|\n");
1818
/// [files].
1919
///
2020
/// This request automatically sets the Content-Type header to
21-
/// `multipart/form-data` and the Content-Transfer-Encoding header to `binary`.
22-
/// These values will override any values set by the user.
21+
/// `multipart/form-data`. This value will override any value set by the user.
2322
///
2423
/// var uri = Uri.parse("http://pub.dartlang.org/packages/create");
2524
/// var request = new http.MultipartRequest("POST", url);
@@ -85,7 +84,6 @@ class MultipartRequest extends BaseRequest {
8584
// TODO(nweiz): freeze fields and files
8685
var boundary = _boundaryString();
8786
headers['content-type'] = 'multipart/form-data; boundary="$boundary"';
88-
headers['content-transfer-encoding'] = 'binary';
8987
super.finalize();
9088

9189
var controller = new StreamController<List<int>>(sync: true);
@@ -135,7 +133,9 @@ class MultipartRequest extends BaseRequest {
135133
var header =
136134
'content-disposition: form-data; name="${_browserEncode(name)}"';
137135
if (!isPlainAscii(value)) {
138-
header = '$header\r\ncontent-type: text/plain; charset=utf-8';
136+
header = '$header\r\n'
137+
'content-type: text/plain; charset=utf-8\r\n'
138+
'content-transfer-encoding: binary\r\n';
139139
}
140140
return '$header\r\n\r\n';
141141
}

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: http
2-
version: 0.11.3+7
2+
version: 0.11.3+8
33
author: "Dart Team <[email protected]>"
44
homepage: https://github.com/dart-lang/http
55
description: A composable, Future-based API for making HTTP requests.

0 commit comments

Comments
 (0)