| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 GURL SimplifyUrlForRequest(const GURL& url) { | 374 GURL SimplifyUrlForRequest(const GURL& url) { |
| 375 DCHECK(url.is_valid()); | 375 DCHECK(url.is_valid()); |
| 376 // Fast path to avoid re-canonicalization via ReplaceComponents. |
| 377 if (!url.has_username() && !url.has_password() && !url.has_ref()) |
| 378 return url; |
| 376 GURL::Replacements replacements; | 379 GURL::Replacements replacements; |
| 377 replacements.ClearUsername(); | 380 replacements.ClearUsername(); |
| 378 replacements.ClearPassword(); | 381 replacements.ClearPassword(); |
| 379 replacements.ClearRef(); | 382 replacements.ClearRef(); |
| 380 return url.ReplaceComponents(replacements); | 383 return url.ReplaceComponents(replacements); |
| 381 } | 384 } |
| 382 | 385 |
| 383 void GetIdentityFromURL(const GURL& url, | 386 void GetIdentityFromURL(const GURL& url, |
| 384 base::string16* username, | 387 base::string16* username, |
| 385 base::string16* password) { | 388 base::string16* password) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 } | 433 } |
| 431 | 434 |
| 432 if (is_local6) | 435 if (is_local6) |
| 433 *is_local6 = false; | 436 *is_local6 = false; |
| 434 return normalized_host == "localhost" || | 437 return normalized_host == "localhost" || |
| 435 normalized_host == "localhost.localdomain" || | 438 normalized_host == "localhost.localdomain" || |
| 436 IsNormalizedLocalhostTLD(normalized_host); | 439 IsNormalizedLocalhostTLD(normalized_host); |
| 437 } | 440 } |
| 438 | 441 |
| 439 } // namespace net | 442 } // namespace net |
| OLD | NEW |