OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart.io; | 5 part of dart.io; |
6 | 6 |
7 // Global constants. | 7 // Global constants. |
8 class _Const { | 8 class _Const { |
9 // Bytes for "HTTP". | 9 // Bytes for "HTTP". |
10 static const HTTP = const [72, 84, 84, 80]; | 10 static const HTTP = const [72, 84, 84, 80]; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 _onData, | 224 _onData, |
225 onError: _onError, | 225 onError: _onError, |
226 onDone: () { | 226 onDone: () { |
227 completer.complete(this); | 227 completer.complete(this); |
228 }); | 228 }); |
229 return completer.future; | 229 return completer.future; |
230 } | 230 } |
231 | 231 |
232 Future<_HttpParser> close() { | 232 Future<_HttpParser> close() { |
233 _onDone(); | 233 _onDone(); |
234 return new Future.immediate(this); | 234 return new Future.value(this); |
235 } | 235 } |
236 | 236 |
237 // From RFC 2616. | 237 // From RFC 2616. |
238 // generic-message = start-line | 238 // generic-message = start-line |
239 // *(message-header CRLF) | 239 // *(message-header CRLF) |
240 // CRLF | 240 // CRLF |
241 // [ message-body ] | 241 // [ message-body ] |
242 // start-line = Request-Line | Status-Line | 242 // start-line = Request-Line | Status-Line |
243 // Request-Line = Method SP Request-URI SP HTTP-Version CRLF | 243 // Request-Line = Method SP Request-URI SP HTTP-Version CRLF |
244 // Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF | 244 // Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 StreamController<_HttpIncoming> _controller; | 958 StreamController<_HttpIncoming> _controller; |
959 StreamController<List<int>> _bodyController; | 959 StreamController<List<int>> _bodyController; |
960 } | 960 } |
961 | 961 |
962 | 962 |
963 class HttpParserException implements Exception { | 963 class HttpParserException implements Exception { |
964 const HttpParserException([String this.message = ""]); | 964 const HttpParserException([String this.message = ""]); |
965 String toString() => "HttpParserException: $message"; | 965 String toString() => "HttpParserException: $message"; |
966 final String message; | 966 final String message; |
967 } | 967 } |
OLD | NEW |