| 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 _HttpHeaders(String this.protocolVersion) | 8 _HttpHeaders(String this.protocolVersion) |
| 9 : _headers = new Map<String, List<String>>(); | 9 : _headers = new Map<String, List<String>>(); |
| 10 | 10 |
| 11 List<String> operator[](String name) { | 11 List<String> operator[](String name) { |
| 12 name = name.toLowerCase(); | 12 name = name.toLowerCase(); |
| 13 return _headers[name]; | 13 return _headers[name]; |
| 14 } | 14 } |
| 15 | 15 |
| 16 String value(String name) { | 16 String value(String name) { |
| 17 name = name.toLowerCase(); | 17 name = name.toLowerCase(); |
| 18 List<String> values = _headers[name]; | 18 List<String> values = _headers[name]; |
| 19 if (values == null) return null; | 19 if (values == null) return null; |
| 20 if (values.length > 1) { | 20 if (values.length > 1) { |
| 21 throw new HttpException("More than one value for header $name"); | 21 throw new HttpException("More than one value for header $name"); |
| 22 } | 22 } |
| 23 return values[0]; | 23 return values[0]; |
| 24 } | 24 } |
| 25 | 25 |
| 26 void add(String name, value) { | 26 void add(String name, Object value) { |
| 27 _checkMutable(); | 27 _checkMutable(); |
| 28 if (value is List) { | 28 if (value is List) { |
| 29 for (int i = 0; i < value.length; i++) { | 29 for (int i = 0; i < value.length; i++) { |
| 30 _add(name, value[i]); | 30 _add(name, value[i]); |
| 31 } | 31 } |
| 32 } else { | 32 } else { |
| 33 _add(name, value); | 33 _add(name, value); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 | 771 |
| 772 String name; | 772 String name; |
| 773 String value; | 773 String value; |
| 774 DateTime expires; | 774 DateTime expires; |
| 775 int maxAge; | 775 int maxAge; |
| 776 String domain; | 776 String domain; |
| 777 String path; | 777 String path; |
| 778 bool httpOnly = false; | 778 bool httpOnly = false; |
| 779 bool secure = false; | 779 bool secure = false; |
| 780 } | 780 } |
| OLD | NEW |