Changeset 228118 in webkit


Ignore:
Timestamp:
Feb 5, 2018 1:36:18 PM (6 years ago)
Author:
Matt Lewis
Message:

Unreviewed, rolling out r228086.

This introduced a failure with API test
URLTest.HostIsIPAddress.

Reverted changeset:

"Add a way to check if a host is an IP address"
https://bugs.webkit.org/show_bug.cgi?id=182427
https://trac.webkit.org/changeset/228086

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r228117 r228118  
     12018-02-05  Matt Lewis  <jlewis3@apple.com>
     2
     3        Unreviewed, rolling out r228086.
     4
     5        This introduced a failure with API test
     6        URLTest.HostIsIPAddress.
     7
     8        Reverted changeset:
     9
     10        "Add a way to check if a host is an IP address"
     11        https://bugs.webkit.org/show_bug.cgi?id=182427
     12        https://trac.webkit.org/changeset/228086
     13
    1142018-02-05  Matt Lewis  <jlewis3@apple.com>
    215
  • trunk/Source/WebCore/page/OriginAccessEntry.cpp

    r228086 r228118  
    4141    , m_subdomainSettings(subdomainSetting)
    4242    , m_ipAddressSettings(ipAddressSetting)
    43     , m_hostIsIPAddress(URL::hostIsIPAddress(m_host))
    4443{
    4544    ASSERT(subdomainSetting == AllowSubdomains || subdomainSetting == DisallowSubdomains);
     45
     46    // Assume that any host that ends with a digit is trying to be an IP address.
     47    m_hostIsIPAddress = !m_host.isEmpty() && isASCIIDigit(m_host[m_host.length() - 1]);
    4648}
    4749
     
    6870    // IP addresses are not domains: https://url.spec.whatwg.org/#concept-domain
    6971    // Don't try to do subdomain matching on IP addresses.
    70     if (m_ipAddressSettings == TreatIPAddressAsIPAddress && (m_hostIsIPAddress || URL::hostIsIPAddress(origin.host())))
     72    if (m_hostIsIPAddress && m_ipAddressSettings == TreatIPAddressAsIPAddress)
    7173        return false;
    7274   
  • trunk/Source/WebCore/platform/URL.cpp

    r228086 r228118  
    10361036}
    10371037
    1038 #if !PLATFORM(COCOA) && !USE(SOUP)
    1039 bool URL::hostIsIPAddress(const String& host)
    1040 {
    1041     // Assume that any host that ends with a digit is trying to be an IP address.
    1042     return !host.isEmpty() && isASCIIDigit(host[host.length() - 1]);
    1043 }
    1044 #endif
    1045 
    10461038} // namespace WebCore
  • trunk/Source/WebCore/platform/URL.h

    r228086 r228118  
    176176    unsigned hostEnd() const;
    177177
    178     WEBCORE_EXPORT static bool hostIsIPAddress(const String&);
    179 
    180178    unsigned pathStart() const;
    181179    unsigned pathEnd() const;
  • trunk/Source/WebCore/platform/mac/PublicSuffixMac.mm

    r228086 r228118  
    2929#if ENABLE(PUBLIC_SUFFIX_LIST)
    3030
    31 #import "URL.h"
     31#import "WebCoreNSURLExtras.h"
    3232#import <pal/spi/cf/CFNetworkSPI.h>
     33
     34@interface NSString (WebCoreNSURLExtras)
     35- (BOOL)_web_looksLikeIPAddress;
     36@end
    3337
    3438namespace WebCore {
     
    4246String topPrivatelyControlledDomain(const String& domain)
    4347{
    44     if (URL::hostIsIPAddress(domain))
     48    if ([domain _web_looksLikeIPAddress])
    4549        return domain;
    4650
  • trunk/Source/WebCore/platform/mac/URLMac.mm

    r228086 r228118  
    2929#import "CFURLExtras.h"
    3030#import "URLParser.h"
    31 #import "WebCoreNSURLExtras.h"
    3231#import <wtf/ObjcRuntimeExtras.h>
    3332#import <wtf/text/CString.h>
    34 
    35 @interface NSString (WebCoreNSURLExtras)
    36 - (BOOL)_web_looksLikeIPAddress;
    37 @end
    3833
    3934namespace WebCore {
     
    8075}
    8176
    82 bool URL::hostIsIPAddress(const String& host)
    83 {
    84     return [host _web_looksLikeIPAddress];
    8577}
    86 
    87 }
  • trunk/Source/WebCore/platform/network/curl/CookieUtil.cpp

    r228086 r228118  
    5454bool isIPAddress(const String& hostname)
    5555{
    56     return URL::hostIsIPAddress(hostname);
     56    // Assuming that hosts ending in a digit are IP Addresses
     57    return !hostname.isEmpty() && isASCIIDigit(hostname[hostname.length() - 1]);
    5758}
    5859
  • trunk/Source/WebCore/platform/soup/URLSoup.cpp

    r228086 r228118  
    6767}
    6868
    69 bool URL::hostIsIPAddress(const String& host)
    70 {
    71     return !host.isEmpty() && g_hostname_is_ip_address(host.utf8().data());
    72 }
    73 
    7469} // namespace WebCore
    7570
  • trunk/Tools/ChangeLog

    r228109 r228118  
     12018-02-05  Matt Lewis  <jlewis3@apple.com>
     2
     3        Unreviewed, rolling out r228086.
     4
     5        This introduced a failure with API test
     6        URLTest.HostIsIPAddress.
     7
     8        Reverted changeset:
     9
     10        "Add a way to check if a host is an IP address"
     11        https://bugs.webkit.org/show_bug.cgi?id=182427
     12        https://trac.webkit.org/changeset/228086
     13
    1142018-02-05  John Wilander  <wilander@apple.com>
    215
  • trunk/Tools/TestWebKitAPI/Tests/WebCore/URL.cpp

    r228086 r228118  
    232232}
    233233
    234 TEST_F(URLTest, HostIsIPAddress)
    235 {
    236     EXPECT_FALSE(URL::hostIsIPAddress({ }));
    237     EXPECT_FALSE(URL::hostIsIPAddress(""));
    238     EXPECT_FALSE(URL::hostIsIPAddress("localhost"));
    239     EXPECT_FALSE(URL::hostIsIPAddress("127.localhost"));
    240     EXPECT_FALSE(URL::hostIsIPAddress("localhost.127"));
    241     EXPECT_FALSE(URL::hostIsIPAddress("127.0.0"));
    242     EXPECT_FALSE(URL::hostIsIPAddress("127.0 .0.1"));
    243     EXPECT_FALSE(URL::hostIsIPAddress(" 127.0.0.1"));
    244     EXPECT_FALSE(URL::hostIsIPAddress("127..0.0.1"));
    245     EXPECT_FALSE(URL::hostIsIPAddress("127.0.0."));
    246     EXPECT_FALSE(URL::hostIsIPAddress("0123:4567:89AB:cdef:3210:7654:ba98"));
    247     EXPECT_FALSE(URL::hostIsIPAddress("012x:4567:89AB:cdef:3210:7654:ba98:FeDc"));
    248     EXPECT_FALSE(URL::hostIsIPAddress("00123:4567:89AB:cdef:3210:7654:ba98:FeDc"));
    249     EXPECT_FALSE(URL::hostIsIPAddress("0123:4567:89AB:cdef:3210:123.45.67.89"));
    250     EXPECT_FALSE(URL::hostIsIPAddress(":::"));
    251 
    252     EXPECT_TRUE(URL::hostIsIPAddress("127.0.0.1"));
    253     EXPECT_TRUE(URL::hostIsIPAddress("123.45.67.89"));
    254     EXPECT_TRUE(URL::hostIsIPAddress("0.0.0.0"));
    255     EXPECT_TRUE(URL::hostIsIPAddress("::1"));
    256     EXPECT_TRUE(URL::hostIsIPAddress("::"));
    257     EXPECT_TRUE(URL::hostIsIPAddress("0123:4567:89AB:cdef:3210:7654:ba98:FeDc"));
    258     EXPECT_TRUE(URL::hostIsIPAddress("0123:4567:89AB:cdef:3210:7654:ba98::"));
    259     EXPECT_TRUE(URL::hostIsIPAddress("::4567:89AB:cdef:3210:7654:ba98:FeDc"));
    260     EXPECT_TRUE(URL::hostIsIPAddress("0123:4567:89AB:cdef:3210:7654:123.45.67.89"));
    261     EXPECT_TRUE(URL::hostIsIPAddress("::123.45.67.89"));
    262 }
    263 
    264234} // namespace TestWebKitAPI
Note: See TracChangeset for help on using the changeset viewer.