OLD | NEW |
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 if (disposition == null) { | 81 if (disposition == null) { |
82 throw new HttpException( | 82 throw new HttpException( |
83 "Mime Multipart doesn't contain a Content-Disposition header value"); | 83 "Mime Multipart doesn't contain a Content-Disposition header value"); |
84 } | 84 } |
85 return new _HttpMultipartFormData(type, disposition, encoding, multipart); | 85 return new _HttpMultipartFormData(type, disposition, encoding, multipart); |
86 } | 86 } |
87 | 87 |
88 StreamSubscription listen(void onData(data), | 88 StreamSubscription listen(void onData(data), |
89 {void onDone(), | 89 {void onDone(), |
90 void onError(error), | 90 Function onError, |
91 bool cancelOnError}) { | 91 bool cancelOnError}) { |
92 return _stream.listen(onData, | 92 return _stream.listen(onData, |
93 onDone: onDone, | 93 onDone: onDone, |
94 onError: onError, | 94 onError: onError, |
95 cancelOnError: cancelOnError); | 95 cancelOnError: cancelOnError); |
96 } | 96 } |
97 | 97 |
98 String value(String name) { | 98 String value(String name) { |
99 return _mimeMultipart.headers[name]; | 99 return _mimeMultipart.headers[name]; |
100 } | 100 } |
(...skipping 28 matching lines...) Expand all Loading... |
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 } |
OLD | NEW |