Commit Graph

1520 Commits

Author SHA1 Message Date
Ludovic Orban 08223be155 update to use the finalized foreign api of JDK 22
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-04-17 10:31:30 +02:00
Lachlan ea7982732f
Merge pull request #11645 from jetty/jetty-12.0.x-11420-qpackDecoder
Issue #11420 - fix dynamic table referencing in QpackDecoder
2024-04-16 11:27:26 +10:00
Lachlan Roberts 284083e5f0 PR #11645 - add end-to-end test for dynamic table reference
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-04-15 13:41:54 +10:00
Lachlan Roberts 8f19a29ccb PR #11645 - changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-04-15 12:13:12 +10:00
Greg Wilkins 30bee710f1
Move ClassMatcher to core to have a consistent fix for addServerClasses in all environments (#11566)
* Issue #11514 - Cleanup `jetty.webapp.addServerClasses` property behavior for ee10/ee9/ee8

* Fix test

* Merging patterns (default -> env -> config)

* Moved ClassMatcher to util

* Adding more deprecations

* Changing XML demos/tests to use new getter names

* rollback xml changes in ee9/ee8

---------

Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Co-authored-by: Jan Bartel <janb@webtide.com>
2024-04-12 17:31:47 +10:00
Lachlan Roberts fa5c6aa320 PR #11645 - fix calculation for relative index from an Entry
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-04-11 14:34:21 +10:00
Lachlan Roberts 600dbfee25 Issue #11420 - fix dynamic table referencing in QpackDecoder
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-04-11 13:01:30 +10:00
Joakim Erdfelt 83526f77d3
Issue #11490 - fixing CustomRequestLog.setIgnorePaths (#11638) 2024-04-10 16:32:44 -05:00
Ludovic Orban 66c1c3b798 #11594 add alias check to allow all context resources to be served, as for the equivalent servlet tests
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-04-04 17:50:25 +02:00
Joakim Erdfelt 6320839bff
Issue #11488 - unset port is -1 to be compatible with Java classlib (#11578)
+ Changing unset port in HttpURI to -1 (from 0)
+ Changing unset port in HostPort to -1 (from 0)
2024-04-04 10:26:15 -05:00
Joakim Erdfelt b3ef872d6b
Updating to version 12.0.9-SNAPSHOT 2024-03-29 15:20:11 -05:00
Joakim Erdfelt ffffdcc3c8
Updating to version 12.0.8 2024-03-29 14:31:57 -05:00
Joakim Erdfelt 58293ad1f1
Update Dependencies [12.0.x] - March 2024 (#11591)
* Bump jetty-setuid-jna
* Updating dependencies
* Updating dependencies in jetty-ee10-annotations
* Updating dependencies in jetty-ee10-plus
* Fix jetty-ee8-osgi-boot deps
* Fix jetty-ee9-osgi-boot deps
* Address osgi duplicate resource plugin
2024-03-29 12:23:22 -05:00
Simone Bordet 1b05d49fd8
Allow configuring showCause in ErrorHandler (#11587)
Allows to suppress "caused by" in error message, not only the stacks traces.
ErrorHandler.showCause = false by default.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Dennis Hoersch <dennis.hoersch@springernature.com>
Co-authored-by: Dennis Hoersch <dhs3000+ghtu@posteo.de>
2024-03-29 16:37:56 +01:00
Ludovic Orban 0451bd4b86
Disable Conscrypt tests on aarch64 (#11590)
Disabled client and tests on aarch64 cpu, enabled client tests on all OS.

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-03-29 11:16:06 +01:00
Greg Wilkins 9b6944e04a
Remove usages of URIUtil.toURI and URIUtil.split (#11577)
* Issue #11567 - fix relative path for resourceBase set in DefaultServlet

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>

* Remove the ResourceFactory adaption from between baseResource and a HttpContent.Factory

* Remove toURI usage

* ensure ee9 DefaultServlet encodes the pathInContext

* Moved toURI functionality to ResourceFactory

* use context baseResource if baseResource not set

* removed usages of URIUtil.split

* fixed javadoc

* updates from review

* updates from review

* updates from review

* updates from review

* fixed resource leak in test

* fixed resource leak in test

* updates from review

* Fixes to URIUtil for Windows (#11585)

* Fixes for Windows
* Remove test that is not needed

* inlined resolveOrNew

---------

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2024-03-28 16:32:03 +01:00
Ludovic Orban 89c41b2550
Cleanup Resource IO (#11364)
Refactorings to rationalize and simplify how we do IO with resources internally by introducing the IOResources helper.

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-03-28 11:08:44 +01:00
Simone Bordet e00a71a00f
Fixes #11583 - Broken HTTP/3 tests (#11584)
Initialized PEM directories for both client and server.
Added [lib] section that was missing due to #11263.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-03-27 22:37:33 +01:00
Olivier Lamy ee82c2b761
Issue #10387 configure doclint to not generate verbose useless warning, remove obsolete parameter (#11544)
Signed-off-by: Olivier Lamy <olamy@apache.org>
2024-03-27 22:27:21 +01:00
Joakim Erdfelt 05aa1e1b08
Issue #11495 - Add UriCompliance rules that follow the HTTP / URI / Servlet specs for illegal & suspicious characters (#11496)
* Issue #11495 - Add UriCompliance rules that follow the HTTP / URI / Servlet specs for illegal & suspicious characters
* more illegalPathCharacterData test cases
* Correcting SUSPICIOUS_PATH_CHARACTERS semantic (encoded and decoded)
* Check for illegal and suspicious characters as we are parsing the path.
* Only look for ambiguous paths if we know there are dots or encodings.

---------
Co-authored-by: gregw <gregw@webtide.com>
2024-03-27 09:28:30 -05:00
Joakim Erdfelt 121999bf7c
Issue #11539 restore old behavior of `Resource.copyTo()` with regards to existing destination files. (#11540)
* Issue #11539 restore old behavior of Resource.copyTo()
* Do not delete destination resource
  if it exists before copy to restore
  the behavior to what we had in
  Jetty 9/10/11.
* Formalizing IO.resolvePath()
2024-03-27 07:38:00 -05:00
Jan Bartel 92cb3cbe7e
Issue #11572 add check for isDeployable when hot deploy file changes (#11576)
* Issue #11572 add check for isDeployable when hot deploy file changes
2024-03-27 09:59:36 +01:00
Joakim Erdfelt 9defd5d416
Issue #11548 - Replication as jetty-ee10-webapp testcase (#11550)
* Issue #11548 - Replication as jetty-ee10-webapp testcase
* Correct order of WebAppContext.stop

---------

Co-authored-by: Jan Bartel <janb@webtide.com>
Co-authored-by: gregw <gregw@webtide.com>
2024-03-26 07:04:49 -05:00
Lachlan 028221e343
Ensure request is set for ContextScopeListener in EE10 (#11518)
* Ensure request is set for ContextScopeListener in EE10
2024-03-25 19:18:00 +01:00
Jan Bartel 2fc7ad87d8
Reintroduce Cross Context Dispatch in Jetty 12 (#11451)
Re-introduce some support for cross context dispatch
2024-03-25 18:44:44 +01:00
Ludovic Orban 13acb1779e
Fix ClosedFileSystemException on hot redeploy (#11549)
#11548 implemented workaround for JDK-8291712

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-03-25 11:13:10 +01:00
Simone Bordet 258a5e04de
Fixes #10870 - How to set HttpConfiguration.securePort when the HTTPS port is dynamic? (#11547)
Introduced NetworkConnector.Listener to notify of open/close events.
Applications can register a listener on one NetworkConnector, be notified when it opens, and configure other components (for example using the NetworkConnector.localPort).

Cleaned up ManagedSelector.CloseConnections, which had code that was not used, and fixed the close of non-connection elements such as the ServerSocketChannel and DatagramChannel (when acceptors=0).

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-03-24 20:52:56 +01:00
Simone Bordet 4a22ab3f82
Improvements and cleanups to ErrorHandler. (#11556)
Defaulted showStacks to false, to reduce false positives reported by penetration testing tools.
Deprecated ErrorHandler.badMessageError(), as it was not invoked anymore.
Implemented HttpStreamOverHTTP[2|3].onBadMessage() that was left as TODO.
Simplified the same code for HTTP/1.
Moved invocation of ComplianceViolation.Listener.onRequestEnd() to HandlerInvoker.completeStream().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-03-24 20:51:50 +01:00
Simone Bordet ae6f98ed47
Fixes #7647 - Document org.eclipse.jetty.client.Socks4Proxy "secure" parameter. (#11533)
Added javadocs and documentation.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-03-22 16:46:07 +01:00
Simone Bordet 0ab9f68491
Fixes #5857 - Deprecate AbstractConnectionPool "callback" methods. (#11542)
Deprecated idle(), acquired(), released() for removal.
Renamed removed(), now deprecated, to onRemoved() to match with onCreated().
Kept onCreated() and onRemoved() as they are the only methods that are not racy.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-03-22 16:16:50 +01:00
Greg Wilkins 51fc906d37
Optimized ReservedThreadExecutor with ThreadIdPool (#11498)
* Introduced ThreadIdPool and replaced ThreadLocal with it
 * Modified ReservedThreadExecutor to be backed by a ThreadIdPool of semaphores

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: gregw <gregw@webtide.com>
Co-authored-by: Ludovic Orban <lorban@bitronix.be>
2024-03-21 16:53:14 +01:00
Greg Wilkins 3d49cd3b3c
Allow resolve to return non-existent resources (#11476)
Fix #11411 by allowing non-existent resources to be returned from resolve
Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Co-authored-by: Ludovic Orban <lorban@bitronix.be>
2024-03-21 12:49:50 +00:00
Ludovic Orban ef87cee33d fix copyTo(directory) for resources not backed by a path
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-03-20 18:48:02 +01:00
Ludovic Orban 5de0141423 Make sure testResourceCopyToDirectory() tests copying a file resource to a target folder
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-03-20 18:48:02 +01:00
Ludovic Orban 435384420f Fix Resource.copyTo() + add tests
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-03-20 18:48:02 +01:00
Dennis Hoersch d39dde5213
Allows to change the default ErrorHandler response type (#11522)
Allows to set the default mime type for the error response in `ErrorHandler`.
2024-03-19 19:17:12 +01:00
Simone Bordet 763999d08a
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-03-19 11:43:29 +01:00
Ludovic Orban 2067ec81e8 upgrade quiche to version 0.20.1
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-03-15 17:32:37 +01:00
Greg Wilkins c25e1aa7ff
Fix PerfRegression by preparing field cache (#11517)
Fix #11513 by preparing the field cache
2024-03-13 21:42:14 +01:00
Greg Wilkins c05ae3bb83
Implemented addBeanFromConstructor (#11319)
Added mechanism to safely add beans from a super constructor of ContainerLifeCycle


Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2024-03-13 17:52:55 +01:00
Greg Wilkins ffb5458720
Restored removed constructor (#11512)
Fix #11509 by restoring removed constructor as deprecated
2024-03-13 17:49:58 +01:00
Ludovic Orban 0a2382408f
Fix StatisticsHandler not receiving implicit status 200 (#11487)
#11482 introduce new onComplete event in EventsHandler and use it to record status in StatisticsHandler

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-03-13 17:30:33 +01:00
Joakim Erdfelt 369d9f7e2f
Merge remote-tracking branch 'origin/release/12.0.7' into jetty-12.0.x 2024-03-06 11:00:50 -06:00
Greg Wilkins 80f912a121
Improve HTTP parsing long look-ahead (#11486)
Use ByteBuffer.getLong to look for entire request (GET / HTTP/1.1) or response (HTTP/1.1 200 OK) line with 2 long lookups.  Failing that, a single long lookup is sufficient to determine the common methods and/or HttpVersion.

* Cleanup generator also

* Added a fallback int lookup
2024-03-05 17:34:14 +01:00
Joakim Erdfelt 18b2a7c201
Updating to version 12.0.8-SNAPSHOT 2024-02-29 16:00:27 -06:00
Joakim Erdfelt c89aca8fd3
Updating to version 12.0.7 2024-02-29 15:18:56 -06:00
Greg Wilkins 4155e7bc25
Add suppressed failures in Callback failed (#11435)
If an exception is thrown during failure handling, then record the original failure as a suppressed Throwable on the thrown exception
2024-02-29 20:06:50 +01:00
Greg Wilkins 56e05a973f
HttpURI toURI passes all info (#11468)
* HttpURI toURI passes all info

Fix #11465 and #7750
HttpURI.toURI user and fragment are retained.
Use to URI(String) constructor, as all URI constructors will parse the URI anyway.

* HttpURI toURI passes all info

Fix #11465 and #7750
HttpURI.toURI user and fragment are retained.
Use to URI(String) constructor, as all URI constructors will parse the URI anyway.
2024-02-29 17:46:06 +01:00
Simone Bordet 561b8da4dd Changed CrossOriginHandler default to allow no origin and no credentials.
This makes the default configuration more secure and explicitly requires configuration from users.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-29 15:47:20 +01:00
gregw ee8823bd57 Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x
# Conflicts:
#	jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/DynamicTableTest.java
2024-02-28 14:41:32 +01:00
Greg Wilkins 686dd88c3a Fix #10805 zero dynamic table (#11445) (#11452)
* Fix #10805 zero dynamic table (#11445)

* Added test for #10805 Zero Dynamic Table

* fixed file header

* Added test for #10805 Zero Dynamic Table

* Fix for #10805 Zero Dynamic Table

Set the correct default size for the table.
Always send the max table size on the first encode

* updated file header

Signed-off-by: gregw <gregw@webtide.com>

---------

Signed-off-by: gregw <gregw@webtide.com>
2024-02-28 14:39:06 +01:00
Joakim Erdfelt 1bba3cd41e
Merge pull request #11455 from jetty/fix/12.0.x/webinfconfig.unpack.protection
Improve DEBUG during WebInfConfiguration.unpack
2024-02-28 04:17:38 -08:00
Joakim Erdfelt 97cb50ead9
Improve Error messages for Ambiguous URIs (#11457)
* Some testing of HttpURI for Issue #11448
* Issue #11448 - improved stacktrace message for ambiguous URI
2024-02-28 06:15:56 -06:00
Joakim Erdfelt 98ceb73cc6
Issue #11387: Reintroduce MultiPartCompliance.LEGACY in ee9/ee8 (#11388)
* Issue #11387: Reintroduce MultiPartCompliance.LEGACY in ee9/ee8
* Correcting javadoc
* Updating MultiPartCaptureTest to ...
  * Test with MultiPartFormData.Parser and MultiPart.Parser
 * Enable all test cases
    * base64 behaviors modified to not auto-decode base64 content
    * forms submitted without `_charset_` part (some using a different
       charset than UTF-8, like `Shift_JIS`)
* Fixing checkstyle warning
* Re-enable Part-ContainsContents expectations
* Rename MultiPartCompliance.NO_CRLF_AFTER_PREAMBLE to WHITESPACE_BEFORE_BOUNDARY to fit spec better
* Make ee9/ee8 legacy parser use legacy tokenization
* Testing ee9/ee8 legacy parser base64 auto-decoding behaviors
* Cleanup jetty-test-multipart class naming
* Adding ee10 tests against raw multipart examples
* Adding shorter whitespace multipart test
* Adding jetty-core version of failing ee10 tests
* Fixed missed notification for CR content in case of 1 chunk ending with CR and the next chunk ending with LF.
* Removed internal unused class MultiPartParser.
* Adding MultiPartCompliance.Violation events
  + in MultiPart.Parser
  + in MultiPartFormData.Parser
* lenient mode behavior
* new name fits violation better
+ adding violation to MultiPart.Parser.parseHeaderStart
* some simple cleanup of new ee9 code

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-27 15:09:26 -06:00
Joakim Erdfelt 54aaa3a398
Improve DEBUG during WebInfConfiguration.unpack 2024-02-27 10:15:24 -06:00
Joakim Erdfelt 2803f5a872
Fixes #11270 - Improve XmlConfiguration reporting of Resource location during error (#11345)
Now catching and rethrowing XmlConfigurationException with details about the XML file location.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-27 16:39:28 +01:00
Ludovic Orban 1e6240e2f4
Fix NPE in HttpReceiverOverHTTP2.read() when the channel's stream is null (#11443)
* Added null guard.
* Avoid executing the event actions in case the response is either complete or (new change) terminated.

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-27 15:59:17 +01:00
Joakim Erdfelt bb646ed085
Improve jetty-util on Windows (#11440)
* Improve jetty-util on Windows
* Enable ATOMIC_MOVE on Resource.copyTo()
* Add reference to Resource impl in exception.
* Attempting to address sneaky Windows path strings that look like URIs
* Deprecate URIUtil.correctFileURI in favor of new URIUtil.correctURI method
2024-02-27 06:32:44 -06:00
Joakim Erdfelt 866f44584c
Issue #11361 - UriCompliance.checkUriCompliance improvements (#11444)
* Issue #11361 - UriCompliance.checkUriCompliance improvements
2024-02-27 06:32:07 -06:00
Lachlan d3f19bb947
Merge pull request #11402 from jetty/jetty-12.0.x-11398-WebSocket-CloseChannelException
Issue #11398 - allow frames to be demanded in WebSocket onOpen
2024-02-27 17:11:53 +11:00
Lachlan 4f1401438a
Merge pull request #11433 from jetty/fix/jetty-12.0.x/11278-symlink-dir-listing
Issue #11278 - fix 500 response when trying to display symlinked directory
2024-02-27 17:10:55 +11:00
Simone Bordet 6facb0f7f5
Fixes #11370 - IllegalStateException when last write fails. (#11439)
Removed the call to `ServletChannel.abort()` from the write callback.

As the write was issued from `ServletChannel.handle()` case COMPLETE, it was eventually calling `ServletChannelState.completed(Throwable)`, which is expecting the requestState to be COMPLETING.
However, calling `abort()` would set the requestState to COMPLETED, causing the IllegalStateException.

There should be no need to call `abort()` from the callback of failed writes, since failing the various callbacks should be enough, eventually failing the `HttpStream`, which would take care of tearing down the connection (HTTP/1) or the stream (HTTP/2+).

Now aborting the response from ServletChannelState.completed(Throwable).
Fixed SizeLimitHandler exception message.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-26 17:27:20 +01:00
Simone Bordet 24c1140917
Fixes #8979 - Jetty 12 - HttpClientTransport network "modes". (#11368)
* Introduced oej.io.Transport as the abstraction for the low-level transport of high-level protocols.
Now protocols such as HTTP/1.1 or HTTP/2 can be transported over TCP, QUIC, Unix-Domain, memory, and possibly over other low-level custom protocols too.
* Introduced oej.client.Request.transport(Transport) to specify Transport for each request.
* Introduced Transport to [HTTP2Client|HTTP3Client].connect(...) methods.
* Introduced [Client|Server]QuicConfiguration so that it can be used in other Connectors such as MemoryConnector.
* Introduced oej.server.MemoryConnector and EndPoint.Pipe for memory communication between peers, along with a MemoryTransport.
* Introduced QuicTransport as a wrapper for other Transports, so that QUIC can now also be transported over memory.
* Improved javadocs and documentation.
* Removed usage of ClientConnector.forUnixDomain() from FastCGIProxyServlet (ee10 and ee9).
* Replaced usage of HTTP3ServerConnector with QuicServerConnector in jetty-http3.xml.
* Fixed handling of Instruction notifications in case of re-entrance.
Now first clear the list, then notify to avoid that when re-entering the same instruction is notified multiple times.
* Introduced ContentSourceRequestContent, and updated ProxyHandler to use it.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-26 17:24:24 +01:00
Jan Bartel a1cb4750d7
Jetty 12.0.x 11377 fix jettyhome osgi path (#11418)
* Issue #11377 fix jettyhome osgi path and  WebInfConfiguration.unpack for windows
2024-02-26 12:07:10 +01:00
Simone Bordet 535e772c7e Updated code to use new UnixDomain APIs explicitly, rather than via reflection.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-23 18:47:24 +01:00
Simone Bordet 9b64130ddc
Fixes #11432 - Review number of acceptor threads. (#11436)
Defaulted to 1.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-23 15:33:27 +01:00
Ludovic Orban efc2785014
Fix buffer leaks in FCGI and H3 `HttpClientIdleTimeoutTest` (#10432)
#10226
- fix HttpClientIdleTimeoutTest to wait for server's idle timeout before checking for leaks
- improve HttpClientIdleTimeoutTest by making it upload some content
- fix FCGI server leak caused by idle timeout
- fix H3 server leak caused by idle timeout

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-02-23 13:36:58 +01:00
Lachlan Roberts 5826e56666 PR #11433 - fix for symlink loops in Resource.getAllResources
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-02-23 15:44:01 +11:00
Lachlan Roberts 4ca044486e PR #11402 - move methods to original position in WebSocketConnection
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-02-23 11:18:17 +11:00
Joakim Erdfelt bfac61cd89
Issue #11424 - Document default of `jetty.deploy.scanInterval` at `0` (#11437)
+ Update documentation and defaults in mod files
2024-02-22 14:25:01 -06:00
Lachlan Roberts 9234331d62 Issue #11278 - fix 500 response when trying to display symlinked directory
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-02-22 17:32:50 +11:00
Lachlan Roberts 436f4f8507 PR #11402 - changes for review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-02-22 15:56:52 +11:00
Lachlan 33e00dc452
Merge pull request #11279 from jetty/jetty-12.0.x-11271-AliasCheckCombinedResource
Issue #11271 - fix use of AliasCheckers with CombinedResource
2024-02-22 08:48:54 +11:00
Greg Wilkins 750584bc85
Experiment with ArrayByteBufferPool performance (#11426)
* Experiment with ArrayByteBufferPool

No overall size accounting
reserved buffer release always checks max memory
released buffers check max memory 1% of the time.
only a single thread can check memory at once.
single pass through buckets so no looping forever.

* Experiment with ArrayByteBufferPool

updates from review

* JMH updates

* updates from review

* Fixed comments.
Fixed call to recordEvict().
Removed unused methods.
Method getAvailable*Memory() no longer JMX-enabled, as they are the same as get*Memory().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>

---------

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-21 22:03:00 +01:00
Ludovic Orban 509ede1d85
Add jersey test module (#11423)
Add jersey test module

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-21 22:00:07 +01:00
Simone Bordet f3b37bc277 Fixes #8887 - Jetty-12 client calls onDataAvailable with producing thread.
Now the calls to the upper layer produce tasks that are fed to the ExecutionFactory in HTTP2Connection.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-21 21:47:45 +01:00
Joakim Erdfelt 2d51170be2
Fixes #11310 - multipart parser dropping some relevant CR bytes in parts (#11409)
Fixed case in MultiPart.Parser where a small chunk contains part of the boundary.

Added and fixed related tests.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-21 21:43:26 +01:00
Danish Nawab f8601750f3
Fixes #11353 named virtual thread executor (#11430)
Introduced `VirtualThreads.getNamedVirtualThreadsExecutor(String namePrefix)` to allow users/libraries to name virtual threads if they so wish.
2024-02-21 21:38:58 +01:00
Ludovic Orban 3a6ad49271
Jetty 12: `ContextHandler.getTempDirectory()` does not respect the `Context.getTempDirectory()` contract (#11397)
#11396 fix ContextHandler.getTempDirectory() so it never returns null as the contract mandates

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-02-21 09:26:34 +01:00
Joakim Erdfelt aa5eff978c
Issue #11410 - PathMappingsHandler does not set Server on added handlers (#11412)
* PathMappingsHandler does not set Server on added handlers
2024-02-20 14:08:44 -06:00
Greg Wilkins f07d812698
Fix #11414 URI schema and port normalization (#11416)
* Issue #11414 - use HttpURI instead of URIUtil to have a single point of spec behavior

* Issue #11414 - enforce lowercase scheme in HttpConfiguration.secureScheme

* Issue #11414 - Scheme produced on `Location` header is lowercase

* Issue #11414 - Scheme to lowercase

* Issue #11414 - Scheme to lowercase

* Revert change to HttpClient

* Added schema port knowledge to URIUtil

* Fixed tests for normalized URIs

* updates from review

* updates from review

* Fix tests

* Restored methods as deprecated

* More testing

---------

Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2024-02-20 20:12:55 +01:00
Simone Bordet d02406c164
Fixes #11371 - Review ArrayByteBufferPool eviction. (#11400)
* Fixes #11371 - Review ArrayByteBufferPool eviction.

* Eviction is now performed on release(), rather than acquire().
* Memory accounting is done on release(), rather than acquire().
This is because we were always exceeding the memory usage on acquire(), by returning a non-pooled buffer.
We only need to account for what is idle in the pool, and that is done more efficiently on release(), and it is leak-resistant (i.e. if the buffer is not returned, the memory is already non accounted for, keeping the pool consistent).
* Released entries now give precedence to Concurrent.Entry, rather than Queued.Entry, so the queued pool is always kept at minimum size.
* Changed eviction algorithm to be simpler: one pass through the buckets excluding the current, trying to remove idle buffers until enough memory is recovered.
If successful, the buffer being released is pooled, otherwise it is also discarded.
* Added detailed statistics to ArrayByteBufferPool.RetainedBuckets.
* Added statisticsEnabled property in Jetty module bytebufferpool.mod.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-20 11:02:11 +01:00
Simone Bordet 624ee584bd
Issue #6140 - SelectorManager total keys.
Removed toString() override that was not calling super, to restore printing the total number of keys in dumps.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-20 10:21:35 +01:00
Greg Wilkins 08174a3042
Fix #11401 StringBuilder rather than StringBuffer (#11406) 2024-02-19 14:52:17 +00:00
Greg Wilkins b89c7ebefe
Do not throw from HttpChannelState.read() method (#11369)
Fixes #11363 by ensuring that read never throws, but instead returns an Error chunk.
2024-02-19 08:28:16 +00:00
Lachlan Roberts 0ece73b769 PR #11402 - add check for null networkBuffer in WebSocketConnection
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-02-16 16:19:31 +11:00
Lachlan Roberts 6b079acf78 PR #11279 - move isSameFile method to Resource
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-02-16 10:47:51 +11:00
Lachlan Roberts 87aeefbbc9 Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-11271-AliasCheckCombinedResource 2024-02-15 23:48:40 +11:00
Lachlan Roberts 783c14cec4 Issue #11398 - do not deliver messages until onOpen completes
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-02-15 13:07:28 +11:00
Hervé Boutemy 3d3682597f
drop buildnumber:create already executed by jetty-util (#11360)
* drop buildnumber creation already done by jetty-util
* copy build.properties from jetty-util
2024-02-15 02:52:01 +01:00
Joakim Erdfelt 645e775114
Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2024-02-14 16:11:05 -06:00
Simone Bordet 0e79997965 Fixes #11403 - Expose SslEndPoint in SslHandshakeListener
Now also exposing the `EndPoint` in SslHandshakeListener.Event.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-14 13:41:48 +01:00
Lachlan 55e3072247
Merge pull request #11357 from jetty/jetty-12.0.x-ServerWebSocketContainer-ensure
Issue #11356 - Allow ServerWebSocketContainer to be created without ContextHandler
2024-02-14 20:18:20 +11:00
Lachlan Roberts 25fb7be7a9 Issue #11398 - allow frames to be demanded in WebSocket onOpen
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-02-14 15:20:34 +11:00
Simone Bordet 2a72ded229 Fixed ArrayByteBufferPoolTest, making it not sensible to random GC cycles that may modify the pool by removing buffers that were leaked in the tests.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-09 15:44:02 +01:00
Joakim Erdfelt 4511d5e4a5
Making FormFields get defaults from Context, not Request. 2024-02-07 11:59:38 -06:00
Simone Bordet 7e4621fea4 Fixes #11372 - Scheduler queue in the HTTP client grows infinitely when a server times out
Fixed regression introduced with #9897.
After onExpire() returns false, the entity is asked again the expirationNanoTime, but there was no check whether it was Long.MAX_VALUE, indicating that the entity should not be rescheduled.

This was causing scheduling of timeouts far in the future (about Long.MAX_VALUE nanos away), but each at a slightly different time, causing the leak.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-02-05 17:47:23 +01:00
Lachlan Roberts e3c9e2fd54 PR #11357 - fix checkstyle errors
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-02-02 13:41:56 +11:00
Lachlan Roberts bbdaf072db PR #11357 - changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-02-02 13:31:28 +11:00
Lachlan Roberts 077f9bcf61 PR #11357 - changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-02-02 13:20:52 +11:00
Lachlan Roberts 07d97de2cd PR #11279 - clarify javadoc in TrailingSlashAliasChecker
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-31 11:30:13 +11:00
Lachlan Roberts 03313567e8 PR #11279 - fixes for AliasCheckerMultipleResourceBasesTest
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-31 01:13:08 +11:00
Lachlan Roberts ee1d24ffdb Issue #11356 - Allow ServerWebSocketContainer to be created without ContextHandler
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-30 20:39:13 +11:00
Lachlan Roberts 1398bf930e add example in javadoc for TrailingSlashAliasChecker
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-30 15:36:29 +11:00
Joakim Erdfelt 82d9177f0c
Updating to version 12.0.7-SNAPSHOT 2024-01-29 21:04:51 -06:00
Joakim Erdfelt 78ab6e6ba1
Updating to version 12.0.6 2024-01-29 20:42:49 -06:00
Lachlan Roberts a1c49c6322 add TrailingSlashAliasChecker to fix tests
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-30 11:17:44 +11:00
Ludovic Orban 58eaa5f45a Merge remote-tracking branch 'origin/jetty-11.0.x' into fix/jetty-12.0.x-11349-merge-from-11 2024-01-29 22:06:32 +01:00
Lachlan 554d5b19d5
Issue #11275 - explicitly close websocket endpoint after error from DispatchedMessageSink (#11343)
* Now properly handling errors
* Added test for partial read

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-29 15:13:25 +01:00
Simone Bordet a33dd59b21 Fixes #11339 - Content-type additional parameters.
Fixed handling of Content-Type in FormFields.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-01-29 15:07:41 +01:00
Lachlan cb60e2a968
Merge pull request #11309 from jetty/jetty-12.0.x-ensureCallbackComplete-WebSocketCoreSession
ensure callback is always completed in WebSocketCoreSession
2024-01-29 11:29:31 +11:00
Simone Bordet 4e28331595
Fixes #11095 - IllegalStateException for completed requests with GzipHandler (#11210)
* In ServletChannel, in COMPLETE state, there was a check comparing the number of bytes written with that declared by Content-Length.
Unfortunately the check was wrong in case of gzip, because it was comparing the application length with the gzipped length, resulting in a late sendErrorOrAbort() that was an abort() because the response was already fully sent.
Furthermore, if sendErrorOrAbort() was actually an abort(), there was an unnecessary attempt to complete the output.
* In GzipHandlerResponseAndCallback there were 2 last writes: one when the application calls output.close(), and one when the callback is succeeded.
Furthermore, when no content needs to be written, it was still compressed, causing an IOException in ChannelResponse (again when double-checking the bytes written, since Content-Length was 0, but the gzip header and trailer were written).
* Updates semantic of when to add the "Vary" header.
Now it is always only added by GzipHandler, when it would be possible to generate a response that might be compressed (even if it will not).
* Added *.bz2 mime-type.
Updated GzipHandler with the correct mime-type for *.bz2: application/x-bzip2.
* Improved checks for the number of bytes written against declared content-length.
This is necessary because welcome files are written by DefaultServlet (most of the times) bypassing the Servlet classes, using ServletContextResponse directly.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2024-01-27 10:50:30 +01:00
Greg Wilkins c6c5f07d51
Fixes for Spring core integration (#11288)
* Cleanup of HttpFields to improve spring integration

* Fixed Subscriber for spring integration

* Fixed implementation of ContentSinkSubscriber.
Added comment to clarify behavior of ContentSinkPublisher.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>

* Apply suggestions from code review

Co-authored-by: Simone Bordet <simone.bordet@gmail.com>

* updates from review

* updates from review

* updates from review

* updates from review

* fix canRetain

* updates from review

---------

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2024-01-26 12:18:51 +09:00
Joakim Erdfelt 985b290ee6
Merge pull request #11321 from jetty/fix/12.0.x/addbean-debug-this-fix
Issue #11317 - Low hanging fix for LOG.debug in addBean.
2024-01-25 19:56:46 -06:00
Simone Bordet b5d0fd6f2f
Fixes #11096 - IllegalAccessException when invoking WebSocket endpoint methods in Jetty 12 (#11229)
Changed `JettyWebSocketFrameHandlerFactory` to use an application MethodHandle.Lookup (rather than a server one) when creating listener metadata.
This fixes the JPMS problem so that now JPMS applications do not need any additional configuration to invoke endpoints.
The (acceptable) downside is that anonymous inner classes (that are not public) cannot be used as listener endpoints.

This change affects core and EE10 WebSocket; EE9 and EE8 WebSocket have not been fixed (so they allow anonymous inner classes but are broken in JPMS).

Renamed "connectLatch" fields to "openLatch" in test classes.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Co-authored-by: Olivier Lamy <olamy@apache.org>
2024-01-25 16:40:48 +01:00
Joakim Erdfelt ef75595e8e
Merge pull request #11306 from jetty/fix/jetty-12/11282/debug-deadlock
Fixes #11282 - Deadlocks with DEBUG logging enabled in jetty-server testing.
2024-01-25 09:26:49 -06:00
Joakim Erdfelt 7cebef880a
Issue #11317 - Low hanging fix for LOG.debug in addBean. 2024-01-25 08:59:56 -06:00
Joakim Erdfelt 08af80329b
Issue #11281 - fix two NPEs seen during MultiPart with DEBUG enabled (#11313) 2024-01-25 07:43:11 -06:00
Joakim Erdfelt 9df827b802
Issue #11220 - ContextHandler NPE protections (#11318)
+ add protection for NPE seen during constructor initialization.
+ Javadoc fixes
2024-01-25 07:41:59 -06:00
Lachlan Roberts c1e2d47968 fix bug in HotSwapHandler
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-25 15:00:45 +11:00
Lachlan Roberts 642f5840a3 clarify the behaviour of SymlinkAllowedResourceAliasChecker and change behaviour
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-25 14:49:43 +11:00
Joakim Erdfelt 3853628074
Issue #11253 - Cleanup ComplianceViolation behavior to allow Cookie / URI / MultiPart compliance to also receive listener events. (#11254)
+ Introduce new events on `ComplianceViolation.Listener`
+ Introduce new `ComplianceViolation.Listener.initialize()` to allow for a new Listener at the appropriate time (to support per-request listeners)
+ Introduce new `ComplianceViolation.CapturingListener`
+ Introduce new `HttpConfiguration.(add/remove/get)ComplianceViolationListener()` methods.
+ Deprecate/Remove handling of `recordComplianceViolations` in `HttpConnection` and `HttpConnectionFactory` classes.
+ Produce warnings if use of `ComplianceViolation.Listener` as beans is still present.
+ Add `ComplianceViolation.Listener` support to `UriCompliance` locations.
+ Add `ComplianceViolation.Listener` support to `MultiPartCompliance` locations.
+ Add `ComplianceViolation.Listener` support to `CookieCompliance` locations.
+ Add `ComplianceViolation.Listener` support to `HttpCompliance` locations in HTTP/2 and HTTP/3

---------

Co-authored-by: gregw <gregw@webtide.com>
2024-01-24 08:24:05 -06:00
Ludovic Orban aa3873fb2f
Fix incorrect reliance on autoDemand when handlers are not configured (#11304)
#11303 fix incorrect reliance on autoDemand when handlers are not configured

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-01-24 09:11:25 +01:00
Jan Bartel 8163219dda
Issue #11296 Fix javadoc on AbstractLoginModule (#11297)
* Issue #11296 Fix javadoc on AbstractLoginModule
2024-01-24 06:46:29 +01:00
Lachlan Roberts 6b20ee0753 ensure callback is always completed in WebSocketCoreSession
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-24 12:00:46 +11:00
Lachlan Roberts 1e0c0b42ab ensure callback is always completed in WebSocketCoreSession
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-24 11:57:34 +11:00
Simone Bordet aa21612006
Fixes #11282 - Deadlocks with DEBUG logging enabled in jetty-server testing.
Introduced AutoLock.tryLock() to use it in the toString() implementations that lock in order to retrieve a consistent state to produce the string.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-01-23 22:04:57 +01:00
Greg Wilkins a2d86c7f67
Fix #11290 empty field (#11291)
Fixed cacheable empty field for #11290
2024-01-18 22:21:43 +00:00
Joakim Erdfelt 8cc7abe412
Adding testHostOnlyPort example from Issue #11287 2024-01-18 09:27:05 -06:00
Lachlan Roberts 7cee769276 fix check in SymlinkAllowedResourceAliasChecker
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-18 09:55:51 +11:00
Joakim Erdfelt 8368deea7e
Issue #11263 - Reduce usage of glob lib/foo/*.jar in modules (#11264)
* Using @foo.version@ technique and proper
  lib lists to allow arbitrary version
  updates from properties
* Fix spotless
* Remove duplicate entries
* Only replace System property "jetty.version" with manifest-ver if blank/null
* Fixing bad module definitions
2024-01-16 10:46:58 -06:00
Lachlan Roberts c3cc4c7092 resolve protected targets every time
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-17 00:16:08 +11:00
Lachlan Roberts aaaf7aa67b fix alias checkers to allow use of CombinedResource
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2024-01-17 00:13:26 +11:00
Simone Bordet 0839a208cd
Fixes #11259 - HTTP/2 connection not closed after idle timeout when TCP congested. (#11267)
Now upon the second idle timeout, the connection is forcibly closed.
Fixed also similar problem in HTTP/3.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-01-15 17:29:05 +01:00
Joakim Erdfelt 2c7e07e516
Merge pull request #11262 from jetty/fix/12.0.x/javadoc-typos
Correct some javadoc typos
2024-01-12 08:12:58 -06:00
Simone Bordet c8cd6f4048
Fixes #11230 Problem with parsing of form parameters without values. (#11255)
Fixed parsing of form parameters in FormFields.parse().
Added more tests for valid edge cases, and invalid cases.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-01-12 11:22:02 +01:00
Simone Bordet a9e564ad8c
Fixes #10220 - Implement CrossOriginHandler. (#11093)
Introduced CrossOriginHandler.
Added cross-origin Jetty module.
Added CrossOriginHandler documentation to the programming guide.
Added CrossOriginHandler documentation to the operations guide.
Added cross-origin headers to the HttpHeader enum.
Added test cases.
Deprecated ee10 CrossOriginFilter.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-01-12 09:57:21 +01:00
Joakim Erdfelt c8914c081a
Adding missing javadoc 2024-01-11 11:27:57 -06:00
Joakim Erdfelt 6326c2b962
Fix javadoc typos on client request content() to body() 2024-01-11 11:27:40 -06:00
Joakim Erdfelt 3a867c40f5
Fix javadoc typos 2024-01-11 11:26:20 -06:00
Simone Bordet 581f9ae9f4
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-01-08 10:19:20 +01:00
Joakim Erdfelt 62e073c52c
Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2024-01-03 14:08:11 -06:00
Simone Bordet 80a04a554f
Fixes #11098 - Sporadic NPE in ArrayByteBufferPool.evict(). (#11204)
* Reorganized ArrayByteBufferPool.evict() code to avoid NPE.
* Fixed acquire logic to take into account that a reserved entry may fail to be enabled because it may be concurrently removed.
* Small change to ConcurrentPool: no need to null check the final ConcurrentEntry.holder field.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-01-03 15:56:36 +01:00
Simone Bordet 2a3e6f72c7
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-01-02 20:14:28 +01:00
Simone Bordet 2505d0e8a6
Merge pull request #11086 from jetty/jetty-12.0.x-11081-websocketRace
Issue #11081 - fix race condition in WebSocket FrameHandlers (jetty-12)
2023-12-29 14:44:58 +01:00
Lachlan 965e4af425
Merge pull request #11083 from jetty/jetty-12.0.x-11080-multipartRetainableChunks
Issue #11080 - copy ByteBuffer for non-retainable chunks
2023-12-20 12:19:30 +11:00
Lachlan Roberts 37a296dfdc Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x-11081-websocketRace 2023-12-20 12:12:13 +11:00
Lachlan Roberts 592ccf7da0 Issue #11080 - copy ByteBuffer for non-retainable chunks
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-12-19 15:11:43 +11:00
Joakim Erdfelt 96eea590ee
Updating to version 12.0.6-SNAPSHOT 2023-12-18 08:25:22 -06:00
Joakim Erdfelt 3aed62e495
Updating to version 12.0.5 2023-12-18 08:05:54 -06:00