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 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 | 949 |
950 // expected should already be lowercase. | 950 // expected should already be lowercase. |
951 bool _caseInsensitiveCompare(List<int> expected, List<int> value) { | 951 bool _caseInsensitiveCompare(List<int> expected, List<int> value) { |
952 if (expected.length != value.length) return false; | 952 if (expected.length != value.length) return false; |
953 for (int i = 0; i < expected.length; i++) { | 953 for (int i = 0; i < expected.length; i++) { |
954 if (expected[i] != _toLowerCaseByte(value[i])) return false; | 954 if (expected[i] != _toLowerCaseByte(value[i])) return false; |
955 } | 955 } |
956 return true; | 956 return true; |
957 } | 957 } |
958 | 958 |
959 int _expect(int val1, int val2) { | 959 void _expect(int val1, int val2) { |
960 if (val1 != val2) { | 960 if (val1 != val2) { |
961 throw new HttpException("Failed to parse HTTP"); | 961 throw new HttpException("Failed to parse HTTP"); |
962 } | 962 } |
963 } | 963 } |
964 | 964 |
965 int _expectHexDigit(int byte) { | 965 int _expectHexDigit(int byte) { |
966 if (0x30 <= byte && byte <= 0x39) { | 966 if (0x30 <= byte && byte <= 0x39) { |
967 return byte - 0x30; // 0 - 9 | 967 return byte - 0x30; // 0 - 9 |
968 } else if (0x41 <= byte && byte <= 0x46) { | 968 } else if (0x41 <= byte && byte <= 0x46) { |
969 return byte - 0x41 + 10; // A - F | 969 return byte - 0x41 + 10; // A - F |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 } | 1039 } |
1040 } | 1040 } |
1041 | 1041 |
1042 void _reportError(error, [stackTrace]) { | 1042 void _reportError(error, [stackTrace]) { |
1043 if (_socketSubscription != null) _socketSubscription.cancel(); | 1043 if (_socketSubscription != null) _socketSubscription.cancel(); |
1044 _state = _State.FAILURE; | 1044 _state = _State.FAILURE; |
1045 _controller.addError(error, stackTrace); | 1045 _controller.addError(error, stackTrace); |
1046 _controller.close(); | 1046 _controller.close(); |
1047 } | 1047 } |
1048 } | 1048 } |
OLD | NEW |