Add HTTP tests with CertificateCompression turned off

This commit is contained in:
Artur Barashev 2026-03-20 10:49:36 -04:00
parent 1153356d6b
commit a095258bf2
2 changed files with 48 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,14 +22,26 @@
*/
/*
* @test
* @test id=withCertificateCompression
* @bug 8203433 8276559
* @summary Tests Client handles HEAD and 304 responses correctly.
* @library /test/lib /test/jdk/java/net/httpclient/lib
* @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm -Djdk.httpclient.HttpClient.log=trace,headers,requests HeadTest
* @run testng/othervm -Djdk.tls.enableCertificateCompression=true
* -Djdk.httpclient.HttpClient.log=trace,headers,requests HeadTest
*/
/*
* @test id=withoutCertificateCompression
* @bug 8203433 8276559
* @summary Tests Client handles HEAD and 304 responses correctly.
* @library /test/lib /test/jdk/java/net/httpclient/lib
* @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm -Djdk.tls.enableCertificateCompression=false
* -Djdk.httpclient.HttpClient.log=trace,headers,requests HeadTest
*/
import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -66,8 +66,8 @@ import static java.net.http.HttpClient.Version.HTTP_3;
import static java.net.http.HttpOption.Http3DiscoveryMode.HTTP_3_URI_ONLY;
import static java.net.http.HttpOption.H3_DISCOVERY;
/**
* @test
/*
* @test id=withCertificateCompression
* @bug 8231449
* @summary This test verifies that the HttpClient works correctly when the server
* sends a large certificate. This test will not pass without
@ -84,13 +84,42 @@ import static java.net.http.HttpOption.H3_DISCOVERY;
* @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext
* DigestEchoServer
* jdk.httpclient.test.lib.common.TestServerConfigurator
* @run main/othervm -Dtest.requiresHost=true
* @run main/othervm -Djdk.tls.enableCertificateCompression=true
* -Dtest.requiresHost=true
* -Djdk.httpclient.HttpClient.log=headers
* -Djdk.internal.httpclient.debug=true
* -Djdk.tls.maxHandshakeMessageSize=131072
* LargeHandshakeTest
*
*/
/*
* @test id=withoutCertificateCompression
* @bug 8231449
* @summary This test verifies that the HttpClient works correctly when the server
* sends a large certificate. This test will not pass without
* the fix for JDK-8231449. To regenerate the certificate, modify the
* COMMAND constant as you need, possibly changing the start date
* and validity of the certificate in the command, then run the test.
* The test will run with the old certificate, but will print the new command.
* Copy paste the new command printed by this test into a terminal.
* Then modify the at run line to pass the file generated by that command
* as first argument, and copy paste the new values of the COMMAND and
* BASE64_CERT constant printed by the test into the test.
* Then restore the original at run line and test again.
* @library /test/lib /test/jdk/java/net/httpclient/lib
* @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext
* DigestEchoServer
* jdk.httpclient.test.lib.common.TestServerConfigurator
* @run main/othervm -Djdk.tls.enableCertificateCompression=false
* -Dtest.requiresHost=true
* -Djdk.httpclient.HttpClient.log=headers
* -Djdk.internal.httpclient.debug=true
* -Djdk.tls.maxHandshakeMessageSize=131072
* LargeHandshakeTest
*
*/
public class LargeHandshakeTest implements HttpServerAdapters {
// Use this command to regenerate the keystore file whose content is