| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/base/url_util.h" | 5 #include "net/base/url_util.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
| 10 #include <netinet/in.h> | 10 #include <netinet/in.h> |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 return ip_address == IPAddress::IPv6Localhost(); | 364 return ip_address == IPAddress::IPv6Localhost(); |
| 365 | 365 |
| 366 default: | 366 default: |
| 367 NOTREACHED(); | 367 NOTREACHED(); |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 | 370 |
| 371 return false; | 371 return false; |
| 372 } | 372 } |
| 373 | 373 |
| 374 bool IsFragmentAddedOrUpdated(const GURL& old_url, const GURL& new_url) { |
| 375 if (!new_url.has_ref() || old_url == new_url) |
| 376 return false; |
| 377 |
| 378 url::Replacements<char> replacements; |
| 379 replacements.ClearRef(); |
| 380 return old_url.ReplaceComponents(replacements) == |
| 381 new_url.ReplaceComponents(replacements); |
| 382 } |
| 383 |
| 374 GURL SimplifyUrlForRequest(const GURL& url) { | 384 GURL SimplifyUrlForRequest(const GURL& url) { |
| 375 DCHECK(url.is_valid()); | 385 DCHECK(url.is_valid()); |
| 376 // Fast path to avoid re-canonicalization via ReplaceComponents. | 386 // Fast path to avoid re-canonicalization via ReplaceComponents. |
| 377 if (!url.has_username() && !url.has_password() && !url.has_ref()) | 387 if (!url.has_username() && !url.has_password() && !url.has_ref()) |
| 378 return url; | 388 return url; |
| 379 GURL::Replacements replacements; | 389 GURL::Replacements replacements; |
| 380 replacements.ClearUsername(); | 390 replacements.ClearUsername(); |
| 381 replacements.ClearPassword(); | 391 replacements.ClearPassword(); |
| 382 replacements.ClearRef(); | 392 replacements.ClearRef(); |
| 383 return url.ReplaceComponents(replacements); | 393 return url.ReplaceComponents(replacements); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 } | 443 } |
| 434 | 444 |
| 435 if (is_local6) | 445 if (is_local6) |
| 436 *is_local6 = false; | 446 *is_local6 = false; |
| 437 return normalized_host == "localhost" || | 447 return normalized_host == "localhost" || |
| 438 normalized_host == "localhost.localdomain" || | 448 normalized_host == "localhost.localdomain" || |
| 439 IsNormalizedLocalhostTLD(normalized_host); | 449 IsNormalizedLocalhostTLD(normalized_host); |
| 440 } | 450 } |
| 441 | 451 |
| 442 } // namespace net | 452 } // namespace net |
| OLD | NEW |