diff --git a/extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java b/extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java index 8b5c2654937cd..2cdbc4a8db83b 100644 --- a/extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java +++ b/extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java @@ -115,7 +115,12 @@ public void handleMessage(Object msg) { } final StringBuilder sb = new StringBuilder(); for (Iterator valueIterator = allForName.iterator(); valueIterator.hasNext();) { - sb.append(valueIterator.next()); + String val = valueIterator.next(); + if (name.equalsIgnoreCase("Transfer-Encoding") + && val.equals("chunked")) { + continue; // ignore transfer encoding, chunked screws up message and response + } + sb.append(val); if (valueIterator.hasNext()) { sb.append(","); } diff --git a/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java b/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java index 60ca58ffa0359..17d744cc4af90 100644 --- a/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java +++ b/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java @@ -97,7 +97,13 @@ public void handleMessage(Object msg) { } responseBuilder.setMultiValueHeaders(new Headers()); for (String name : res.headers().names()) { + if (name.equalsIgnoreCase("Transfer-Encoding")) { + continue; // ignore transfer encoding, chunked screws up message and response + } for (String v : res.headers().getAll(name)) { + if (name.equalsIgnoreCase("Transfer-Encoding") && v.contains("chunked")) { + continue; + } responseBuilder.getMultiValueHeaders().add(name, v); } } diff --git a/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/DevServicesLambdaProcessor.java b/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/DevServicesLambdaProcessor.java index 7bac8713f014a..17661e6611b34 100644 --- a/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/DevServicesLambdaProcessor.java +++ b/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/DevServicesLambdaProcessor.java @@ -12,17 +12,17 @@ import io.quarkus.amazon.lambda.runtime.AmazonLambdaApi; import io.quarkus.amazon.lambda.runtime.LambdaHotReplacementRecorder; import io.quarkus.amazon.lambda.runtime.MockEventServer; -import io.quarkus.bootstrap.classloading.QuarkusClassLoader; import io.quarkus.deployment.Feature; import io.quarkus.deployment.IsNormal; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.Produce; import io.quarkus.deployment.annotations.Record; +import io.quarkus.deployment.builditem.CuratedApplicationShutdownBuildItem; import io.quarkus.deployment.builditem.DevServicesResultBuildItem; import io.quarkus.deployment.builditem.LaunchModeBuildItem; -import io.quarkus.deployment.builditem.RuntimeApplicationShutdownBuildItem; import io.quarkus.deployment.builditem.ServiceStartBuildItem; +import io.quarkus.deployment.dev.devservices.GlobalDevServicesConfig; import io.quarkus.runtime.LaunchMode; public class DevServicesLambdaProcessor { @@ -53,12 +53,12 @@ private boolean legacyTestingEnabled() { } @Produce(ServiceStartBuildItem.class) - @BuildStep(onlyIfNot = IsNormal.class) + @BuildStep(onlyIfNot = IsNormal.class, onlyIf = GlobalDevServicesConfig.Enabled.class) public void startEventServer(LaunchModeBuildItem launchMode, LambdaConfig config, Optional override, BuildProducer devServicePropertiesProducer, - BuildProducer runtimeApplicationShutdownBuildItemBuildProducer) + CuratedApplicationShutdownBuildItem closeBuildItem) throws Exception { if (!launchMode.getLaunchMode().isDevOrTest()) return; @@ -106,10 +106,6 @@ public void startEventServer(LaunchModeBuildItem launchMode, startMode = null; server = null; }; - QuarkusClassLoader cl = (QuarkusClassLoader) Thread.currentThread().getContextClassLoader(); - ((QuarkusClassLoader) cl.parent()).addCloseTask(closeTask); - if (launchMode.isTest()) { - runtimeApplicationShutdownBuildItemBuildProducer.produce(new RuntimeApplicationShutdownBuildItem(closeTask)); - } + closeBuildItem.addCloseTask(closeTask, true); } } diff --git a/extensions/azure-functions-http/runtime/src/main/java/io/quarkus/azure/functions/resteasy/runtime/BaseFunction.java b/extensions/azure-functions-http/runtime/src/main/java/io/quarkus/azure/functions/resteasy/runtime/BaseFunction.java index 4d62c27cea433..0f409fc01f076 100644 --- a/extensions/azure-functions-http/runtime/src/main/java/io/quarkus/azure/functions/resteasy/runtime/BaseFunction.java +++ b/extensions/azure-functions-http/runtime/src/main/java/io/quarkus/azure/functions/resteasy/runtime/BaseFunction.java @@ -104,6 +104,11 @@ public void handleMessage(Object msg) { HttpResponse res = (HttpResponse) msg; responseBuilder = request.createResponseBuilder(HttpStatus.valueOf(res.status().code())); for (Map.Entry entry : res.headers()) { + if (entry.getKey().equalsIgnoreCase("Transfer-Encoding") + && entry.getValue().contains("chunked")) { + continue; // ignore transfer encoding, chunked screws up message and response + } + //log.info("header(" + entry.getKey() + ")=" + entry.getValue()); responseBuilder.header(entry.getKey(), entry.getValue()); } }