Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Side by Side Diff: runtime/vm/uri.cc

Issue 2035123002: Allow double-slash in uris. This is needed for data uri parsing. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/uri_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/uri_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698