OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 #include "vm/uri.h" | 5 #include "vm/uri.h" |
6 | 6 |
7 #include "vm/zone.h" | 7 #include "vm/zone.h" |
8 | 8 |
9 namespace dart { | 9 namespace dart { |
10 | 10 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 ClearParsedUri(parsed_uri); | 241 ClearParsedUri(parsed_uri); |
242 return false; | 242 return false; |
243 } | 243 } |
244 path_start = authority_start + authority_len; | 244 path_start = authority_start + authority_len; |
245 } else { | 245 } else { |
246 parsed_uri->userinfo = NULL; | 246 parsed_uri->userinfo = NULL; |
247 parsed_uri->host = NULL; | 247 parsed_uri->host = NULL; |
248 parsed_uri->port = NULL; | 248 parsed_uri->port = NULL; |
249 } | 249 } |
250 | 250 |
251 // Double slashes in the path do not parse. | |
252 bool saw_slash = false; | |
253 for (const char* pos = path_start; pos < question_pos; pos++) { | |
254 if (*pos == '/') { | |
255 if (saw_slash) { | |
256 ClearParsedUri(parsed_uri); | |
257 return false; | |
258 } | |
259 saw_slash = true; | |
260 } else { | |
261 saw_slash = false; | |
262 } | |
263 } | |
264 | |
265 // The path is the substring between the authority and the query. | 251 // The path is the substring between the authority and the query. |
266 parsed_uri->path = NormalizeEscapes(path_start, (question_pos - path_start)); | 252 parsed_uri->path = NormalizeEscapes(path_start, (question_pos - path_start)); |
267 return true; | 253 return true; |
268 } | 254 } |
269 | 255 |
270 | 256 |
271 static char* RemoveLastSegment(char* current, char* base) { | 257 static char* RemoveLastSegment(char* current, char* base) { |
272 if (current == base) { | 258 if (current == base) { |
273 return current; | 259 return current; |
274 } | 260 } |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 target.port = base.port; | 532 target.port = base.port; |
547 target.path = RemoveDotSegments(MergePaths(base.path, ref.path)); | 533 target.path = RemoveDotSegments(MergePaths(base.path, ref.path)); |
548 target.query = ref.query; | 534 target.query = ref.query; |
549 target.fragment = ref.fragment; | 535 target.fragment = ref.fragment; |
550 *target_uri = BuildUri(target); | 536 *target_uri = BuildUri(target); |
551 return true; | 537 return true; |
552 } | 538 } |
553 } | 539 } |
554 | 540 |
555 } // namespace dart | 541 } // namespace dart |
OLD | NEW |