Skip to content

Commit

Permalink
Merge pull request #19808 from cescoffier/vertx-4.1.3
Browse files Browse the repository at this point in the history
Update to Vertx 4.1.3, Mutiny Bindings 2.13.0 and Netty 4.1.67
  • Loading branch information
cescoffier authored Sep 1, 2021
2 parents fe6b68e + a3d5b90 commit 71628cc
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 9 deletions.
6 changes: 3 additions & 3 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<smallrye-context-propagation.version>1.2.0</smallrye-context-propagation.version>
<smallrye-reactive-streams-operators.version>1.0.13</smallrye-reactive-streams-operators.version>
<smallrye-reactive-types-converter.version>2.6.0</smallrye-reactive-types-converter.version>
<smallrye-mutiny-vertx-binding.version>2.12.0</smallrye-mutiny-vertx-binding.version>
<smallrye-mutiny-vertx-binding.version>2.13.0</smallrye-mutiny-vertx-binding.version>
<smallrye-reactive-messaging.version>3.9.1</smallrye-reactive-messaging.version>
<jakarta.activation.version>1.2.1</jakarta.activation.version>
<jakarta.annotation-api.version>1.3.5</jakarta.annotation-api.version>
Expand Down Expand Up @@ -109,7 +109,7 @@
<wildfly-elytron.version>1.16.1.Final</wildfly-elytron.version>
<jboss-modules.version>1.8.7.Final</jboss-modules.version>
<jboss-threads.version>3.4.2.Final</jboss-threads.version>
<vertx.version>4.1.2</vertx.version>
<vertx.version>4.1.3</vertx.version>
<httpclient.version>4.5.13</httpclient.version>
<httpcore.version>4.4.14</httpcore.version>
<httpasync.version>4.1.4</httpasync.version>
Expand All @@ -131,7 +131,7 @@
<infinispan.version>12.1.7.Final</infinispan.version>
<infinispan.protostream.version>4.4.1.Final</infinispan.protostream.version>
<caffeine.version>2.9.2</caffeine.version>
<netty.version>4.1.65.Final</netty.version>
<netty.version>4.1.67.Final</netty.version>
<reactive-streams.version>1.0.3</reactive-streams.version>
<jboss-logging.version>3.4.2.Final</jboss-logging.version>
<mutiny.version>1.0.0</mutiny.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public JavaArchive get() {
return ShrinkWrap.create(JavaArchive.class)
.addClasses(Resource.class, Data.class)
.addAsResource(new StringAsset(
"quarkus.http.limits.max-form-attribute-size=4K"),
"quarkus.http.limits.max-form-attribute-size=120K"),
"application.properties");
}
});
Expand All @@ -49,6 +49,12 @@ public JavaArchive get() {
@Test
public void test() throws IOException {
String fileContents = new String(Files.readAllBytes(FILE.toPath()), StandardCharsets.UTF_8);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 10; ++i) {
sb.append(fileContents);
}
fileContents = sb.toString();

Assertions.assertTrue(fileContents.length() > HttpServerOptions.DEFAULT_MAX_FORM_ATTRIBUTE_SIZE);
given()
.multiPart("text", fileContents)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,21 @@ public void clearDirectory() {

@Test
public void test() throws IOException {
String formAttrSourceFileContents = new String(Files.readAllBytes(FORM_ATTR_SOURCE_FILE.toPath()),
StandardCharsets.UTF_8);
Assertions.assertTrue(formAttrSourceFileContents.length() > HttpServerOptions.DEFAULT_MAX_FORM_ATTRIBUTE_SIZE);
String fileContents = new String(Files.readAllBytes(FORM_ATTR_SOURCE_FILE.toPath()), StandardCharsets.UTF_8);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 10; ++i) {
sb.append(fileContents);
}
fileContents = sb.toString();
Assertions.assertTrue(fileContents.length() > HttpServerOptions.DEFAULT_MAX_FORM_ATTRIBUTE_SIZE);
given()
.multiPart("active", "true")
.multiPart("num", "25")
.multiPart("status", "WORKING")
.multiPart("htmlFile", HTML_FILE, "text/html")
.multiPart("xmlFile", XML_FILE, "text/xml")
.multiPart("txtFile", TXT_FILE, "text/plain")
.multiPart("name", formAttrSourceFileContents)
.multiPart("name", fileContents)
.accept("text/plain")
.when()
.post("/test")
Expand Down
5 changes: 5 additions & 0 deletions extensions/vertx-http/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>svm</artifactId>
<scope>provided</scope>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package io.quarkus.vertx.http.runtime.graal;

import static io.netty.handler.codec.http.HttpHeaderValues.DEFLATE;
import static io.netty.handler.codec.http.HttpHeaderValues.GZIP;
import static io.netty.handler.codec.http.HttpHeaderValues.X_DEFLATE;
import static io.netty.handler.codec.http.HttpHeaderValues.X_GZIP;

import java.util.function.BooleanSupplier;

import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.handler.codec.compression.ZlibWrapper;
import io.netty.handler.codec.http2.CompressorHttp2ConnectionEncoder;
import io.netty.handler.codec.http2.Http2Exception;

public class HttpContentCompressorSubstitutions {

@TargetClass(className = "io.netty.handler.codec.compression.ZstdEncoder", onlyWith = IsZstdAbsent.class)
public static final class ZstdEncoderFactorySubstitution {

@Substitute
protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) throws Exception {
throw new UnsupportedOperationException();
}

@Substitute
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) {
throw new UnsupportedOperationException();
}

@Substitute
public void flush(final ChannelHandlerContext ctx) {
throw new UnsupportedOperationException();
}
}

@TargetClass(className = "io.netty.handler.codec.compression.BrotliEncoder", onlyWith = IsBrotliAbsent.class)
public static final class BrEncoderFactorySubstitution {

@Substitute
protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) throws Exception {
throw new UnsupportedOperationException();
}

@Substitute
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) {
throw new UnsupportedOperationException();
}
}

@TargetClass(CompressorHttp2ConnectionEncoder.class)
public static final class CompressorHttp2ConnectionSubstitute {

@Substitute
protected EmbeddedChannel newContentCompressor(ChannelHandlerContext ctx, CharSequence contentEncoding)
throws Http2Exception {
if (GZIP.contentEqualsIgnoreCase(contentEncoding) || X_GZIP.contentEqualsIgnoreCase(contentEncoding)) {
return newCompressionChannel(ctx, ZlibWrapper.GZIP);
}
if (DEFLATE.contentEqualsIgnoreCase(contentEncoding) || X_DEFLATE.contentEqualsIgnoreCase(contentEncoding)) {
return newCompressionChannel(ctx, ZlibWrapper.ZLIB);
}
// 'identity' or unsupported
return null;
}

@Alias
private EmbeddedChannel newCompressionChannel(final ChannelHandlerContext ctx, ZlibWrapper wrapper) {
throw new UnsupportedOperationException();
}
}

public static class IsZstdAbsent implements BooleanSupplier {

private boolean zstdAbsent;

public IsZstdAbsent() {
try {
Class.forName("com.github.luben.zstd.Zstd");
zstdAbsent = false;
} catch (ClassNotFoundException e) {
zstdAbsent = true;
}
}

@Override
public boolean getAsBoolean() {
return zstdAbsent;
}
}

public static class IsBrotliAbsent implements BooleanSupplier {

private boolean brotliAbsent;

public IsBrotliAbsent() {
try {
Class.forName("com.aayushatharva.brotli4j.encoder.Encoder");
brotliAbsent = false;
} catch (ClassNotFoundException e) {
brotliAbsent = true;
}
}

@Override
public boolean getAsBoolean() {
return brotliAbsent;
}
}
}
2 changes: 1 addition & 1 deletion independent-projects/resteasy-reactive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<jakarta.json.version>1.1.6</jakarta.json.version>
<mutiny.version>1.0.0</mutiny.version>
<smallrye-common.version>1.6.0</smallrye-common.version>
<vertx.version>4.1.2</vertx.version>
<vertx.version>4.1.3</vertx.version>
<rest-assured.version>4.4.0</rest-assured.version>
<commons-logging-jboss-logging.version>1.0.0.Final</commons-logging-jboss-logging.version>
<jboss-jaxb-api_2.3_spec.version>2.0.0.Final</jboss-jaxb-api_2.3_spec.version>
Expand Down

0 comments on commit 71628cc

Please sign in to comment.