JDK-8206092 : HttpCookie.domainMatches() does not match to sub-sub-domain
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 8,9,10,11
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2018-06-25
  • Updated: 2018-11-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE PROBLEM :
CookiePolicy.ACCEPT_ORIGINAL_SERVER uses the HttpCookie.domainMatches() method to accept a cookie to send. We have sub domain 4th level: c.b.a.com. Cookie which is set for .a.com is not accepted on sending to c.b.a.com.

Section in the RFC: https://tools.ietf.org/html/rfc6265#section-5.1.3

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the provided program



ACTUAL -
false

---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.net.HttpCookie;

public class Main {
    public static void main(String[] args) throws IOException {
        System.out.print(HttpCookie.domainMatches(".a.com", "c.b.a.com"));
    }
}
---------- END SOURCE ----------

FREQUENCY : always



Comments
To reproduce the issue, run the attached test case: JDK 8u171 - Fail JDK 10.0.1 + 11 - Fail JDK 11-ea + 18 - Fail Output is false on all the above.
29-06-2018