| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 * [:dataReceived:] and [:dataEnd:] are not called in this case as | 190 * [:dataReceived:] and [:dataEnd:] are not called in this case as |
| 191 * there is no more HTTP data. After the upgrade the method | 191 * there is no more HTTP data. After the upgrade the method |
| 192 * [:readUnparsedData:] can be used to read any remaining bytes in the | 192 * [:readUnparsedData:] can be used to read any remaining bytes in the |
| 193 * HTTP parser which are part of the protocol the connection is | 193 * HTTP parser which are part of the protocol the connection is |
| 194 * upgrading to. These bytes cannot be processed by the HTTP parser | 194 * upgrading to. These bytes cannot be processed by the HTTP parser |
| 195 * and should be handled according to whatever protocol is being | 195 * and should be handled according to whatever protocol is being |
| 196 * upgraded to. | 196 * upgraded to. |
| 197 */ | 197 */ |
| 198 class _HttpParser | 198 class _HttpParser |
| 199 extends Stream<_HttpIncoming> | 199 extends Stream<_HttpIncoming> |
| 200 implements StreamConsumer<List<int>, _HttpParser> { | 200 implements StreamConsumer<List<int>> { |
| 201 | 201 |
| 202 factory _HttpParser.requestParser() { | 202 factory _HttpParser.requestParser() { |
| 203 return new _HttpParser._(true); | 203 return new _HttpParser._(true); |
| 204 } | 204 } |
| 205 | 205 |
| 206 factory _HttpParser.responseParser() { | 206 factory _HttpParser.responseParser() { |
| 207 return new _HttpParser._(false); | 207 return new _HttpParser._(false); |
| 208 } | 208 } |
| 209 | 209 |
| 210 _HttpParser._(this._requestParser) { | 210 _HttpParser._(this._requestParser) { |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 StreamController<_HttpIncoming> _controller; | 979 StreamController<_HttpIncoming> _controller; |
| 980 StreamController<List<int>> _bodyController; | 980 StreamController<List<int>> _bodyController; |
| 981 } | 981 } |
| 982 | 982 |
| 983 | 983 |
| 984 class HttpParserException implements Exception { | 984 class HttpParserException implements Exception { |
| 985 const HttpParserException([String this.message = ""]); | 985 const HttpParserException([String this.message = ""]); |
| 986 String toString() => "HttpParserException: $message"; | 986 String toString() => "HttpParserException: $message"; |
| 987 final String message; | 987 final String message; |
| 988 } | 988 } |
| OLD | NEW |