| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/network/NetworkUtils.h" | 5 #include "platform/network/NetworkUtils.h" |
| 6 | 6 |
| 7 #include "net/base/ip_address.h" | 7 #include "net/base/ip_address.h" |
| 8 #include "net/base/url_util.h" |
| 8 #include "wtf/text/StringUTF8Adaptor.h" | 9 #include "wtf/text/StringUTF8Adaptor.h" |
| 9 #include "wtf/text/WTFString.h" | 10 #include "wtf/text/WTFString.h" |
| 10 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 | 13 |
| 13 namespace NetworkUtils { | 14 namespace NetworkUtils { |
| 14 | 15 |
| 15 bool isReservedIPAddress(const String& host) | 16 bool isReservedIPAddress(const String& host) |
| 16 { | 17 { |
| 17 net::IPAddress address; | 18 net::IPAddress address; |
| 18 StringUTF8Adaptor utf8(host); | 19 StringUTF8Adaptor utf8(host); |
| 19 if (!net::ParseURLHostnameToAddress(utf8.asStringPiece(), &address)) | 20 if (!net::ParseURLHostnameToAddress(utf8.asStringPiece(), &address)) |
| 20 return false; | 21 return false; |
| 21 return address.IsReserved(); | 22 return address.IsReserved(); |
| 22 } | 23 } |
| 23 | 24 |
| 25 bool isLocalHostname(const String& host, bool* isLocal6) |
| 26 { |
| 27 StringUTF8Adaptor utf8(host); |
| 28 return net::IsLocalHostname(utf8.asStringPiece(), isLocal6); |
| 29 } |
| 30 |
| 24 } // NetworkUtils | 31 } // NetworkUtils |
| 25 | 32 |
| 26 } // namespace blink | 33 } // namespace blink |
| OLD | NEW |