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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 _headers[name] = values; | 442 _headers[name] = values; |
443 values.add(value); | 443 values.add(value); |
444 } | 444 } |
445 | 445 |
446 _checkMutable() { | 446 _checkMutable() { |
447 if (!_mutable) throw new HttpException("HTTP headers are not mutable"); | 447 if (!_mutable) throw new HttpException("HTTP headers are not mutable"); |
448 } | 448 } |
449 | 449 |
450 _updateHostHeader() { | 450 _updateHostHeader() { |
451 bool defaultPort = _port == null || _port == _defaultPortForScheme; | 451 bool defaultPort = _port == null || _port == _defaultPortForScheme; |
452 String portPart = defaultPort ? "" : ":$_port"; | 452 _set("host", defaultPort ? host : "$host:$_port"); |
453 _set("host", "$host$portPart"); | |
454 } | 453 } |
455 | 454 |
456 _foldHeader(String name) { | 455 _foldHeader(String name) { |
457 if (name == HttpHeaders.SET_COOKIE || | 456 if (name == HttpHeaders.SET_COOKIE || |
458 (_noFoldingHeaders != null && | 457 (_noFoldingHeaders != null && |
459 _noFoldingHeaders.indexOf(name) != -1)) { | 458 _noFoldingHeaders.indexOf(name) != -1)) { |
460 return false; | 459 return false; |
461 } | 460 } |
462 return true; | 461 return true; |
463 } | 462 } |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 (codeUnit >= 0x23 && codeUnit <= 0x2B) || | 962 (codeUnit >= 0x23 && codeUnit <= 0x2B) || |
964 (codeUnit >= 0x2D && codeUnit <= 0x3A) || | 963 (codeUnit >= 0x2D && codeUnit <= 0x3A) || |
965 (codeUnit >= 0x3C && codeUnit <= 0x5B) || | 964 (codeUnit >= 0x3C && codeUnit <= 0x5B) || |
966 (codeUnit >= 0x5D && codeUnit <= 0x7E))) { | 965 (codeUnit >= 0x5D && codeUnit <= 0x7E))) { |
967 throw new FormatException( | 966 throw new FormatException( |
968 "Invalid character in cookie value, code unit: '$codeUnit'"); | 967 "Invalid character in cookie value, code unit: '$codeUnit'"); |
969 } | 968 } |
970 } | 969 } |
971 } | 970 } |
972 } | 971 } |
OLD | NEW |