diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java index 454eeee85faf1..e9e973747e375 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java @@ -215,7 +215,7 @@ public static Channel createChannel(String name, Set perClientIntercepto } Optional idleTimeout = config.idleTimeout; if (idleTimeout.isPresent()) { - builder.keepAliveTimeout(idleTimeout.get().toMillis(), TimeUnit.MILLISECONDS); + builder.idleTimeout(idleTimeout.get().toMillis(), TimeUnit.MILLISECONDS); } if (plainText && provider == null) { diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java index ade164d92f850..de5c3aae57bd0 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java @@ -13,7 +13,7 @@ */ public class DateTimeAttribute implements ExchangeAttribute { - private static final String COMMON_LOG_PATTERN = "[dd/MMM/yyyy:HH:mm:ss Z]"; + private static final String COMMON_LOG_PATTERN = "'['dd/MMM/yyyy:HH:mm:ss Z']'"; public static final String DATE_TIME_SHORT = "%t"; public static final String DATE_TIME = "%{DATE_TIME}"; diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/Encode.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/Encode.java index cb171a629f86d..faf7c92ad2012 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/Encode.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/Encode.java @@ -389,6 +389,12 @@ protected static String encodeFromArray(String segment, String[] encodingMap, bo result.append(currentChar); continue; } + if (Character.isHighSurrogate(currentChar)) { + String part = segment.substring(i, i + 2); + result.append(URLEncoder.encode(part, StandardCharsets.UTF_8)); + ++i; + continue; + } String encoding = encode(currentChar, encodingMap); if (encoding == null) { result.append(currentChar); diff --git a/independent-projects/resteasy-reactive/common/runtime/src/test/java/org/jboss/resteasy/reactive/common/util/EncodeTest.java b/independent-projects/resteasy-reactive/common/runtime/src/test/java/org/jboss/resteasy/reactive/common/util/EncodeTest.java new file mode 100644 index 0000000000000..9e057ce31126f --- /dev/null +++ b/independent-projects/resteasy-reactive/common/runtime/src/test/java/org/jboss/resteasy/reactive/common/util/EncodeTest.java @@ -0,0 +1,18 @@ +package org.jboss.resteasy.reactive.common.util; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +import org.junit.jupiter.api.Test; + +class EncodeTest { + @Test + void encodeEmoji() { + String emoji = "\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00"; + String encodedEmoji = URLEncoder.encode(emoji, StandardCharsets.UTF_8); + assertEquals(encodedEmoji, Encode.encodePath(emoji)); + assertEquals(encodedEmoji, Encode.encodeQueryParam(emoji)); + } +} diff --git a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/AccessLogTestCase.java b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/AccessLogTestCase.java index da7b395710d3e..5d0051a1b75ee 100644 --- a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/AccessLogTestCase.java +++ b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/AccessLogTestCase.java @@ -2,7 +2,6 @@ import static org.hamcrest.Matchers.containsString; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -23,12 +22,11 @@ public class AccessLogTestCase { /** * Fires a HTTP request, to an application which has access log enabled and then checks * the access-log contents to verify that the request was logged - * - * @throws Exception */ @Test - public void testAccessLogContent() throws Exception { + public void testAccessLogContent() { final Path logDirectory = Paths.get(".", "target"); + final Path accessLogFilePath = logDirectory.resolve("quarkus-access-log.log"); final String queryParamVal = UUID.randomUUID().toString(); final String targetUri = "/simple/access-log-test-endpoint?foo=" + queryParamVal; RestAssured.when().get(targetUri).then().body(containsString("passed")); @@ -37,15 +35,18 @@ public void testAccessLogContent() throws Exception { .untilAsserted(new ThrowingRunnable() { @Override public void run() throws Throwable { - final Path accessLogFilePath = logDirectory.resolve("quarkus-access-log.log"); Assertions.assertTrue(Files.exists(accessLogFilePath), "access log file " + accessLogFilePath + " is missing"); - String data = new String(Files.readAllBytes(accessLogFilePath), StandardCharsets.UTF_8); - Assertions.assertTrue(data.contains(targetUri), + String line = Files.readString(accessLogFilePath); + Assertions.assertTrue(line.startsWith("127.0.0.1 - - ["), + "access log doesn't contain request IP or does not wrap the date with []: " + line); + Assertions.assertTrue(line.contains("] \"GET"), + "access log doesn't contain the HTTP method or does not wrap the date with []: " + line); + Assertions.assertTrue(line.contains(targetUri), "access log doesn't contain an entry for " + targetUri); - Assertions.assertTrue(data.contains("?foo=" + queryParamVal), + Assertions.assertTrue(line.contains("?foo=" + queryParamVal), "access log is missing query params"); - Assertions.assertFalse(data.contains("?foo=" + queryParamVal + "?foo=" + queryParamVal), + Assertions.assertFalse(line.contains("?foo=" + queryParamVal + "?foo=" + queryParamVal), "access log contains duplicated query params"); } }); diff --git a/pom.xml b/pom.xml index 9154f8a1af00f..42ac757beb59b 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ - 1.51.1 + 1.53.0 1.2.1 3.22.0 ${protoc.version}