| 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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 _remainingContent = -1; | 905 _remainingContent = -1; |
| 906 | 906 |
| 907 _headers = null; | 907 _headers = null; |
| 908 } | 908 } |
| 909 | 909 |
| 910 void _releaseBuffer() { | 910 void _releaseBuffer() { |
| 911 _buffer = null; | 911 _buffer = null; |
| 912 _index = null; | 912 _index = null; |
| 913 } | 913 } |
| 914 | 914 |
| 915 bool _isTokenChar(int byte) { | 915 static bool _isTokenChar(int byte) { |
| 916 return byte > 31 && byte < 128 && !_Const.SEPARATOR_MAP[byte]; | 916 return byte > 31 && byte < 128 && !_Const.SEPARATOR_MAP[byte]; |
| 917 } | 917 } |
| 918 | 918 |
| 919 static bool _isValueChar(int byte) { |
| 920 return (byte > 31 && byte < 128) || (byte == _CharCode.SP) || |
| 921 (byte == _CharCode.HT); |
| 922 } |
| 923 |
| 919 static List<String> _tokenizeFieldValue(String headerValue) { | 924 static List<String> _tokenizeFieldValue(String headerValue) { |
| 920 List<String> tokens = new List<String>(); | 925 List<String> tokens = new List<String>(); |
| 921 int start = 0; | 926 int start = 0; |
| 922 int index = 0; | 927 int index = 0; |
| 923 while (index < headerValue.length) { | 928 while (index < headerValue.length) { |
| 924 if (headerValue[index] == ",") { | 929 if (headerValue[index] == ",") { |
| 925 tokens.add(headerValue.substring(start, index)); | 930 tokens.add(headerValue.substring(start, index)); |
| 926 start = index + 1; | 931 start = index + 1; |
| 927 } else if (headerValue[index] == " " || headerValue[index] == "\t") { | 932 } else if (headerValue[index] == " " || headerValue[index] == "\t") { |
| 928 start++; | 933 start++; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 } | 1039 } |
| 1035 } | 1040 } |
| 1036 | 1041 |
| 1037 void _reportError(error, [stackTrace]) { | 1042 void _reportError(error, [stackTrace]) { |
| 1038 if (_socketSubscription != null) _socketSubscription.cancel(); | 1043 if (_socketSubscription != null) _socketSubscription.cancel(); |
| 1039 _state = _State.FAILURE; | 1044 _state = _State.FAILURE; |
| 1040 _controller.addError(error, stackTrace); | 1045 _controller.addError(error, stackTrace); |
| 1041 _controller.close(); | 1046 _controller.close(); |
| 1042 } | 1047 } |
| 1043 } | 1048 } |
| OLD | NEW |