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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 } else if (headerValue[index] == " " || headerValue[index] == "\t") { | 833 } else if (headerValue[index] == " " || headerValue[index] == "\t") { |
834 start++; | 834 start++; |
835 } | 835 } |
836 index++; | 836 index++; |
837 } | 837 } |
838 tokens.add(headerValue.substring(start, index)); | 838 tokens.add(headerValue.substring(start, index)); |
839 return tokens; | 839 return tokens; |
840 } | 840 } |
841 | 841 |
842 int _toLowerCase(int byte) { | 842 int _toLowerCase(int byte) { |
843 final int aCode = "A".charCodeAt(0); | 843 final int aCode = "A".codeUnitAt(0); |
844 final int zCode = "Z".charCodeAt(0); | 844 final int zCode = "Z".codeUnitAt(0); |
845 final int delta = "a".charCodeAt(0) - aCode; | 845 final int delta = "a".codeUnitAt(0) - aCode; |
846 return (aCode <= byte && byte <= zCode) ? byte + delta : byte; | 846 return (aCode <= byte && byte <= zCode) ? byte + delta : byte; |
847 } | 847 } |
848 | 848 |
849 int _expect(int val1, int val2) { | 849 int _expect(int val1, int val2) { |
850 if (val1 != val2) { | 850 if (val1 != val2) { |
851 throw new HttpParserException("Failed to parse HTTP"); | 851 throw new HttpParserException("Failed to parse HTTP"); |
852 } | 852 } |
853 } | 853 } |
854 | 854 |
855 int _expectHexDigit(int byte) { | 855 int _expectHexDigit(int byte) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 StreamController<_HttpIncoming> _controller; | 956 StreamController<_HttpIncoming> _controller; |
957 StreamController<List<int>> _bodyController; | 957 StreamController<List<int>> _bodyController; |
958 } | 958 } |
959 | 959 |
960 | 960 |
961 class HttpParserException implements Exception { | 961 class HttpParserException implements Exception { |
962 const HttpParserException([String this.message = ""]); | 962 const HttpParserException([String this.message = ""]); |
963 String toString() => "HttpParserException: $message"; | 963 String toString() => "HttpParserException: $message"; |
964 final String message; | 964 final String message; |
965 } | 965 } |
OLD | NEW |