changeset 4505:605ea77f2e6f

Merge
author alanb
date Mon, 22 Aug 2011 16:05:38 +0100
parents fd07a2b7bf4d 5c1f90dd0405
children c43af666d130
files
diffstat 2 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/net/HttpCookie.java	Mon Aug 22 16:04:04 2011 +0100
+++ b/src/share/classes/java/net/HttpCookie.java	Mon Aug 22 16:05:38 2011 +0100
@@ -748,10 +748,14 @@
             && (embeddedDotInDomain == -1 || embeddedDotInDomain == domain.length() - 1))
             return false;
 
-        // if the host name contains no dot and the domain name is .local
+        // if the host name contains no dot and the domain name
+        // is .local or host.local
         int firstDotInHost = host.indexOf('.');
-        if (firstDotInHost == -1 && isLocalDomain)
+        if (firstDotInHost == -1 &&
+            (isLocalDomain ||
+             domain.equalsIgnoreCase(host + ".local"))) {
             return true;
+        }
 
         int domainLength = domain.length();
         int lengthDiff = host.length() - domainLength;
--- a/test/java/net/CookieHandler/TestHttpCookie.java	Mon Aug 22 16:04:04 2011 +0100
+++ b/test/java/net/CookieHandler/TestHttpCookie.java	Mon Aug 22 16:05:38 2011 +0100
@@ -362,12 +362,13 @@
         eq(c1, c2, false);
 
         header("Test domainMatches()");
-        dm(".foo.com",  "y.x.foo.com",      false);
-        dm(".foo.com",  "x.foo.com",        true);
-        dm(".com",      "whatever.com",     false);
-        dm(".com.",     "whatever.com",     false);
-        dm(".ajax.com", "ajax.com",         true);
-        dm(".local",    "example.local",    true);
+        dm(".foo.com",      "y.x.foo.com",      false);
+        dm(".foo.com",      "x.foo.com",        true);
+        dm(".com",          "whatever.com",     false);
+        dm(".com.",         "whatever.com",     false);
+        dm(".ajax.com",     "ajax.com",         true);
+        dm(".local",        "example.local",    true);
+        dm("example.local", "example",          true);
 
         // bug 6277808
         testCount++;