jdk/src/share/classes/java/net/CookieManager.java
changeset 2924 a67f12d92bdd
parent 1950 dd893f20667b
child 3858 ea9c34fc8590
--- a/jdk/src/share/classes/java/net/CookieManager.java	Sun May 24 16:35:32 2009 -0700
+++ b/jdk/src/share/classes/java/net/CookieManager.java	Mon May 25 22:27:26 2009 +0200
@@ -286,6 +286,14 @@
                             }
                             cookie.setPath(path);
                         }
+
+                        // As per RFC 2965, section 3.3.1:
+                        // Domain  Defaults to the effective request-host.  (Note that because
+                        // there is no dot at the beginning of effective request-host,
+                        // the default Domain can only domain-match itself.)
+                        if (cookie.getDomain() == null) {
+                            cookie.setDomain(uri.getHost());
+                        }
                         String ports = cookie.getPortlist();
                         if (ports != null) {
                             int port = uri.getPort();