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

Side by Side Diff: pkg/http/lib/src/multipart_request.dart

Issue 11975017: Stop treating StreamController as a Stream. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/http/lib/src/streamed_request.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library multipart_request; 5 library multipart_request;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:math'; 9 import 'dart:math';
10 import 'dart:uri'; 10 import 'dart:uri';
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 writeAscii(_headerForFile(file)); 116 writeAscii(_headerForFile(file));
117 return writeStreamToSink(file.finalize(), controller) 117 return writeStreamToSink(file.finalize(), controller)
118 .then((_) => writeLine()); 118 .then((_) => writeLine());
119 }).then((_) { 119 }).then((_) {
120 // TODO(nweiz): pass any errors propagated through this future on to 120 // TODO(nweiz): pass any errors propagated through this future on to
121 // the stream. See issue 3657. 121 // the stream. See issue 3657.
122 writeAscii('--$boundary--\r\n'); 122 writeAscii('--$boundary--\r\n');
123 controller.close(); 123 controller.close();
124 }); 124 });
125 125
126 return new ByteStream(controller); 126 return new ByteStream(controller.stream);
127 } 127 }
128 128
129 /// All character codes that are valid in multipart boundaries. From 129 /// All character codes that are valid in multipart boundaries. From
130 /// http://tools.ietf.org/html/rfc2046#section-5.1.1. 130 /// http://tools.ietf.org/html/rfc2046#section-5.1.1.
131 static final List<int> _BOUNDARY_CHARACTERS = const <int>[ 131 static final List<int> _BOUNDARY_CHARACTERS = const <int>[
132 39, 40, 41, 43, 95, 44, 45, 46, 47, 58, 61, 63, 48, 49, 50, 51, 52, 53, 54, 132 39, 40, 41, 43, 95, 44, 45, 46, 47, 58, 61, 63, 48, 49, 50, 51, 52, 53, 54,
133 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 133 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
134 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 134 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103,
135 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 135 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
136 119, 120, 121, 122 136 119, 120, 121, 122
(...skipping 29 matching lines...) Expand all
166 String _boundaryString(int length) { 166 String _boundaryString(int length) {
167 var prefix = "dart-http-boundary-"; 167 var prefix = "dart-http-boundary-";
168 var list = new List<int>.fixedLength(length - prefix.length); 168 var list = new List<int>.fixedLength(length - prefix.length);
169 for (var i = 0; i < list.length; i++) { 169 for (var i = 0; i < list.length; i++) {
170 list[i] = _BOUNDARY_CHARACTERS[ 170 list[i] = _BOUNDARY_CHARACTERS[
171 _random.nextInt(_BOUNDARY_CHARACTERS.length)]; 171 _random.nextInt(_BOUNDARY_CHARACTERS.length)];
172 } 172 }
173 return "$prefix${new String.fromCharCodes(list)}"; 173 return "$prefix${new String.fromCharCodes(list)}";
174 } 174 }
175 } 175 }
OLDNEW
« no previous file with comments | « no previous file | pkg/http/lib/src/streamed_request.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698