Commit Graph

349 Commits

Author SHA1 Message Date
Greg Wilkins 67f194a818
Improve javadoc of Violations for #9444 (#10079)
Improve javadoc of Violations for #9444
2023-07-10 10:03:06 +02:00
Lachlan Roberts 7cee1f54ba add SizeLimitHandler to Jetty-12
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-07-06 13:59:00 +10:00
Greg Wilkins ec2dbe73a8
Fully async Multipart Form handling (#9975)
A fully async ContentSourceCompletableFuture for use by MultiPartFormData and MultiPartByteRanges
Restructure MultiPartFormData to have a Parser class
---------

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2023-06-30 17:01:16 +02:00
Greg Wilkins daa7167834
Implement quality lists for Locales (#9983)
Implement quality lists for Locales that orders known locales before unknown.
2023-06-28 14:22:13 +02:00
Greg Wilkins a3e82326cf
Experiment/jetty 12 chunk isError and warnings (#9904)
* Remove usage of instanceof Content.Chunk.Error
* Updated AsyncContent to accept a transient failures
* Updated AsyncContent to accept a transient failure with inputstream
2023-06-23 09:17:15 +02:00
Greg Wilkins 0b1c28a888
Jetty 12 inserted handler in ee10 servlet context (#9927)
This PR refactors the ee10 handing of servlet API request and response objects:

 + The ServletContextHandler matches the request to a servlet and creates a one time only ServletContextRequest and a ServletContextResponse
 + A reusable ServletChannel object with all the heavy weight HttpInput and HttpOutput object is associated with the ServletContextRequest and ServletContextResponse.
 + Once the handling reaches the ServletHandler, the possibly wrapped request, response and callback are associated with the ServletChannel before handling.
 + Were possible the ServletApiRequest and ServletApiResponse use the possibly wrapped request/response

Added tests to check that GzipHandler can now be nested inside of an EE10 context.

---------

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: gregw <gregw@webtide.com>
Co-authored-by: Ludovic Orban <lorban@bitronix.be>
2023-06-22 17:04:49 +02:00
Jan Bartel 715535ab95 Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2023-06-22 11:50:06 +02:00
Ludovic Orban 8e79c1b58b
Add `EventsHandler` API (#9901)
* #8885 add EventsHandler API

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-06-15 17:31:11 +02:00
Greg Wilkins a44a99ad9b
SetCookieHttpField #9173 (#9789)
Added utility methods and classes to allow for efficient interception of a Set-Cookie header in a HttpStream wrapper.
2023-06-07 13:50:19 +02:00
Lachlan Roberts 9acd5e83dc Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2023-05-29 16:47:59 +10:00
Greg Wilkins 18c4846b1c
Jetty 12 simplify EchoHandler (#9783) 2023-05-18 09:50:09 +02:00
Greg Wilkins 068a60a868
Simplified QuotedStringTokenizer (#9729)
Simplified QuotedStringTokenizer #9729
* Now implements a simple subset of `quoted-string` from RFC9110
* introduced builder
* Extracted QuotedStringTokenizer interface and re-introduced the legacy implementation
* Re-introduced the ability to have unescaped \ in filenames
* Whitespace is Character.isWhiteSpace
* Disable test pending RFC8187
* No OWS around =
2023-05-18 08:25:53 +02:00
Joakim Erdfelt 2fdcae40f0
Refine how Request / Channel / Stream completion works (#9684)
Fixes #9684
+ Restore LargeHeaderTest Test
+ Fix Bad Content-Length produced if write + error occurs
+ Fix race between callback failure and error handling failure
+ Introduce new ResponseCompleteTest to attempt to capture complete race issue
+ More DEBUG + ignoring failure for completeStream
+ Removed ErrorResponse in favour or an errorMode

---------

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: gregw <gregw@webtide.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2023-05-15 08:15:37 +02:00
Jan Bartel 2261ce9a50
Issue #9762 ee9 double parses cookies (#9764)
* Issue #9762 ee9 double parses cookies

* implemented the TODOs to cache servlet cookies

---------

Co-authored-by: gregw <gregw@webtide.com>
2023-05-12 17:14:44 +02:00
Lachlan Roberts 422cddf8b1 merge hpack/qpack changes to 12 from #9634
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-05-08 16:44:28 +10:00
Greg Wilkins 4c16e6a707
Jetty 12 content length 0 take3 (#9740)
* Optimize Content-Length: 0 handling

Create and use a pre-encoded HttpFields.CONTENT_LENGTH_0 constant
Used the constant in more places
renamed the `putLongField` methods of HttpFields.Mutable to just `put`
Fixed wrong docs examples
2023-05-07 19:22:15 +02:00
Simone Bordet baf72248aa
Fixed tests after merge.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-05-04 22:36:00 +02:00
Simone Bordet 3463e42861
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-05-04 12:08:00 +02:00
Greg Wilkins 7275bf15a9
Jetty 12.0.x core security (#9405)
core security module

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: gregw <gregw@webtide.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Jan Bartel <janb@webtide.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2023-05-02 15:35:49 +02:00
Olivier Lamy 46018e6057
Jetty-12.0.x tests in parallel (down build time on CI from 1h25 to 55min) some modules are still not parallel due to some static usage (#9635)
* parallel tests runs

---------

Signed-off-by: Olivier Lamy <olamy@apache.org>
2023-04-21 10:42:12 +10:00
Ludovic Orban f28784fe0d #9410 Fix thread-safety of fail() implementations and buffer leaks
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-04-13 11:59:48 +02:00
gregw 90de876770 Fixed default for #9444 2023-04-11 11:36:11 +02:00
Lachlan 7ebd07d18d
Merge pull request #9628 from eclipse/jetty-12.0.x-9554-Hpack-Qpack
Issue #9554 - move common hpack/qpack code to jetty-http
2023-04-11 16:07:52 +10:00
Simone Bordet ca2d85d8a0
Jetty 12 rehandle welcome files (#8856)
* Introduced WelcomeMode so that now welcome files can be redirected, served, or rehandled.
* Updated ResourceHandler and DefaultServlet accordingly.
* Introduced WelcomeServletMode to replace 2 booleans.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-04-08 18:59:18 +02:00
Simone Bordet 744b37f80b
Fixes #7608 - Jetty-12 MetaData cleanup needed (#9618)
* Removed unnecessary constructors from MetaData, MetaData.Request and MetaData.Response.
* Removed MetaData.Request.getURIString() (available as getHttpURI().toString()).
* Renamed MetaData.getFields() -> getHttpFields(), as they can be headers or trailers.
* Renamed MetaData.Request.getURI() -> getHttpURI().
* Normalized handling of contentLength, now always -1 (rather than Long.MIN_VALUE) if unknown.
* Permutated MetaData.Response constructor parameters to be consistent with MetaData.Request.
* MetaData.Request's method and httpURI must be non-null.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-04-07 21:23:01 +02:00
Lachlan Roberts e187309c6c move huffman tables into separate class
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-04-05 21:13:30 +10:00
Lachlan Roberts 183291ee64 Issue #9554 - un-duplicate implementation for HPACK integer decoding.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-04-05 16:35:06 +10:00
Lachlan Roberts 7fb5b422fe Issue #9554 - un-duplicate implementation for HuffmanDecoder
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-04-05 16:04:04 +10:00
Lachlan Roberts f6688b0208 Issue #9554 - move Hpack/Qpack common classes to jetty-http
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-04-05 15:56:17 +10:00
Greg Wilkins 8636666eec
Jetty 12 - Remove ISO-8859-1 fallback decoding during UTF-8 decoding (#9507)
* Deleted the Ut8fStringBuffer and Utf8Appendable classes in favour of just having Utf8StringBuilder
* Simplified the Utf8StringBuilder and CharsetStringBuilder APIs and improved their exception throwing.
* Allow for replacement characters without throwing

---------

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: gregw <gregw@webtide.com>
Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2023-04-04 10:57:07 +02:00
Ludovic Orban 46a250ebe8
#9538 - fixed testParallelContentSourceListenersTotalFailure (#9543)
* #9538 - fixed testParallelContentSourceListenersTotalFailure

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-03-29 23:00:45 +02:00
Joakim Erdfelt 46cdb70449
Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2023-03-20 12:05:57 -05:00
Greg Wilkins bd0186c2f7
Jetty 12.0.x 9444 servlet paths fully decoded (#9479)
getServletPath and getPathInfo will never return an encoded path segment. Instead, they will throw an IllegalArgumentException if they are called when there is a URI with violations.

Signed-off-by: gregw <gregw@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2023-03-11 14:13:09 +01:00
Greg Wilkins b63c5ef611
HttpMessage interface for BadMessageException
Convert class BadMessageException to a HttpMessage.RuntimeException to allows different types of HttpExceptions exceptions.
This follows the pattern of the QuietException interface.
2023-03-10 09:59:05 +01:00
Joakim Erdfelt 0099491435
Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2023-03-08 14:31:45 -06:00
Greg Wilkins 916cd9894d
Decode safe Path for #9444 (#9455)
Added URIUtil.decodeSafePath for EE10, to allow for %2F and %25 to remain encoded in the servlet API.
Fixed async dispatch to also safeDecode
Updated tests to expect decoded space
Apply suggestions from code review

Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2023-03-03 14:36:19 +01:00
Ludovic Orban e819809723
Fix `HugeResourceTest` (#9411)
#9408: restored HugeResourceTest:
 - fixed double-release bug in MultiPartFormData
 - used ByteBufferPool.NonPooling pool to work around #9311

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-02-27 09:12:50 +01:00
Simone Bordet e4c46b1e14
Fixes #9440 - Jetty 12: HttpCookieStore should return cookies for "ws" schemes (#9441)
Now only using whether the scheme is secure in the key used to store cookies,
not the scheme string.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-02-26 23:06:03 +01:00
Greg Wilkins 6c114b00db
Improve CookieCompliance testing (#9399)
Improved handling of CookieCompliance.from method
Added tests for request and response cookie handling
Use from in jetty.xml

Signed-off-by: gregw <gregw@webtide.com>
2023-02-23 20:35:51 +11:00
gregw af8bd97f55 Fixed Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x
# Conflicts:
#	jetty-core/jetty-http/src/test/java/org/eclipse/jetty/http/RFC6265CookieParserLenientTest.java
#	jetty-core/jetty-http/src/test/java/org/eclipse/jetty/http/RFC6265CookieParserTest.java
#	jetty-core/jetty-server/src/main/config/etc/jetty.xml
#	jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ServerHttpCookieTest.java
#	jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/Cookies.java
#	jetty-http/src/main/java/org/eclipse/jetty/http/HttpCookie.java
#	pom.xml
2023-02-21 22:17:21 +11:00
gregw b720d65f4f Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2023-02-21 22:01:31 +11:00
Lachlan b0fa9e20cb
Merge pull request #9357 from eclipse/jetty-12.0.x-9336-ChunksPart
Issue #9336 - remember ContentSources to fail from ChunksPart
2023-02-16 10:40:08 +11:00
Lachlan Roberts 5775887786 Issue #9336 - remember ContentSources to fail from ChunksPart
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-02-15 23:24:47 +11:00
gregw a15af55a56 Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x
Signed-off-by: gregw <gregw@webtide.com>
2023-02-15 15:31:33 +11:00
Jan Bartel b9b26e2a82
Jetty 12 - Restore ee10 tests (#9214)
* Restore jetty-ee10-test-http2-webapp and jetty-ee10-test-integration modules

Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
2023-02-15 14:24:55 +11:00
gregw 015e3d761c Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x
# Conflicts:
#	jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/CookieCutter.java
#	jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/CookieParser.java
#	jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/RFC6265CookieParser.java
#	jetty-core/jetty-http/src/test/java/org/eclipse/jetty/http/CookieCutterTest.java
#	jetty-core/jetty-http/src/test/java/org/eclipse/jetty/http/CookieParserTest.java
#	jetty-core/jetty-http/src/test/java/org/eclipse/jetty/http/RFC6265CookieParserTest.java
#	jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/Cookies.java
#	jetty-http/src/main/java/org/eclipse/jetty/http/HttpCookie.java
#	jetty-http/src/test/java/org/eclipse/jetty/http/CookieCutterLenientTest.java
2023-02-15 14:22:38 +11:00
gregw 0ac3c3f7e6 Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2023-02-14 18:09:33 +11:00
gregw 4aa6bca630 Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x
# Conflicts:
#	jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ForwardedRequestCustomizerTest.java
#	jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/Request.java
#	jetty-ee9/jetty-ee9-nested/src/test/java/org/eclipse/jetty/ee9/nested/RequestTest.java
2023-02-14 10:07:18 +11:00
Lachlan Roberts 1e92759578 #9287 - remove unpaired release of Content.Chunk
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-02-08 16:51:39 +11:00
Lachlan Roberts 6950d73fce Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-multipartCleanups 2023-02-08 11:55:37 +11:00
Simone Bordet d02932f690
Fixes #9288 - Jetty 12 - Use oej.http.HttpCookie in jetty-client. (#9289)
* Replaced usages of java.net.HttpCookie with oej.http.HttpCookie.
* Moved server-side only methods from HttpCookie to HttpCookieUtils.
* Introduced and implemented oej.http.HttpCookieStore.
* Removed now obsolete oej.util.HttpCookieStore.
* Introduced HttpScheme.isSecure(String), to avoid code duplication.
* Fixed handling of cookie "localhost" domain in HttpClient.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-02-07 17:28:01 +01:00
Lachlan Roberts d005e975b0 changes f rom review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-02-07 15:47:17 +11:00
Simone Bordet 5cc07994c0
Issue #9300 - Rename RetainableByteBufferPool to ByteBufferPool
ArrayRetainableByteBufferPool -> ArrayByteBufferPool.
Updated field names.
Updates tests.
Updated *.mod files to not reference RetainableByteBufferPool.
Updated javadocs.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-02-06 10:31:14 +01:00
Simone Bordet 44980ebfc3
Merge branch 'issue/9284' of https://github.com/kohlschuetter/jetty.project into kohlschuetter-issue/9284 2023-02-06 10:16:32 +01:00
Lachlan Roberts c7e7fd837c Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-multipartCleanups 2023-02-06 11:18:19 +11:00
Olivier Lamy 4812eb1c89
Merge branch 'jetty-11.0.x' into jetty-12.0.x-merg 2023-02-05 16:34:58 +10:00
dependabot[bot] 44cd3ee541
Bump maven.surefire.plugin.version from 3.0.0-M5 to 3.0.0-M8 (#9255) 2023-02-05 15:58:03 +10:00
Christian Kohlschütter b8ab66fd1d Rename RetainableByteBufferPool to ByteBufferPool
With issue #9166, ByteBufferPool was removed and replaced by
RetainableByteBufferPool. Since ByteBufferPool was used by
AbstractConnector, this change broke backwards compatibility with
third-party connectors such as junixsocket-jetty.

Since there's no longer any other ByteBufferPool, rename the
RetainableByteBufferPool interface, and thereby not only reinstate
compatibility with existing third-party libraries but also save a few
keystrokes.

https://github.com/eclipse/jetty.project/issues/9284

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>
2023-02-04 23:39:29 +01:00
Lachlan Roberts cd47a07463 use non-pooling RetainableByteBufferPool to work around performance bug
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-02-04 00:49:59 +11:00
Lachlan Roberts 4ffad09335 Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-9066-MultiPart-getParameters 2023-02-01 12:42:35 +11:00
Lachlan Roberts 88c6f20199 changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-02-01 12:08:38 +11:00
Lachlan Roberts 8133dd6c9e changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-01-31 14:29:42 +11:00
Lachlan Roberts 719c60d70d changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-01-31 11:42:40 +11:00
Greg Wilkins 50a88187fa
Jetty 12 - New HTTP Cookie interface (#9205)
Convert HttpCookie to an interface.
2023-01-31 10:02:28 +11:00
Greg Wilkins c871fa4402
Converted PathMappings to be an AbstractMap (#9213)
This was primarily done to avoid surprise of the previous behaviour of puts for a duplicate key being ignored.
The use of the AbstractMap class now provides javadoc and known/expected behaviour for key methods.
The only significant behaviour change is in the return type of some key methods, with the old/previous value replacing a boolean.
Some stream usage has also been replaced by the more efficient iterator.
2023-01-31 09:19:01 +11:00
Lachlan Roberts 738712438c changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-01-30 13:20:51 +11:00
Simone Bordet cd732a175c
Review and normalized all Maven module <name> for consistency.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-27 19:09:30 +01:00
Simone Bordet ded18f523d
Fixes #9166 - Jetty 12: review/remove ByteBufferPool (#9195)
* Fixes #9166 - Jetty 12: review/remove ByteBufferPool

* Replaced usages of ByteBufferPool with RetainableByteBufferPool.
* Removed ByteBufferPool and related classes.
* Renamed oej.http2.frames.DataFrame.getData() -> getByteBuffer() for consistency.
* Removed Accumulator.acquire(), and updated code to use RetainableByteBufferPool.acquire() instead.
* Fixed HttpOutput callbacks to correctly call super.onCompleteSuccess() and super.onCompleteFailure().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-27 13:40:49 +01:00
Lachlan Roberts 36e7f71def Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-9066-MultiPart-getParameters 2023-01-25 14:23:37 +11:00
Lachlan Roberts 2dfe7e6021 fix some more tests in MultiPartServletTest
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-01-25 10:49:30 +11:00
Lachlan Roberts d4682f4b85 Fix testMaxRequest size test in MultiPartServletTest
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-01-25 10:39:20 +11:00
Joakim Erdfelt 7920102702
Issue #9173 - Make wrapping of `ServletApiResponse` easier (#9175)
* Issue #9173 - Make wrapping of ServletApiResponse easier

* Fixing checkstyle and missing licenses
* Improved HttpCookie with javadoc and attribute handling
2023-01-23 08:23:30 -06:00
Joakim Erdfelt a37b8523e5
Jetty 12 - Javadoc cleanup & new inspection profile (#9165)
* Adding intellij-javadoc-inspection.xml for Jetty specific Javadoc inspection profile.
* Javadoc cleanup
2023-01-19 10:31:27 -06:00
Joakim Erdfelt a06d1a29bb
Jetty 12 - Fix for HttpParser quick HTTP Version lookahead (#9171)
+ Removed the array optimized look ahead
+ version lookahead now done with getInt
+ improved test harness to check lf and crlf endings
+ added HTTP as int optimization
+ fixed bug in near miss of field cache

Signed-off-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Greg Wilkins <gregw@webtide.com>
2023-01-18 09:37:55 +11:00
Lachlan Roberts 539113df7c Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-9066-MultiPart-getParameters 2023-01-17 15:12:38 +11:00
Lachlan Roberts 5bcfeaac09 improvements to multipart
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-01-17 14:09:45 +11:00
Lachlan Roberts 1e20abc902 improvements to multipart
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-01-16 19:07:51 +11:00
Lachlan Roberts 3816e4b98a fix multipart test cases, add more api to the core MultiPart class
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-01-16 11:52:04 +11:00
Greg Wilkins 8b3bcc3a50
Cleanup non-retainable `Retainable`s (#9159)
`Retainable`s that return false from `canRetain()` now are noops if `retain()` is called, which allows for a simpler calling convention.
`AsyncContent` has also been reworked to allocate less and be clearer in its use of `canRetain()`.
2023-01-13 10:37:16 +01:00
Simone Bordet 46355c6110
Fixes retainability of special Chunks (#9073)
* Fixes #8993 - Retainability of special Chunks

* Restored Jetty 11's AsyncContentProducer and related classes in jetty-ee9-nested module (src and test).
* Introduced Retainable.canRetain().
* Removed Chunk.isTerminal() and replaced it with alternative method calls.
* Clarified AsyncContent.write() in case of Chunk.Error.
* Removed AsyncContent.write(Chunk, Callback) because it was making the API confusing.
  For example, AsyncContent.close() clashing with write(EOF, NOOP), or
  AsyncContent.fail(x) clashing with write(Chunk.Error, NOOP), etc.
* Improved usage of Chunk.from(..., Retainable).
* Improved usage of Chunk.slice().
* Using from() in MultiPart, rather than duplicating code.
* Fixed MultiPart.Parser.Listener.onPartContent() javadocs.
* Renamed non-retaining Chunk.from() to Chunk.asChunk().
* Removed Chunk.slice() methods, inlining them where necessary.
* Carefully reviewed all usages of read()-like methods that return a Retainable instance to make sure it is released.
* Updated HTTP/2 and HTTP/3 usages of Stream.Data to follow the correct retain/release semantic.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-13 01:10:56 +01:00
Lachlan Roberts 02f9cc0eb3 fixes to pass new multipart test cases
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-01-12 19:21:00 +11:00
Ludovic Orban 177bafbace #9078 make HttpContent.getByteBuffer() implementations return new ByteBuffer instances and document that contract
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-01-10 10:18:55 +01:00
Simone Bordet 8d6734cf78
Fixes #9141 - Thread-safe Content.Chunk#slice (#9142)
* Fixes #9141 - Thread-safe Content.Chunk#slice

* Changed Content.Chunk.slice(int, int, boolean) to have the same parameters as ByteBuffer.slice(int, int) for consistency.
* Updated Chunk.slice(int, int, boolean) javadocs.
* Update code that was calling Chunk.slice(int, int, boolean).

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-10 09:49:39 +01:00
Greg Wilkins 838091d2be
Alternate DelayedHandler & ThreadLimitHandler implementations #9051 (#9056)
* Improved javadoc
* Refactored ThreadLimitHandler to avoid lambda creation and to always execute
* Refactored DelayedHandler to avoid lambda creation and to execute only if needed
* added modules for the DelayedHandler

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2022-12-24 10:49:29 +11:00
Lachlan 0e95953be3
Merge pull request #9043 from eclipse/jetty-12.0.x-httpcontentFactoryCleanup
Create StaticHttpContentFactory and other cleanups
2022-12-23 22:54:38 +11:00
Joakim Erdfelt ff48442fa0
Narrowing in on possible bug in jar:file:// handling of Resource.getFileName() 2022-12-21 14:39:20 -06:00
Joakim Erdfelt ce52ffdd33
More meaningful .toString() implementations 2022-12-21 12:14:07 -06:00
Jan Bartel 1abaeb6cee
Jetty 12.0.x osgi (#9068) 2022-12-21 08:12:44 -06:00
Greg Wilkins 12d66f083a Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2022-12-20 11:20:39 +11:00
Jan Bartel 721a4c74fa
Jetty 12.0.x ee10 convert cookie (#9057)
* Convert HttpCookie -> Cookie based on compliance mode.
* Fix max-age
* Fix old cookie handling; getCookies return null instead of empty list
2022-12-20 10:22:38 +11:00
Greg Wilkins c18e790858
Jetty 12 handler as boolean processor (#9035)
Alternative Handler architecture.

All Handlers are Processors, which now return a boolean to indicate the request has been accepted.
The request/response/callback are no longer modal, so there is no race with the boolean return.

Optimized PathMappings.
Avoid iterations if only ServletPathSpec instances
Avoid tests for empty mappings.
Better reset implementation
Improve suffix matching
Improve exact matching

Renamed HttpStream.getNanoTimeStamp() to getNanoTime().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2022-12-19 16:02:26 +01:00
Lachlan Roberts 0f1420fbd7 changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-12-16 17:17:12 +11:00
Lachlan Roberts 60656ebb72 make stylesheet final in StaticHttpContentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-12-13 10:48:06 +11:00
Lachlan Roberts 9270e62f78 rename of StaticHttpContentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-12-13 10:44:35 +11:00
Lachlan Roberts abc40afd89 cleanups for HttpContent Factories
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-12-13 09:55:55 +11:00
Simone Bordet d3a0aa281b
Fixed flaky test MultiPartRequestContentTest.
The problem was that sometimes content bytes generated randomically ended with \r, confusing the multipart parser.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-12-09 15:58:57 +01:00
Ludovic Orban 42186bff18 #8993: Disallow creating new chunks with an empty ByteBuffer to make Chunk.isTerminal() contract stricter
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-12-06 19:48:17 +01:00
Lachlan a0a8acd8b9
Merge pull request #8935 from eclipse/jetty-12.0.x-byteranges
Re-enable DefaultServletRangesTest and fix byte ranges for ee10
2022-11-25 10:27:33 +11:00
Greg Wilkins ca3055423a
Mutable server MimeTypes (#8933)
Make the MimeTypes available from the server mutable.
Context MimeTypes are now wrappers over the server MimeTypes, so configuration at the server level is inherited by all contexts.
2022-11-24 16:57:29 +11:00
Lachlan Roberts c8d22c72ea Re-enable DefaultServletRangesTest and fix byte ranges for ee10
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-24 14:10:41 +11:00
Greg Wilkins a44af984b5
Jetty 12 mimetype cleanup (#8919)
MimeTypes now available via context.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2022-11-23 14:30:11 +11:00
Lachlan Roberts 126658145c remove setter for HttpContentFactory on ResourceHandler
revert to using computeIfAbsent on CachingHttpContentFactory
make direct buffers configurable on CachingHttpContentFactory

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-11 00:49:55 +11:00
Lachlan Roberts eeb4df9965 Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-HttpContent-Caching-Refactor 2022-11-10 16:20:30 +11:00
Lachlan Roberts 1c6d36e44a changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-10 16:16:51 +11:00
Lachlan Roberts 387d380f75 fixes to the CachingHttpContentFactory caching algorithm
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-10 10:42:58 +11:00
Joakim Erdfelt 08c47f5f57
Jetty 12 - use JVM provided null OutputStream (#8789)
* Remove IO.getNull* methods and use JVM versions

+ This also honors the open/close/error on
  bad use of the streams/writers
2022-11-09 07:06:43 -06:00
Lachlan Roberts 3d96b4b7d0 fix javadoc
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-09 14:52:17 +11:00
Lachlan Roberts 890d02568c use double checked locking for FileMappedHttpContent
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-09 14:43:42 +11:00
Lachlan Roberts a4e773a7ab changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-09 14:10:49 +11:00
Joakim Erdfelt aa9df2a402
Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2022-11-08 18:16:45 -06:00
Lachlan Roberts 75f210d20b Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-HttpContent-Caching-Refactor 2022-11-08 21:22:53 +11:00
Lachlan Roberts 489da47a38 changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-08 18:17:37 +11:00
Joakim Erdfelt b3505ae687
Jetty 12 - General cleanup of URIUtil (#8861)
+ Removal of __CHARSET
+ Removal of unused methods
+ Using new switch/case concepts
+ cleanup of URIUtil constants
+ cleanup of URIUtil methods
+ collapse separate methods
+ simplify encodePath()
* Javadoc updates
* equalsIgnoreEncoding cleanup (no longer used by Resource layer)
2022-11-04 14:28:53 -05:00
Lachlan Roberts d94abe3f3f fix javadoc in ValidatingCachingContentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-03 18:10:39 +11:00
Lachlan Roberts 4ad42e3cdb add getBytesOccupied method to HttpContent
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-03 18:00:03 +11:00
Lachlan Roberts c0bb0272f7 fix release in CachingHttpContentFactory and always use ByteBufferPool
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-03 17:38:22 +11:00
Lachlan Roberts 6facedba75 Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-HttpContent-Caching-Refactor 2022-11-02 17:28:42 +11:00
Lachlan Roberts e28a528165 changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-11-02 17:21:44 +11:00
Simone Bordet 6ca9c4f878
Fixed test case.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-10-27 10:46:40 +02:00
Lachlan Roberts af19607f1c use name annotation for EvictingCachingContentFactory constructors
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-26 11:26:06 +11:00
Joakim Erdfelt 8eb10b2d74
Jetty 12 - Introduce PathMappingsHandler (#8748)
* Introduce PathMappingsHandler
2022-10-25 10:04:33 -05:00
Simone Bordet cf366b3323
Improved javadocs.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-10-25 15:42:49 +02:00
Greg Wilkins 3b2d4048fd replaced getPathInContext with static method
updates from review
2022-10-25 21:11:10 +11:00
Lachlan Roberts 7752720861 Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-HttpContent-Caching-Refactor 2022-10-25 16:44:53 +11:00
Greg Wilkins 3598d7eb45 replaced getPathInContext with static method 2022-10-24 23:34:35 +11:00
Greg Wilkins 14d912c654 replaced getPathInContext with static method 2022-10-24 21:02:18 +11:00
Greg Wilkins 30401d8cf8 WIP replacing getPathInContext with static method 2022-10-24 11:26:50 +11:00
Lachlan Roberts 98c6675159 fix bugs in CachingHttpContentFactory, ResourceService and FileMappedHttpContentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-21 11:42:03 +11:00
Lachlan Roberts 0e1bae4059 use RetainableByteBuffer for getBuffer in HttpContent
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-20 21:29:55 +11:00
Lachlan Roberts 8768725de9 separate evicting logic from CachingHttpContentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-20 10:37:38 +11:00
Lachlan Roberts 86da43a54a improve configuration options for HttpContent.Factory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-20 10:00:04 +11:00
Lachlan Roberts 3c08931291 cleanups of HttpContent factories
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-19 17:50:06 +11:00
Lachlan Roberts ad7ae3cfc9 Rename all HttpContent factories
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-19 17:10:15 +11:00
Lachlan Roberts bbd7ace07e fix failing test cases for ResourceService and Etags
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-19 09:36:06 +11:00
Lachlan Roberts cccc16c03e Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-HttpContent-Caching-Refactor 2022-10-18 22:28:13 +11:00
Lachlan Roberts fbceb92cd0 further work on CachingContentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-18 15:04:59 +11:00
Simone Bordet 0d0790834d
Moved FastCGIProxyServlet in ee9 to FastCGIProxyHandler in core. (#8718)
Moved FastCGIProxyServlet in ee9 to FastCGIProxyHandler in core.
Moved TryFilesFilter in ee9 to TryPathsHandler in core.
Update Jetty modules to properly setup the class-path in case of proxy usage.

Fixes Surefire configuration to run the tests.
The problem is that fcgi-proxy depends on fcgi-client, so both will be put on the module-path.
However, fcgi-server is used for the tests, it is in the class-path, but depends on fcgi-client that is on the module-path.
Therefore, when a fcgi-server class tries to access a fcgi-client class, JPMS throws because the fcgi-client module does not export to the unnamed module.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-10-18 00:00:34 +02:00
Lachlan Roberts e910a8ea59 work in progress to improve CachingContentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-17 16:07:55 +11:00
Lachlan Roberts 64a5b07424 cache more fields in CachingHttpContent
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-14 15:53:45 +11:00
Lachlan Roberts 57f71ce77e extract the generation of getCompressedContentFormats to separate contentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-13 18:08:50 +11:00
Lachlan Roberts 2d161bfecd cleanups of HttpContentWrapper and ResourceService
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-13 17:25:47 +11:00
Lachlan Roberts 6db4bf8aa0 remove getPrecompressedContents from HttpContent and ee9 impl
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-12 18:44:00 +11:00
Lachlan Roberts 81f67f3fff remove getPreCompressedContentFormats from HttpContent
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-12 18:02:34 +11:00
Lachlan Roberts 6a6681a2df fix stampede creating CachingHttpContent & remove usage of getPreCompressedContentFormats
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-12 16:11:33 +11:00
Lachlan Roberts a7383ea4de only check file modified time once per second for cached files
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-11 18:41:56 +11:00
Lachlan Roberts 1353f16d57 Refactor for CachingContentFactory and ResourceService
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-10-11 11:08:42 +11:00
Simone Bordet c785f08b17
[Jetty 12] Made WebSocket over HTTP/2 work. (#8685)
* Made WebSocket over HTTP/2 work.

Re-enabled tests, and restored HTTP2StreamEndPoint,
as well as implemented getTunnelSupport() for HTTP/2.

Removed from HttpStream methods for upgrade that are
not necessary anymore.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-10-07 12:50:42 +02:00
Lachlan 05a4b96632
Merge pull request #8621 from eclipse/jetty-12.0.x-CachedContentFactory
Fix Caching ContentFactories in Jetty-12
2022-10-04 18:57:29 +11:00
Lachlan Roberts 1c9ac9c846 Update javadoc for CachingContentFactory.isCacheable()
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-09-30 10:34:25 +10:00
Lachlan Roberts 98f9deed43 remove parent from CachingContentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-09-29 22:20:00 +10:00
Lachlan Roberts ae071c5a99 release precompressed content buffer in PrecompressedHttpContent & use HttpContent.ContentFactory for parent in CachingContentFactory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-09-27 22:18:54 +10:00
Lachlan Roberts bed034c22d more fixes for test cases in DefaultServletTest
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-09-27 11:01:56 +10:00
Simone Bordet 06be091089
Introduced [Callback|Promise]Completable.with(Consumer) to simplify usage of CompletableFuture APIs.
Updated code to use the new APIs.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-09-26 22:15:17 +02:00
Simone Bordet f8f60822a7
Restored interim responses functionality (100 Continue, 102 Processing, 103 Early Hints) (#8615)
* Restored interim responses functionality (100 Continue, 102 Processing, 103 Early Hints) for core, ee9 and ee10.

Added ProcessingProtocolHandler and EarlyHintsProtocolHandler for the client.

Re-enabled all tests for interim responses for all protocols.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-09-26 16:48:11 +02:00
Lachlan Roberts c6305ff36c Improvements to CachingContentFactory for Jetty 12
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-09-26 16:33:50 +10:00
Simone Bordet 910bb41702 Removed duplicate client transport tests already present in core.
Properly implemented request and response trailers for all the transports, both client and server.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-09-21 20:03:49 +02:00
Simone Bordet 854d5cdf6a Renamed ee9 client transport tests package.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-09-21 20:03:49 +02:00
Joakim Erdfelt 4fe414a762
Jetty 12 : precompressed content support for `ResourceService` (#8595)
* Remove Resource.getWeakETag in favor of new EtagUtils
* Protect bad usages of CachingContentFactory
* Working precompressed content for ResourceService
* Fixing DefaultServlet handling of ResourceService.writeHttpError() overrides
* Protect NPE in CachingContentFactory.isValid()
* Complete callback in DefaultServlet.writeHttpError
* Addressing review comments
* Testing for whole content
* Improve MemoryResource handling of name/filename
* EtagUtils handling of Resource
* Better protection of bad Resource impls in EtagUtils
* Update CachingContentFactory
+ Using Resource.lastModified were possible
+ CachingHttpContent has better Resource
  protection, and uses Etag from delegate
+ CachingHttpContent uses delegate where
  possible.
+ Store Etag HttpField in CachingHttpContent
  and allow override in constructor
* Simpler CachingHttpContent.isValid()
* Better handling of PrecompressedHttpContent

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2022-09-21 09:39:21 -05:00
Joakim Erdfelt 84c6f30dfd
Merge remote-tracking branch 'origin/jetty-12.0.x' into fix/jetty-12-pathresource-alias-detection-in-jarfile 2022-09-07 05:52:41 -05:00
Joakim Erdfelt 54cc1a3ff9
Merge remote-tracking branch 'origin/jetty-12.0.x' into fix/jetty-12-pathresource-alias-detection-in-jarfile 2022-09-06 19:36:53 -05:00
Joakim Erdfelt 226b9594f1
Using other method 2022-09-06 15:09:33 -05:00
Joakim Erdfelt 7f88878df9
Change signature of Resource.lastModified()
+ Now returns Instant
2022-09-06 13:21:25 -05:00
Simone Bordet 8953873e67
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-09-06 12:31:54 +02:00
Simone Bordet a3ba86266a
Implemented ProxyHandler in new module jetty-core/jetty-proxy. (#8475)
Moved ConnectHandler to org.eclipse.jetty.server.handler, where it should have been from the start.

Cleaned up and corrected behavior of SecureRequestCustomizer.
Now the response is wrapped with isSecure=true if it arrived over a secure transport.
The request URI scheme indicates whether the request is secure towards the origin server.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-08-19 09:38:34 +02:00
Joakim Erdfelt a40002fb11
Revert ServletPathSpecOrderTest 2022-08-16 15:47:42 -05:00
Joakim Erdfelt d16b1cd595
Merge remote-tracking branch 'origin/jetty-12.0.x' into fix/jetty-12-pathresource-alias-detection-in-jarfile 2022-08-15 18:39:21 -05:00
Simone Bordet b5332c38a9 Implemented ranged requests and responses.
Refactored MultiPart so that the different behavior between
multipart/form-data and multipart/byteranges is captured in the code.

Renamed MultiParts to MultiPartFormData, and ServletMultiParts to ServletMultiPartFormData.

Introduced MultiPartByteRanges and used it to implement ranges in ResourceService.
Re-enabled multipart tests for ranges that were disabled, and added more.

Modernized and simplified implementation of ByteRange.
Updated ByteRangeTest.

Removed RangeWriter and its subclasses and their tests, as they are not used anymore.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-08-15 17:32:02 +02:00
Simone Bordet 2e01ed7e08 Renamed InclusiveByteRange to just ByteRange.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-08-15 17:32:02 +02:00
Simone Bordet 24b6ae0fb7 Moved InclusiveByteRange and InclusiveByteRangeTest to jetty-http.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-08-15 17:32:02 +02:00
Joakim Erdfelt eb2bf4b97d
ServletPathSpec encoded test case 2022-08-10 15:52:11 -05:00
Joakim Erdfelt 7808a26beb
Proper URIUtil.canonicalPath conversion of 8-bit characters 2022-08-10 15:30:11 -05:00
Jan Bartel 42f72268cf
Jetty 12 : #8408 Support new `<cookie-config>` concepts in Servlet 6 (#8420)
* Issue #8408 Implement new session cookie attributes
2022-08-10 16:33:08 +10:00
Joakim Erdfelt 19039f4df8
Remove maxBuffer from ContentFactory.getContent(String) (#8403) 2022-08-04 17:32:50 +02:00
Simone Bordet c077bbecaa
Jetty 12.0.x MultiPart (#8201)
Moved multipart test files to jetty-http.

Introduced jetty-http `MultiPart` class and made `MultiPart.Parser` non-blocking and lenient on newlines.
Made `MultiPartCaptureTest` to pass.

Moved o.e.j.server.MultiPartParserTest tests to o.e.j.http.MultiPartTest.

Renamed MultiPartFormInputStreamTest to MultiPartsTest.

Introduced class o.e.j.server.MultiParts, a CompletableFuture of Parts
that can be used asynchronously in Handlers and in general in core Jetty.

Implemented multi-part handling in ee10.

Implemented DelayedHandler.UntilMultiPart.

Introduced MultiPart.ContentSource as the multipart "generator".

Replaced ByteBuffer/boolean pair with Chunk and implement Chunk slicing & improve retainability for MultiPart parser.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Co-authored-by: Ludovic Orban <lorban@bitronix.be>
2022-08-04 17:03:40 +02:00
Lachlan Roberts eed5ad24cd #8343 - fix issues with regex pathspec and query decoding
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2022-07-27 14:17:10 +10:00
Greg Wilkins d369adf55b
Jetty 12.0.x canonical uri (#8343)
Somehow the URIUtil class had switched over the meaning of normal and canonical. This PR renames them to correct this:
 * canonical paths are always normal
 * Always canonicalize paths passed from the application
 * Switch the URIUtil names for canonical and normal
2022-07-27 09:58:50 +10:00
Ludovic Orban 32ef1616e6 #8285 - handle review comments
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-07-26 13:47:44 +02:00
Ludovic Orban 38d22f3153 #8285 - improve Resource to mapped ByteBuffer logic
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-07-26 13:47:44 +02:00
Simone Bordet 69a7b06f06
Jetty 12.0.x retainable chunk (#8325)
Made Chunk implement Retainable, and protocol implementations
to link the RetainableByteBuffer all the way to the Chunk.

Extended Retainable to have both a retain() and a release() methods.

Removed HTTP/2's ISession and IStream, now just using HTTP2Session and HTTP2Stream.
Removed *.Adapter classes in favor of interfaces with default methods.

Javadoc additions and clarifications.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-07-25 13:22:14 +02:00
Joakim Erdfelt 131fd00285
Jetty-12 : Testing for ResourceHandler / ResourceService (#8327)
* Overhaul of ResourceHandlerTest
* Making ResourceHandlerTest more flexible for testing
  + Each test has it's own docroot
  + Each test decides what it's docroot contents are
* Support QuotedQualityCSV(List<String>)
2022-07-21 15:12:19 -05:00
Joakim Erdfelt 68ddee69af
Adding TODO about HttpContent.getBuffer 2022-07-20 14:25:50 -05:00
Joakim Erdfelt 07dd27c251
Merge branch 'jetty-12.0.x' of github.com:eclipse/jetty.project into jetty-12.0.x 2022-07-14 20:33:36 -05:00
Joakim Erdfelt 9b5d4ce8e2
More DefaultServletTest additions 2022-07-14 18:38:21 -05:00
Greg Wilkins fc6a92f426 More work on the demos 2022-07-15 09:18:52 +10:00
Joakim Erdfelt e1ee2e3fa2
Fixing DefaultServletTest.testWelcomeMultipleDefaultServletsDifferentBases 2022-07-14 15:33:02 -05:00
Ludovic Orban be95da326d
Bis: Jetty 12.0.x resource handler and default servlet (#8276)
Made ResourceService use a generic request so it can be used as handler or from servlets.    This is only a temporary solution.

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Co-authored-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2022-07-13 09:21:27 +10:00
Ludovic Orban 23a0203547 rework Resource API (#8106)
* remove Resource.getFile() and replace its usages with Resource.getPath()
* remove all public PathResource ctors + add non-leaky FS mounting mechanism + interpret string as Path when not a schemed URI
* rename Resource.getResource to Resource.resolve, specifying that the subpath is URI-path-interpreted
* remove useless API methods + deprecate all path-related API
* make subpaths beginning with / resolved as relative to the given uri
* introduce filesystem pooling and generalize resource resolving code
* remove URLResource
* remove unneeded factory method
* both file: and jrt: should not be pooled
* move deprecated impls from PathResource down to Resource + fix some tests
* handle Resource's pointing to non-existent jar files
* Force Resource URIs to end with "/" when the resource is a directory
* Produce warning if attempting to release a mounted filesystem uri that doesn't exist in the pool.

Co-authored-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Co-authored-by: Ludovic Orban <lorban@bitronix.be>
2022-07-12 10:10:30 +10:00
Joakim Erdfelt 1999b39808
Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2022-06-26 12:04:51 -05:00
Joakim Erdfelt 58fd6c0b10
Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2022-06-16 14:09:05 -05:00
Joakim Erdfelt 45b899cb7a
Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2022-06-15 15:07:38 -05:00
Joakim Erdfelt d1e5ffa4d9
Merge branch 'jetty-11.0.x' into jetty-12.0.x 2022-06-09 09:04:44 -05:00
Simone Bordet cbeeb67e93
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-06-01 15:18:53 +02:00
Simone Bordet 7a6ccce49a
Rewrite of the content handling, both on client and on server. (#7985)
Introduced a new io.Content class, with Content.Source, Content.Sink and Content.Chunk.

Updated the server-side to use io.Content instead of the previous server-side Content class.
Updated the client-side to use io.Content with a little specialization necessary for clients only.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Ludovic Orban <lorban@bitronix.be>
2022-05-30 13:34:51 +02:00
Greg Wilkins f9b39d932a Reworked BadMessage handling
Throw BadMessage from processing rather than onRequest
2022-05-28 15:49:38 +10:00
Joakim Erdfelt 3ae7560ea3
Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2022-05-26 09:15:49 -05:00
Jan Bartel 39c5395fb1 Add --reads org.eclipse.jetty.logging to surefire config 2022-05-24 20:34:13 +10:00
Greg Wilkins e72f6c96c4
Jetty 12.0.x cookie cache rewrite (#8047)
Cookies from requests on same connection bleed into each other

* Rewrote CookieCache

Co-authored-by: Jan Bartel <janb@webtide.com>
2022-05-24 16:44:53 +10:00
Greg Wilkins 04acdb72f0 Jetty-12 Restructure
Copied over non ee10 components from the hackathon branch

Co-authored-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Jan Bartel <janb@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim@webtide.com>
Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Ludovic Orban <lorban@webtide.com>
Co-authored-by: Olivier Lamy <olamy@webtide.com>
Co-authored-by: Simone Bordet <sbordet@webtide.com>
2022-05-03 15:50:54 +02:00
Greg Wilkins 825fa75993 Jetty-12 Restructure
Git moved files into their known new locations

Co-authored-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Jan Bartel <janb@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim@webtide.com>
Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Ludovic Orban <lorban@webtide.com>
Co-authored-by: Olivier Lamy <olamy@webtide.com>
Co-authored-by: Simone Bordet <sbordet@webtide.com>
2022-05-03 15:46:22 +02:00