| 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 class _HttpHeaders implements HttpHeaders { | 7 class _HttpHeaders implements HttpHeaders { |
| 8 final Map<String, List<String>> _headers; | 8 final Map<String, List<String>> _headers; |
| 9 final String protocolVersion; | 9 final String protocolVersion; |
| 10 | 10 |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 } | 740 } |
| 741 | 741 |
| 742 while (!done()) { | 742 while (!done()) { |
| 743 skipWS(); | 743 skipWS(); |
| 744 if (done()) return; | 744 if (done()) return; |
| 745 String name = parseParameterName(); | 745 String name = parseParameterName(); |
| 746 skipWS(); | 746 skipWS(); |
| 747 expect("="); | 747 expect("="); |
| 748 skipWS(); | 748 skipWS(); |
| 749 String value = parseParameterValue(); | 749 String value = parseParameterValue(); |
| 750 if (name == 'charset' && this is _ContentType) { |
| 751 // Charset parameter of ContentTypes are always lower-case. |
| 752 value = value.toLowerCase(); |
| 753 } |
| 750 parameters[name] = value; | 754 parameters[name] = value; |
| 751 skipWS(); | 755 skipWS(); |
| 752 if (done()) return; | 756 if (done()) return; |
| 753 expect(parameterSeparator); | 757 expect(parameterSeparator); |
| 754 } | 758 } |
| 755 } | 759 } |
| 756 | 760 |
| 757 skipWS(); | 761 skipWS(); |
| 758 _value = parseValue(); | 762 _value = parseValue(); |
| 759 skipWS(); | 763 skipWS(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 772 String subType, | 776 String subType, |
| 773 String charset, | 777 String charset, |
| 774 Map<String, String> parameters) | 778 Map<String, String> parameters) |
| 775 : _primaryType = primaryType, _subType = subType, super("") { | 779 : _primaryType = primaryType, _subType = subType, super("") { |
| 776 if (_primaryType == null) _primaryType = ""; | 780 if (_primaryType == null) _primaryType = ""; |
| 777 if (_subType == null) _subType = ""; | 781 if (_subType == null) _subType = ""; |
| 778 _value = "$_primaryType/$_subType"; | 782 _value = "$_primaryType/$_subType"; |
| 779 if (parameters != null) { | 783 if (parameters != null) { |
| 780 _ensureParameters(); | 784 _ensureParameters(); |
| 781 parameters.forEach((String key, String value) { | 785 parameters.forEach((String key, String value) { |
| 782 this._parameters[key.toLowerCase()] = value.toLowerCase(); | 786 String lowerCaseKey = key.toLowerCase(); |
| 787 if (lowerCaseKey == "charset") { |
| 788 value = value.toLowerCase(); |
| 789 } |
| 790 this._parameters[lowerCaseKey] = value; |
| 783 }); | 791 }); |
| 784 } | 792 } |
| 785 if (charset != null) { | 793 if (charset != null) { |
| 786 _ensureParameters(); | 794 _ensureParameters(); |
| 787 this._parameters["charset"] = charset.toLowerCase(); | 795 this._parameters["charset"] = charset.toLowerCase(); |
| 788 } | 796 } |
| 789 } | 797 } |
| 790 | 798 |
| 791 _ContentType._(); | 799 _ContentType._(); |
| 792 | 800 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 (codeUnit >= 0x23 && codeUnit <= 0x2B) || | 970 (codeUnit >= 0x23 && codeUnit <= 0x2B) || |
| 963 (codeUnit >= 0x2D && codeUnit <= 0x3A) || | 971 (codeUnit >= 0x2D && codeUnit <= 0x3A) || |
| 964 (codeUnit >= 0x3C && codeUnit <= 0x5B) || | 972 (codeUnit >= 0x3C && codeUnit <= 0x5B) || |
| 965 (codeUnit >= 0x5D && codeUnit <= 0x7E))) { | 973 (codeUnit >= 0x5D && codeUnit <= 0x7E))) { |
| 966 throw new FormatException( | 974 throw new FormatException( |
| 967 "Invalid character in cookie value, code unit: '$codeUnit'"); | 975 "Invalid character in cookie value, code unit: '$codeUnit'"); |
| 968 } | 976 } |
| 969 } | 977 } |
| 970 } | 978 } |
| 971 } | 979 } |
| OLD | NEW |