This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git


The following commit(s) were added to refs/heads/master by this push:
     new 30f95a1e [MRESOLVER-629] JDK transport should default to HTTP/1.1 
(#600)
30f95a1e is described below

commit 30f95a1e66830e4418153ace42ea6bb886fc88e8
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Thu Nov 14 11:34:19 2024 +0100

    [MRESOLVER-629] JDK transport should default to HTTP/1.1 (#600)
    
    As it cannot cope well with HTTP/2 GOAWAY frame
    
    ---
    
    https://issues.apache.org/jira/browse/MRESOLVER-629
---
 .../eclipse/aether/internal/test/util/http/HttpTransporterTest.java  | 3 +++
 .../aether/transport/jdk/JdkTransporterConfigurationKeys.java        | 2 +-
 .../java/org/eclipse/aether/transport/jdk/JdkTransporterTest.java    | 5 +++++
 src/site/markdown/configuration.md                                   | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/maven-resolver-test-http/src/main/java/org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java
 
b/maven-resolver-test-http/src/main/java/org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java
index b7681199..2c709de5 100644
--- 
a/maven-resolver-test-http/src/main/java/org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java
+++ 
b/maven-resolver-test-http/src/main/java/org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java
@@ -581,6 +581,7 @@ public class HttpTransporterTest {
     protected void testGet_HTTPS_HTTP2Only_Insecure_SecurityMode() throws 
Exception {
         // here we use alternate server-store-selfigned key (as the key set it 
static initializer is probably already
         // used to init SSLContext/SSLSocketFactory/etc
+        enableHttp2Protocol();
         session.setConfigProperty(
                 ConfigurationProperties.HTTPS_SECURITY_MODE, 
ConfigurationProperties.HTTPS_SECURITY_MODE_INSECURE);
         httpServer.addSelfSignedSslConnectorHttp2Only();
@@ -596,6 +597,8 @@ public class HttpTransporterTest {
         assertEquals(task.getDataString(), 
listener.getBaos().toString(StandardCharsets.UTF_8));
     }
 
+    protected void enableHttp2Protocol() {}
+
     @Test
     protected void testGet_Redirect() throws Exception {
         httpServer.addSslConnector();
diff --git 
a/maven-resolver-transport-jdk-parent/maven-resolver-transport-jdk-11/src/main/java/org/eclipse/aether/transport/jdk/JdkTransporterConfigurationKeys.java
 
b/maven-resolver-transport-jdk-parent/maven-resolver-transport-jdk-11/src/main/java/org/eclipse/aether/transport/jdk/JdkTransporterConfigurationKeys.java
index 92bf1cad..83b72fa3 100644
--- 
a/maven-resolver-transport-jdk-parent/maven-resolver-transport-jdk-11/src/main/java/org/eclipse/aether/transport/jdk/JdkTransporterConfigurationKeys.java
+++ 
b/maven-resolver-transport-jdk-parent/maven-resolver-transport-jdk-11/src/main/java/org/eclipse/aether/transport/jdk/JdkTransporterConfigurationKeys.java
@@ -42,7 +42,7 @@ public final class JdkTransporterConfigurationKeys {
      */
     public static final String CONFIG_PROP_HTTP_VERSION = CONFIG_PROPS_PREFIX 
+ "httpVersion";
 
-    public static final String DEFAULT_HTTP_VERSION = "HTTP_2";
+    public static final String DEFAULT_HTTP_VERSION = "HTTP_1_1";
 
     /**
      * The hard limit of maximum concurrent requests JDK transport can do. 
This is a workaround for the fact, that in
diff --git 
a/maven-resolver-transport-jdk-parent/maven-resolver-transport-jdk-11/src/test/java/org/eclipse/aether/transport/jdk/JdkTransporterTest.java
 
b/maven-resolver-transport-jdk-parent/maven-resolver-transport-jdk-11/src/test/java/org/eclipse/aether/transport/jdk/JdkTransporterTest.java
index 9bcd1395..3d972c00 100644
--- 
a/maven-resolver-transport-jdk-parent/maven-resolver-transport-jdk-11/src/test/java/org/eclipse/aether/transport/jdk/JdkTransporterTest.java
+++ 
b/maven-resolver-transport-jdk-parent/maven-resolver-transport-jdk-11/src/test/java/org/eclipse/aether/transport/jdk/JdkTransporterTest.java
@@ -93,6 +93,11 @@ class JdkTransporterTest extends HttpTransporterTest {
         super(() -> new JdkTransporterFactory(standardChecksumExtractor(), new 
DefaultPathProcessor()));
     }
 
+    @Override
+    protected void enableHttp2Protocol() {
+        
session.setConfigProperty(JdkTransporterConfigurationKeys.CONFIG_PROP_HTTP_VERSION,
 "HTTP_2");
+    }
+
     @Test
     void enhanceConnectExceptionMessages() {
         String uri = "https://localhost:12345/";;
diff --git a/src/site/markdown/configuration.md 
b/src/site/markdown/configuration.md
index 84747e6c..65d06686 100644
--- a/src/site/markdown/configuration.md
+++ b/src/site/markdown/configuration.md
@@ -132,7 +132,7 @@ under the License.
 | 106. | `"aether.transport.http.supportWebDav"` | `Boolean` | Boolean flag 
should the HTTP transport support WebDAV remote. Not all transport support this 
option. |  `false`  | 2.0.0 (moved out from maven-resolver-transport-http). |  
Yes  | Session Configuration |
 | 107. | `"aether.transport.http.userAgent"` | `String` | The user agent that 
repository connectors should report to servers. |  `"Aether"`  |  |  No  | 
Session Configuration |
 | 108. | `"aether.transport.https.securityMode"` | `String` | The mode that 
sets HTTPS transport "security mode": to ignore any SSL errors (certificate 
validity checks, hostname verification). The default value is 
<code>#HTTPS_SECURITY_MODE_DEFAULT</code> . |  `"default"`  | 1.9.6 |  Yes  | 
Session Configuration |
-| 109. | `"aether.transport.jdk.httpVersion"` | `String` | Use string 
representation of HttpClient version enum "HTTP_2" or "HTTP_1_1" to set default 
HTTP protocol to use. |  `"HTTP_2"`  | 2.0.0 |  Yes  | Session Configuration |
+| 109. | `"aether.transport.jdk.httpVersion"` | `String` | Use string 
representation of HttpClient version enum "HTTP_2" or "HTTP_1_1" to set default 
HTTP protocol to use. |  `"HTTP_1_1"`  | 2.0.0 |  Yes  | Session Configuration |
 | 110. | `"aether.transport.jdk.maxConcurrentRequests"` | `Integer` | The hard 
limit of maximum concurrent requests JDK transport can do. This is a workaround 
for the fact, that in HTTP/2 mode, JDK HttpClient initializes this value to 
Integer.MAX_VALUE (!) and lowers it on first response from the remote server 
(but it may be too late). See JDK bug <a 
href="https://bugs.openjdk.org/browse/JDK-8225647";>JDK-8225647</a> for details. 
|  `100`  | 2.0.0 |  Yes  | Session Configuration |
 | 111. | `"aether.transport.jetty.followRedirects"` | `Boolean` | If enabled, 
Jetty client will follow HTTP redirects. |  `true`  | 2.0.1 |  Yes  | Session 
Configuration |
 | 112. | `"aether.transport.jetty.maxRedirects"` | `Integer` | The max 
redirect count to follow. |  `5`  | 2.0.1 |  Yes  | Session Configuration |

Reply via email to