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

Side by Side Diff: pkg/http_server/lib/src/http_multipart_form_data_impl.dart

Issue 22872012: Remove Encoding-enum from dart:io and add interface in dart:convert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo. Created 7 years, 3 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 | « pkg/http_server/lib/src/http_body_impl.dart ('k') | pkg/http_server/test/http_body_test.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 part of http_server; 5 part of http_server;
6 6
7 7
8 class _HttpMultipartFormData extends Stream implements HttpMultipartFormData { 8 class _HttpMultipartFormData extends Stream implements HttpMultipartFormData {
9 final ContentType contentType; 9 final ContentType contentType;
10 final HeaderValue contentDisposition; 10 final HeaderValue contentDisposition;
(...skipping 16 matching lines...) Expand all
27 "${contentTransferEncoding.value}"); 27 "${contentTransferEncoding.value}");
28 } 28 }
29 29
30 if (contentType == null || 30 if (contentType == null ||
31 contentType.primaryType == 'text' || 31 contentType.primaryType == 'text' ||
32 contentType.mimeType == 'application/json') { 32 contentType.mimeType == 'application/json') {
33 _isText = true; 33 _isText = true;
34 StringBuffer buffer = new StringBuffer(); 34 StringBuffer buffer = new StringBuffer();
35 Encoding encoding; 35 Encoding encoding;
36 if (contentType != null) { 36 if (contentType != null) {
37 encoding = Encoding.fromName(contentType.charset); 37 encoding = Encoding.getByName(contentType.charset);
38 } 38 }
39 if (encoding == null) encoding = Encoding.ISO_8859_1; 39 if (encoding == null) encoding = LATIN1;
40 _stream = _stream 40 _stream = _stream
41 .transform(new StringDecoder(encoding)) 41 .transform(encoding.decoder)
42 .expand((data) { 42 .expand((data) {
43 buffer.write(data); 43 buffer.write(data);
44 var out = _decodeHttpEntityString(buffer.toString()); 44 var out = _decodeHttpEntityString(buffer.toString());
45 if (out != null) { 45 if (out != null) {
46 buffer.clear(); 46 buffer.clear();
47 return [out]; 47 return [out];
48 } 48 }
49 return const []; 49 return const [];
50 }); 50 });
51 } 51 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 while ((amp = input.indexOf('&', offset)) >= 0) { 129 while ((amp = input.indexOf('&', offset)) >= 0) {
130 buffer.write(input.substring(offset, amp)); 130 buffer.write(input.substring(offset, amp));
131 int end = input.indexOf(';', amp); 131 int end = input.indexOf(';', amp);
132 parse(amp, end); 132 parse(amp, end);
133 offset = end + 1; 133 offset = end + 1;
134 } 134 }
135 buffer.write(input.substring(offset)); 135 buffer.write(input.substring(offset));
136 return buffer.toString(); 136 return buffer.toString();
137 } 137 }
138 } 138 }
OLDNEW
« no previous file with comments | « pkg/http_server/lib/src/http_body_impl.dart ('k') | pkg/http_server/test/http_body_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698