| 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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 var completer = _pauseCompleter; | 788 var completer = _pauseCompleter; |
| 789 _pauseCompleter = null; | 789 _pauseCompleter = null; |
| 790 return new _HttpDetachedIncoming(_socketSubscription, | 790 return new _HttpDetachedIncoming(_socketSubscription, |
| 791 readUnparsedData(), | 791 readUnparsedData(), |
| 792 completer); | 792 completer); |
| 793 } | 793 } |
| 794 | 794 |
| 795 List<int> readUnparsedData() { | 795 List<int> readUnparsedData() { |
| 796 if (_buffer == null) return null; | 796 if (_buffer == null) return null; |
| 797 if (_index == _buffer.length) return null; | 797 if (_index == _buffer.length) return null; |
| 798 var result = _buffer.getRange(_index, _buffer.length - _index); | 798 var result = _buffer.sublist(_index); |
| 799 _releaseBuffer(); | 799 _releaseBuffer(); |
| 800 return result; | 800 return result; |
| 801 } | 801 } |
| 802 | 802 |
| 803 _reset() { | 803 _reset() { |
| 804 if (_state == _State.UPGRADED) return; | 804 if (_state == _State.UPGRADED) return; |
| 805 _state = _State.START; | 805 _state = _State.START; |
| 806 _messageType = _MessageType.UNDETERMINED; | 806 _messageType = _MessageType.UNDETERMINED; |
| 807 _headerField = new List(); | 807 _headerField = new List(); |
| 808 _headerValue = new List(); | 808 _headerValue = new List(); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 StreamController<_HttpIncoming> _controller; | 974 StreamController<_HttpIncoming> _controller; |
| 975 StreamController<List<int>> _bodyController; | 975 StreamController<List<int>> _bodyController; |
| 976 } | 976 } |
| 977 | 977 |
| 978 | 978 |
| 979 class HttpParserException implements Exception { | 979 class HttpParserException implements Exception { |
| 980 const HttpParserException([String this.message = ""]); | 980 const HttpParserException([String this.message = ""]); |
| 981 String toString() => "HttpParserException: $message"; | 981 String toString() => "HttpParserException: $message"; |
| 982 final String message; | 982 final String message; |
| 983 } | 983 } |
| OLD | NEW |