From b8541c5513cde867e133778ee43b553eefc59754 Mon Sep 17 00:00:00 2001 From: Pedro Igor Date: Fri, 20 Oct 2023 16:27:40 -0300 Subject: [PATCH] Fix handling of HTTP/2 H2 empty frames in Resteasy Reactive Closes #36604 (cherry picked from commit ac01be43aa2dc1a94c5388f7769f88f80c436216) --- .../resteasy/reactive/server/vertx/VertxInputStream.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxInputStream.java b/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxInputStream.java index 9c56278499d75..79fbca1eec094 100644 --- a/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxInputStream.java +++ b/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxInputStream.java @@ -18,6 +18,7 @@ import io.vertx.core.http.HttpHeaders; import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.HttpServerResponse; +import io.vertx.core.http.HttpVersion; import io.vertx.core.net.impl.ConnectionBase; import io.vertx.ext.web.RoutingContext; @@ -271,6 +272,14 @@ protected ByteBuf readBlocking() throws IOException { @Override public void handle(Buffer event) { synchronized (request.connection()) { + if (event.length() == 0 && request.version() == HttpVersion.HTTP_2) { + // When using HTTP/2 H2, this indicates that we won't receive anymore data. + eof = true; + if (waiting) { + request.connection().notifyAll(); + } + return; + } if (input1 == null) { input1 = event; } else {