From d4dcd6a8c85030786c76c405a31b0051cfd607ca Mon Sep 17 00:00:00 2001 From: gregw Date: Wed, 18 Sep 2024 08:43:04 +1000 Subject: [PATCH] WIP updates from review --- .../eclipse/jetty/http/MultiPartFormData.java | 21 ++++++++----------- .../jetty/server/HttpConnectionFactory.java | 2 -- .../server/internal/HttpChannelState.java | 18 ++++++++++------ .../jetty/server/internal/HttpConnection.java | 1 - 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormData.java b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormData.java index 88f879a5486..69293958022 100644 --- a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormData.java +++ b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormData.java @@ -489,18 +489,15 @@ public class MultiPartFormData */ public void configure(MultiPartConfig config) { - if (config != null) - { - parser.setMaxParts(config.getMaxParts()); - maxMemoryFileSize = config.getMaxMemoryPartSize(); - maxFileSize = config.getMaxPartSize(); - maxLength = config.getMaxSize(); - parser.setPartHeadersMaxLength(config.getMaxHeadersSize()); - useFilesForPartsWithoutFileName = config.isUseFilesForPartsWithoutFileName(); - filesDirectory = config.getLocation(); - complianceListener = config.getViolationListener(); - compliance = config.getMultiPartCompliance(); - } + parser.setMaxParts(config.getMaxParts()); + maxMemoryFileSize = config.getMaxMemoryPartSize(); + maxFileSize = config.getMaxPartSize(); + maxLength = config.getMaxSize(); + parser.setPartHeadersMaxLength(config.getMaxHeadersSize()); + useFilesForPartsWithoutFileName = config.isUseFilesForPartsWithoutFileName(); + filesDirectory = config.getLocation(); + complianceListener = config.getViolationListener(); + compliance = config.getMultiPartCompliance(); } // Only used for testing. diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java index 8c9a2093240..45edd74bf7c 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java @@ -41,8 +41,6 @@ public class HttpConnectionFactory extends AbstractConnectionFactory implements super(HttpVersion.HTTP_1_1.asString()); _config = Objects.requireNonNull(config); installBean(_config); - setUseInputDirectByteBuffers(_config.isUseInputDirectByteBuffers()); - setUseOutputDirectByteBuffers(_config.isUseOutputDirectByteBuffers()); } @Override diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java index b5c981676bf..f567ded55e7 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java @@ -363,6 +363,10 @@ public class HttpChannelState implements HttpChannel, Components if (LOG.isDebugEnabled()) LOG.debug("onIdleTimeout {}", this, t); + // Too late? + if (_request == null || _response == null) + return null; + Runnable invokeOnContentAvailable = null; if (_readFailure == null) { @@ -704,22 +708,24 @@ public class HttpChannelState implements HttpChannel, Components @Override public void succeeded() { - HttpStream completeStream = null; - Throwable failure = null; + HttpStream stream = null; try (AutoLock ignored = _lock.lock()) { assert _callbackCompleted; _streamSendState = StreamSendState.LAST_COMPLETE; if (_handling == null) { - completeStream = _stream; + stream = _stream; _stream = null; - failure = _callbackFailure; + + // TODO remove this before merging + if (_callbackFailure != null) + throw new IllegalStateException("failure in succeeded", _callbackFailure); } } - if (completeStream != null) - completeStream(completeStream, failure); + if (stream != null) + completeStream(stream, null); } /** diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpConnection.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpConnection.java index e945294e912..060f845cd25 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpConnection.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpConnection.java @@ -967,7 +967,6 @@ public class HttpConnection extends AbstractMetaDataConnection implements Runnab _onRequest = stream.headerComplete(); // Should we delay dispatch until we have some content? - // We should not delay if there is no content expect or client is expecting 100 or the response is already committed or the request buffer already has something in it to parse _delayedForContent = getHttpConfiguration().isDelayDispatchUntilContent() && (_parser.getContentLength() > 0 || _parser.isChunking()) && !stream._expects100Continue &&