OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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.core; | 5 part of dart.core; |
6 | 6 |
7 /** | 7 /** |
8 * A parsed URI, such as a URL. | 8 * A parsed URI, such as a URL. |
9 * | 9 * |
10 * **See also:** | 10 * **See also:** |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 * The returned map is unmodifiable and will throw [UnsupportedError] on any | 974 * The returned map is unmodifiable and will throw [UnsupportedError] on any |
975 * calls that would mutate it. | 975 * calls that would mutate it. |
976 */ | 976 */ |
977 Map<String, String> get queryParameters { | 977 Map<String, String> get queryParameters { |
978 if (_queryParameters == null) { | 978 if (_queryParameters == null) { |
979 _queryParameters = new UnmodifiableMapView(splitQueryString(query)); | 979 _queryParameters = new UnmodifiableMapView(splitQueryString(query)); |
980 } | 980 } |
981 return _queryParameters; | 981 return _queryParameters; |
982 } | 982 } |
983 | 983 |
| 984 /** |
| 985 * Returns an URI where the path has been normalized. |
| 986 * |
| 987 * A normalized path does not contain `.` segments or non-leading `..` |
| 988 * segments. |
| 989 * Only a relative path may contain leading `..` segments, |
| 990 * a path that starts with `/` will also drop any leading `..` segments. |
| 991 * |
| 992 * This uses the same normalization strategy as [resolveUri], as specified by |
| 993 * RFC 3986. |
| 994 * |
| 995 * Does not change any part of the URI except the path. |
| 996 */ |
| 997 Uri normalizePath() { |
| 998 String path = _removeDotSegments(_path); |
| 999 if (identical(path, _path)) return this; |
| 1000 return this.replace(path: path); |
| 1001 } |
| 1002 |
984 static int _makePort(int port, String scheme) { | 1003 static int _makePort(int port, String scheme) { |
985 // Perform scheme specific normalization. | 1004 // Perform scheme specific normalization. |
986 if (port != null && port == _defaultPort(scheme)) return null; | 1005 if (port != null && port == _defaultPort(scheme)) return null; |
987 return port; | 1006 return port; |
988 } | 1007 } |
989 | 1008 |
990 /** | 1009 /** |
991 * Check and normalize a most name. | 1010 * Check and normalize a host name. |
992 * | 1011 * |
993 * If the host name starts and ends with '[' and ']', it is considered an | 1012 * If the host name starts and ends with '[' and ']', it is considered an |
994 * IPv6 address. If [strictIPv6] is false, the address is also considered | 1013 * IPv6 address. If [strictIPv6] is false, the address is also considered |
995 * an IPv6 address if it contains any ':' character. | 1014 * an IPv6 address if it contains any ':' character. |
996 * | 1015 * |
997 * If it is not an IPv6 address, it is case- and escape-normalized. | 1016 * If it is not an IPv6 address, it is case- and escape-normalized. |
998 * This escapes all characters not valid in a reg-name, | 1017 * This escapes all characters not valid in a reg-name, |
999 * and converts all non-escape upper-case letters to lower-case. | 1018 * and converts all non-escape upper-case letters to lower-case. |
1000 */ | 1019 */ |
1001 static String _makeHost(String host, int start, int end, bool strictIPv6) { | 1020 static String _makeHost(String host, int start, int end, bool strictIPv6) { |
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2408 0xafff, // 0x30 - 0x3f 1111111111110101 | 2427 0xafff, // 0x30 - 0x3f 1111111111110101 |
2409 // @ABCDEFGHIJKLMNO | 2428 // @ABCDEFGHIJKLMNO |
2410 0xffff, // 0x40 - 0x4f 1111111111111111 | 2429 0xffff, // 0x40 - 0x4f 1111111111111111 |
2411 // PQRSTUVWXYZ _ | 2430 // PQRSTUVWXYZ _ |
2412 0x87ff, // 0x50 - 0x5f 1111111111100001 | 2431 0x87ff, // 0x50 - 0x5f 1111111111100001 |
2413 // abcdefghijklmno | 2432 // abcdefghijklmno |
2414 0xfffe, // 0x60 - 0x6f 0111111111111111 | 2433 0xfffe, // 0x60 - 0x6f 0111111111111111 |
2415 // pqrstuvwxyz ~ | 2434 // pqrstuvwxyz ~ |
2416 0x47ff]; // 0x70 - 0x7f 1111111111100010 | 2435 0x47ff]; // 0x70 - 0x7f 1111111111100010 |
2417 } | 2436 } |
OLD | NEW |