OLD | NEW |
1 // Copyright 2007, Google Inc. | 1 // Copyright 2007, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 h.len -= 2; | 357 h.len -= 2; |
358 } | 358 } |
359 return ComponentString(h); | 359 return ComponentString(h); |
360 } | 360 } |
361 | 361 |
362 bool GURL::HostIsIPAddress() const { | 362 bool GURL::HostIsIPAddress() const { |
363 if (!is_valid_ || spec_.empty()) | 363 if (!is_valid_ || spec_.empty()) |
364 return false; | 364 return false; |
365 | 365 |
366 url_canon::RawCanonOutputT<char, 128> ignored_output; | 366 url_canon::RawCanonOutputT<char, 128> ignored_output; |
367 url_parse::Component ignored_component; | 367 url_canon::CanonHostInfo host_info; |
368 return url_canon::CanonicalizeIPAddress(spec_.c_str(), parsed_.host, | 368 url_canon::CanonicalizeIPAddress(spec_.c_str(), parsed_.host, |
369 &ignored_output, &ignored_component); | 369 &ignored_output, &host_info); |
| 370 return host_info.IsIPAddress(); |
370 } | 371 } |
371 | 372 |
372 #ifdef WIN32 | 373 #ifdef WIN32 |
373 | 374 |
374 const GURL& GURL::EmptyGURL() { | 375 const GURL& GURL::EmptyGURL() { |
375 // Avoid static object construction/destruction on startup/shutdown. | 376 // Avoid static object construction/destruction on startup/shutdown. |
376 if (!empty_gurl) { | 377 if (!empty_gurl) { |
377 // Create the string. Be careful that we don't break in the case that this | 378 // Create the string. Be careful that we don't break in the case that this |
378 // is being called from multiple threads. | 379 // is being called from multiple threads. |
379 GURL* new_empty_gurl = new GURL; | 380 GURL* new_empty_gurl = new GURL; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 441 |
441 return true; | 442 return true; |
442 } | 443 } |
443 | 444 |
444 void GURL::Swap(GURL* other) { | 445 void GURL::Swap(GURL* other) { |
445 spec_.swap(other->spec_); | 446 spec_.swap(other->spec_); |
446 std::swap(is_valid_, other->is_valid_); | 447 std::swap(is_valid_, other->is_valid_); |
447 std::swap(parsed_, other->parsed_); | 448 std::swap(parsed_, other->parsed_); |
448 } | 449 } |
449 | 450 |
OLD | NEW |