You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2025/12/28 09:44:35 UTC

(httpcomponents-core) branch master updated: Disable settings_push_enable on the H2Config for H2ServerBootstrap (#591)

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

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 712b33c0f Disable settings_push_enable on the H2Config for H2ServerBootstrap (#591)
712b33c0f is described below

commit 712b33c0f25372ff2f807d1219a5aef85c496999
Author: CoolTomatos <24...@users.noreply.github.com>
AuthorDate: Sun Dec 28 10:44:29 2025 +0100

    Disable settings_push_enable on the H2Config for H2ServerBootstrap (#591)
---
 .../apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
index 1d2aab3ce..28bf832e8 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
@@ -86,6 +86,8 @@
 @SuppressWarnings("deprecation")
 public class H2ServerBootstrap {
 
+    private static final H2Config DEFAULT_H2_CONFIG = H2Config.custom().setPushEnabled(false).build();
+
     private final List<RequestRouter.Entry<Supplier<AsyncServerExchangeHandler>>> routeEntries;
     private final List<FilterEntry<AsyncFilterHandler>> filters;
     private String canonicalHostName;
@@ -163,6 +165,7 @@ public final H2ServerBootstrap setVersionPolicy(final HttpVersionPolicy versionP
      * @return this instance.
      */
     public final H2ServerBootstrap setH2Config(final H2Config h2Config) {
+        Args.check(!h2Config.isPushEnabled(), "A server MUST NOT set enable_push to true");
         this.h2Config = h2Config;
         return this;
     }
@@ -522,7 +525,7 @@ public HttpAsyncServer create() {
         final ServerH2StreamMultiplexerFactory http2StreamHandlerFactory = new ServerH2StreamMultiplexerFactory(
                 httpProcessor != null ? httpProcessor : H2Processors.server(),
                 handlerFactory,
-                h2Config != null ? h2Config : H2Config.DEFAULT,
+                h2Config != null ? h2Config : DEFAULT_H2_CONFIG,
                 charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT,
                 h2StreamListener,
                 frameFactory);