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

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

Issue 756493002: pkg/http_server: move to multi-lib layout (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: readme fixup Created 6 years 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
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 library http_server.http_multipart_form_data_impl;
6 6
7 import 'dart:async';
8 import 'dart:convert';
9 import 'dart:io';
7 10
8 class _HttpMultipartFormData extends Stream implements HttpMultipartFormData { 11 import 'package:mime/mime.dart';
12
13 import 'http_multipart_form_data.dart';
14
15 class HttpMultipartFormDataImpl extends Stream
16 implements HttpMultipartFormData {
9 final ContentType contentType; 17 final ContentType contentType;
10 final HeaderValue contentDisposition; 18 final HeaderValue contentDisposition;
11 final HeaderValue contentTransferEncoding; 19 final HeaderValue contentTransferEncoding;
12 20
13 final MimeMultipart _mimeMultipart; 21 final MimeMultipart _mimeMultipart;
14 22
15 bool _isText = false; 23 bool _isText = false;
16 24
17 Stream _stream; 25 Stream _stream;
18 26
19 _HttpMultipartFormData(ContentType this.contentType, 27 HttpMultipartFormDataImpl(ContentType this.contentType,
20 HeaderValue this.contentDisposition, 28 HeaderValue this.contentDisposition,
21 HeaderValue this.contentTransferEncoding, 29 HeaderValue this.contentTransferEncoding,
22 MimeMultipart this._mimeMultipart, 30 MimeMultipart this._mimeMultipart,
23 Encoding defaultEncoding) { 31 Encoding defaultEncoding) {
24 _stream = _mimeMultipart; 32 _stream = _mimeMultipart;
25 if (contentTransferEncoding != null) { 33 if (contentTransferEncoding != null) {
26 // TODO(ajohnsen): Support BASE64, etc. 34 // TODO(ajohnsen): Support BASE64, etc.
27 throw new HttpException("Unsupported contentTransferEncoding: " 35 throw new HttpException("Unsupported contentTransferEncoding: "
28 "${contentTransferEncoding.value}"); 36 "${contentTransferEncoding.value}");
29 } 37 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 75
68 default: 76 default:
69 remaining[key] = multipart.headers[key]; 77 remaining[key] = multipart.headers[key];
70 break; 78 break;
71 } 79 }
72 } 80 }
73 if (disposition == null) { 81 if (disposition == null) {
74 throw new HttpException( 82 throw new HttpException(
75 "Mime Multipart doesn't contain a Content-Disposition header value"); 83 "Mime Multipart doesn't contain a Content-Disposition header value");
76 } 84 }
77 return new _HttpMultipartFormData( 85 return new HttpMultipartFormDataImpl(
78 type, disposition, encoding, multipart, defaultEncoding); 86 type, disposition, encoding, multipart, defaultEncoding);
79 } 87 }
80 88
81 StreamSubscription listen(void onData(data), 89 StreamSubscription listen(void onData(data),
82 {void onDone(), 90 {void onDone(),
83 Function onError, 91 Function onError,
84 bool cancelOnError}) { 92 bool cancelOnError}) {
85 return _stream.listen(onData, 93 return _stream.listen(onData,
86 onDone: onDone, 94 onDone: onDone,
87 onError: onError, 95 onError: onError,
88 cancelOnError: cancelOnError); 96 cancelOnError: cancelOnError);
89 } 97 }
90 98
91 String value(String name) { 99 String value(String name) {
92 return _mimeMultipart.headers[name]; 100 return _mimeMultipart.headers[name];
93 } 101 }
94 } 102 }
OLDNEW
« no previous file with comments | « pkg/http_server/lib/src/http_multipart_form_data.dart ('k') | pkg/http_server/lib/src/virtual_directory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698