Commit Graph

242 Commits

Author SHA1 Message Date
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