Issue #9076 - Cleanups and fixes for multipart in Jetty 12#9287
Issue #9076 - Cleanups and fixes for multipart in Jetty 12#9287lachlan-roberts merged 27 commits intojetty-12.0.xfrom
Conversation
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…9066-MultiPart-getParameters
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…9066-MultiPart-getParameters
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…9066-MultiPart-getParameters
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…multipartCleanups
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartByteRanges.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormData.java
Show resolved
Hide resolved
jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/ChunksContentSource.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java
Show resolved
Hide resolved
...-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletApiRequest.java
Outdated
Show resolved
Hide resolved
...e9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/MultiPartFormInputStream.java
Outdated
Show resolved
Hide resolved
jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/Request.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormData.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/HttpStream.java
Outdated
Show resolved
Hide resolved
| List<Content.Chunk> newChunks = content.stream() | ||
| .map(chunk -> Content.Chunk.from(chunk.getByteBuffer().slice(), chunk.isLast())) | ||
| .toList(); | ||
| return new ChunksContentSource(newChunks); |
There was a problem hiding this comment.
Discussing this with @lorban, I think it's best if we store these ChunksContentSource in a List, and we fail them all when this part is closed.
The reason is that in this particular case, if a ChunksContentSource is read after completing the Handler callback, it can read content from buffers that were returned to the pool and may be used for other requests.
By failing them, we guarantee that if they are read after Handler completion, an error is returned.
There was a problem hiding this comment.
What if someone calls newContentSource() after the part has been closed, do we need to keep an atomic state and if this has been closed return them a failed instance of Content.Source when they call newContentSource()?
Why can't we just say if this have been closed it is invalid to use it. Just like if you return a RetainableByteBuffer to the pool it is invalid to continue using it.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
sbordet
left a comment
There was a problem hiding this comment.
Please fix test failures, and then LGTM.
…multipartCleanups
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…x-documentation-operations-logging * upstream/jetty-12.0.x: (35 commits) Fixes jetty#9326 - Rename DecryptedEndPoint to SslEndPoint. Jetty 10 Upgrade to Hazelcast 5 and totally disable auto join multicast etc.. (fix build on CI) (jetty#9331) jetty#9328 - changes from review jetty#9287 - catch error in ee9 maxRequestSize MultiPart test Jetty 12.0.x 9301 fix ee10 jstl jpms (jetty#9321) Issue jetty#9301 Fix dependencies for ee10-glassfish-jstl module (jetty#9303) Jetty 12 Hazelcast 5.x and disable auto detection/multicast" (jetty#9332) jetty#9287 - fix further test failures Fixed imports. Issue jetty#7650 - Fix race condition when stopping QueuedThreadPool (jetty#9325) jetty#9287 - remove unpaired release of Content.Chunk Issue jetty#8991 - rename websocket isDemanding() method to isAutoDemanding() Issue jetty#9287 - fix failing tests changes f rom review add todo to revert to normal pool after fix for jetty#9311 Issue jetty#9309 - Introducing test for requestlog format with spaces use non-pooling RetainableByteBufferPool to work around performance bug consumeAvailable should use number of reads instead of bytes fix for retainable merge changes from review ...
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
| if (_parser.isTerminated()) | ||
| throw new RuntimeIOException("Parser is terminated"); |
There was a problem hiding this comment.
@lachlan-roberts @sbordet I think this is causing #12212
Can you recall why this was necessary?
There was a problem hiding this comment.
Issue #9076
MAX_FORM_KEYS_KEYandMAX_FORM_CONTENT_SIZE_KEYparameters to configure limits for multipart.Part.delete()will delete any file storage for that part.newContentSource()method to get a newContent.Sourceevery time from the part.