| 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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 } else if (headerValue[index] == " " || headerValue[index] == "\t") { | 713 } else if (headerValue[index] == " " || headerValue[index] == "\t") { |
| 714 start++; | 714 start++; |
| 715 } | 715 } |
| 716 index++; | 716 index++; |
| 717 } | 717 } |
| 718 tokens.add(headerValue.substring(start, index)); | 718 tokens.add(headerValue.substring(start, index)); |
| 719 return tokens; | 719 return tokens; |
| 720 } | 720 } |
| 721 | 721 |
| 722 int _toLowerCase(int byte) { | 722 int _toLowerCase(int byte) { |
| 723 final int aCode = "A".charCodeAt(0); | 723 final int aCode = "A".codeUnitAt(0); |
| 724 final int zCode = "Z".charCodeAt(0); | 724 final int zCode = "Z".codeUnitAt(0); |
| 725 final int delta = "a".charCodeAt(0) - aCode; | 725 final int delta = "a".codeUnitAt(0) - aCode; |
| 726 return (aCode <= byte && byte <= zCode) ? byte + delta : byte; | 726 return (aCode <= byte && byte <= zCode) ? byte + delta : byte; |
| 727 } | 727 } |
| 728 | 728 |
| 729 int _expect(int val1, int val2) { | 729 int _expect(int val1, int val2) { |
| 730 if (val1 != val2) { | 730 if (val1 != val2) { |
| 731 throw new HttpParserException("Failed to parse HTTP"); | 731 throw new HttpParserException("Failed to parse HTTP"); |
| 732 } | 732 } |
| 733 } | 733 } |
| 734 | 734 |
| 735 int _expectHexDigit(int byte) { | 735 int _expectHexDigit(int byte) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 Function error; | 778 Function error; |
| 779 Function closed; | 779 Function closed; |
| 780 } | 780 } |
| 781 | 781 |
| 782 | 782 |
| 783 class HttpParserException implements Exception { | 783 class HttpParserException implements Exception { |
| 784 const HttpParserException([String this.message = ""]); | 784 const HttpParserException([String this.message = ""]); |
| 785 String toString() => "HttpParserException: $message"; | 785 String toString() => "HttpParserException: $message"; |
| 786 final String message; | 786 final String message; |
| 787 } | 787 } |
| OLD | NEW |