@@ -7,6 +7,7 @@ import 'dart:convert';
7
7
import 'dart:math' ;
8
8
9
9
import 'base_request.dart' ;
10
+ import 'boundary_characters.dart' ;
10
11
import 'byte_stream.dart' ;
11
12
import 'multipart_file.dart' ;
12
13
import 'utils.dart' ;
@@ -83,7 +84,7 @@ class MultipartRequest extends BaseRequest {
83
84
ByteStream finalize () {
84
85
// TODO(nweiz): freeze fields and files
85
86
var boundary = _boundaryString ();
86
- headers['content-type' ] = 'multipart/form-data; boundary=" $boundary " ' ;
87
+ headers['content-type' ] = 'multipart/form-data; boundary=$boundary ' ;
87
88
super .finalize ();
88
89
89
90
var controller = new StreamController <List <int >>(sync : true );
@@ -117,16 +118,6 @@ class MultipartRequest extends BaseRequest {
117
118
return new ByteStream (controller.stream);
118
119
}
119
120
120
- /// All character codes that are valid in multipart boundaries. From
121
- /// http://tools.ietf.org/html/rfc2046#section-5.1.1.
122
- static const List <int > _BOUNDARY_CHARACTERS = const < int > [
123
- 39 , 40 , 41 , 43 , 95 , 44 , 45 , 46 , 47 , 58 , 61 , 63 , 48 , 49 , 50 , 51 , 52 , 53 , 54 ,
124
- 55 , 56 , 57 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 ,
125
- 81 , 82 , 83 , 84 , 85 , 86 , 87 , 88 , 89 , 90 , 97 , 98 , 99 , 100 , 101 , 102 , 103 ,
126
- 104 , 105 , 106 , 107 , 108 , 109 , 110 , 111 , 112 , 113 , 114 , 115 , 116 , 117 , 118 ,
127
- 119 , 120 , 121 , 122
128
- ];
129
-
130
121
/// Returns the header string for a field. The return value is guaranteed to
131
122
/// contain only ASCII characters.
132
123
String _headerForField (String name, String value) {
@@ -167,7 +158,7 @@ class MultipartRequest extends BaseRequest {
167
158
var prefix = "dart-http-boundary-" ;
168
159
var list = new List <int >.generate (_BOUNDARY_LENGTH - prefix.length,
169
160
(index) =>
170
- _BOUNDARY_CHARACTERS [_random.nextInt (_BOUNDARY_CHARACTERS .length)],
161
+ BOUNDARY_CHARACTERS [_random.nextInt (BOUNDARY_CHARACTERS .length)],
171
162
growable: false );
172
163
return "$prefix ${new String .fromCharCodes (list )}" ;
173
164
}
0 commit comments