Commit Graph

2772 Commits

Author SHA1 Message Date
Joakim Erdfelt b1e6b55512 Updating to version 9.4.22.v20191022 2019-10-22 08:20:50 -05:00
Simone Bordet dc59addb6f Code cleanup.
Made method reportDifferences(...) private since it was exposing
package private class TimeNSize and no code outside of jetty-util
could have used it.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-20 16:50:31 +02:00
Simone Bordet 95b205aa34 Class InetPattern is package private, so made nnewInetRange(String)
private because no code outside jetty-util could call that method.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-20 16:18:58 +02:00
Simone Bordet 92bfcb6c73 Class Managed is package private, so made addBean(Object, Managed)
private because no code outside of jetty-util could call that method.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-20 16:10:01 +02:00
Greg Wilkins 3d19f61122
Issue #4193 - Fix InetAccess port control (#4206)
* issue exclude/include con name InetAccesHandler - add better unit test

this logic:

        String name =
baseRequest.getHttpChannel().getConnector().getName();
        return _names.test(name) && _addrs.test(addr);

Is not correct. it's treating the connector name exactly like the
filter. But that's not what it's intended to do. It's supposed to tell
what connectors are applicable to this filter. And what connectors are
not affected.

For example in the unit test there exists 2 connectors:

http
tls

We want to restrict the http connector, but we want to leave tls
connector alone.

So we would specify:

include = 192.168.1.1-192.168.1.254
includeConnector = http

The way the logic is above, it is treating the connector name as if it's
the filter itself. Which is not what I intended.

What i need in psuedo-code is this:


   if (there are no "include connectors" OR if this connector is
included) AND (if this connector is not in the excluded list)
     ---> Then apply the IP filter.

Signed-off-by: Nicholas DiPiazza <nicholas.dipiazza@lucidworks.com>

* exclude should take precedence over include

Signed-off-by: Nicholas DiPiazza <nicholas.dipiazza@lucidworks.com>

* Issue #4193 InetAccessHandler

reverted changes to IncludeExcludeSet

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

* Issue #4193 InetAccessHandler

updates from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-10-18 09:03:28 +11:00
Greg Wilkins 73924d2774
Issue #4188 Spin in close of GzipHandler (#4198)
* Issue #4188 Spin in close of GzipHandler

Cleanup and simplify code

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

* Issue #4188 Spin in close of GzipHandler

Fix slice code. Added unit test for it.

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

* Issue #4188 Spin in close of GzipHandler

Fixed last slice.

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

* cleanup from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-10-16 14:12:52 +11:00
contextshuffling 320e848c57 Fixes #4195: making test assertion more stable (#4196)
Signed-off-by: contextshuffling <contextshuffling@gmail.com>
2019-10-15 07:54:09 +11:00
Simone Bordet 0fc5ec9d18
Merge pull request #4171 from eclipse/jetty-9.4.x-4170-client_side_alias_selection
Fixes #4170 - Client-side alias selection based on SSLEngine.
2019-10-09 09:30:37 +02:00
Greg Wilkins 0bd71a4359
Pathwatcher Concurrent modification #4174 (#4175)
There is a race between the doStop clearing the key map and the watching thread
checking isRunning before iterating over the key map.

While more sophisticated approaches could be used, I think that is best to defer
until this class is reworked entirely.  For now just using a ConcurrentHashMap will
avoid the exception and the closing of the pathwatcher will prevent watching forever.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-10-09 13:58:16 +11:00
Simone Bordet 742f564332 Fixes #4170 - Client-side alias selection based on SSLEngine.
Fixed setting of host/port in AbstractConnectorHttpClientTransport
and HttpProxy so that the creation of SSLEngine can use the proper
host/port pair, and can be subsequently used in TLS components.

Introduced SslContextFactory X509ExtendedKeyManagerWrapper and
X509ExtendedTrustManagerWrapper as utility classes used internally
and in tests.

The test case for this issue required 3 keystores, so other test
classes have been refactored to use the new keystores.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-08 18:32:23 +02:00
Simone Bordet 3be178c966 Merged 'jetty-9.4.x' into 'jetty-9.4.x-2429-httpclient_backpressure'. 2019-10-03 13:17:39 +02:00
Joakim Erdfelt b121ba786b
Issue #4121 - Tests for ThreadFactory support in QTP
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-10-02 13:37:22 -05:00
Joakim Erdfelt b82b337e8e
Merge branch 'jetty-9.4.x' into jetty-9.4.x-4121-qtp-threadfactory 2019-10-02 12:55:25 -05:00
Simone Bordet 2f06976e41 Fixed flaky test and code cleanup.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-02 17:06:45 +02:00
Joakim Erdfelt dd18c698f5
Issue #4121 - ThreadFactory support in QTP
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-10-02 07:46:12 -05:00
Greg Wilkins 813fcb79ab
Jetty 9.4.x 4105 4121 4122 queued thread pool (#4146)
Several QTP fixes:

* #4105 Threads without jobs now check if they should idle die before waiting rather than before, this allows idling under steady load. 3ad6780
* #4121 ThreadFactory behaviour supported by doing thread config within newThread call. 7b306d7
* #4122 Always clear the interrupted status. c37a4ff
   task = queue.poll(timeout);

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-10-02 22:07:00 +10:00
Joakim Erdfelt 6fc42d8ba2 Merge branch 'release-9.4.21' into jetty-9.4.x 2019-10-01 13:35:43 -05:00
Simone Bordet 5b829a10e4 Cosmetics.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-01 17:23:29 +02:00
Lachlan 4fff51361d
Merge pull request #4101 from eclipse/jetty-9.4.x-4096-ReservedThreadExecutor_stop
Issue #4096 - allow thread to exit ReservedThreadExecutor on stop
2019-10-01 15:44:37 +10:00
Joakim Erdfelt 7807eafad9 Updating to version 9.4.22-SNAPSHOT 2019-09-26 10:46:28 -05:00
Joakim Erdfelt 72970db61a Updating to version 9.4.21.v20190926 2019-09-26 09:59:15 -05:00
Lachlan ba728eee5d
Issue #4105 - atomically increment idle count when starting new thread in QTP (#4118)
* Issue #4105 - starting a thread in QTP now increments idle count

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

* Issue #4105 - improve comments in test

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-26 08:15:07 +10:00
Greg Wilkins 11b60db4c3
Issue #4047 Graceful Write (#4100)
Added test to reproduce issue
Fixed bug from #2772 where output was shutdown on DONE without checking for END.
Fixed aggregation logic to aggregate last write if aggregation already started
Improved comments and clarify conditions

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-09-25 12:13:56 +10:00
Lachlan Roberts ac93ff6272 Issue #4096 resolve race between doStop and adding new threads to stack
Now using the _size AtomicInteger to resolve the race between stopping
and adding to the stack.

A _size of -1 now means no more threads can be added to the stack, and
the loop in doStop() will now only exit if it can set the size to -1.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-23 11:56:25 +10:00
Simone Bordet d39f19cc23 Issue #2429 - Review HttpClient backpressure semantic.
Introduced a Response.DemandedContentListener to explicitly separate
the will to request more content from the notification that the content
has been consumed.

Updated all transports to follow the new semantic: rather than waiting
for the callback to complete before delivering more content, now they
wait for the demand to be positive to deliver more content.

Since now the content may be unconsumed but there can be more demand,
all transport implementation had to be changed to use RetainableByteBuffer
to retain content buffers that were not consumed.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-09-19 17:19:25 +02:00
Lachlan Roberts 168a95d334 Issue #4096 - allow thread to exit ReservedThreadExecutor on stop
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-19 08:56:01 +10:00
Greg Wilkins c37c62323c updates from review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-09-17 12:41:06 +10:00
Greg Wilkins bcf6b4c581 Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-9.4.x-1036-SchedulerThreads 2019-09-17 12:36:23 +10:00
Joakim Erdfelt e013c24326
Merge pull request #4038 from eclipse/jetty-9.4.x-OpenId
OpenID Connect Authentication
2019-09-13 16:42:17 -05:00
Greg Wilkins 92e4d73dcb Issue #1036 Configure Scheduler
Allows scheduler configuration

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-09-13 09:52:28 +10:00
Lachlan Roberts dc26739502 changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-09 16:58:36 +10:00
Simone Bordet 4e67e8594e Merged branch 'jetty-9.4.x' into 'jetty-9.4.x-3978-http2_vulnerabilities'. 2019-09-05 23:12:35 +02:00
Simone Bordet 508ad4aff9 Issue #3978 - HTTP/2 vulnerabilities.
Code cleanups and reformatting.

Fixed logic for SETTINGS frame replies: they are not subject to rate control.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-09-05 23:11:53 +02:00
康智冬 49ba6d1acb fix typo and grammar (#4045)
Signed-off-by: KangZhiDong <worldkzd@gmail.com>
2019-09-02 14:29:50 -04:00
Joakim Erdfelt bb7eb4bc86 Adding some comments to URIUtilTest
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-30 09:23:34 -05:00
Lachlan Roberts d33b96f411 add OpenId module to support OpenId Connect authentication
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-08-29 08:03:11 +10:00
Joakim Erdfelt 2fcb311c56 Issue #4033 - Addressing Lenient URIUtil decode behavior change in test
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-28 16:32:19 -05:00
Joakim Erdfelt f47115c585 Issue #4033 - More tests for Lenient URIUtil behavior
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-28 12:20:52 -05:00
Joakim Erdfelt 7da57151ed Issue #4033 - lenient percent decode in URIUtil
+ Allows for preserving decoded Strings like "X%YZ"

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-28 12:08:18 -05:00
Joakim Erdfelt b2ea6a0861 Fixing Test Parameterization
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-28 10:43:15 -05:00
Greg Wilkins 83463c2a23
Issue #3964 - Listener behavior cleanup (Jetty 9.4.x) (#3965)
Issue #3964
* Avoid creating listener list for rarely used requestAttributeListener
* AbstractConnector keeps a specific list of HttpChannel.Listeners
to avoid Connection.Listeners and MBean listeners being added to
the HttpChannel listener list.
* Simplified listener handling by avoiding null connector, previously
only needed for testing.
* Fixed test that assumed HttpChannel listeners were not cleared by a recycle
* Separated out durable vs cyclic HttpChannel.Listeners, so as to
simplify handling.
* Deprecated cyclic HttpChannel.Listeners, as I'm not sure the channel is
the right place for them.
* Added improved method to combine multiple HttpChannel Listeners
into a single Listener.
* Fixed MockConnector
* Added benchmark
* Improved benchmark
* Updates from review
* Removed benchmark and alternate implementations.
* Updated javadoc
* Updates from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-08-27 17:38:20 +10:00
Greg Wilkins d216792d23 Made test not fail in symlinked directory
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-08-27 13:01:34 +10:00
Greg Wilkins bde86467f4
Issue #3806 - Make Async sendError fully Async (#3912)
* Issue #3806 async sendError

Avoid using isHandled as a test withing sendError as this can be
called asynchronously and is in a race with the normal dispatch of the
request, which could also be setting handled status.

The ErrorHandler was dispatching directly to a context from within
sendError.  This meant that an async thread can call sendError and be
dispatched to within the servlet container at the same time that the
original thread was still dispatched to the container.

This commit fixes that problem by using an async dispatch for error
pages within the ErrorHandler.  However, this introduces a new problem
that a well behaved async app will call complete after calling
sendError.  Thus we have ignore complete ISEs for the remainder of
the current async cycle.

Fixed the closing of the output after calling sendError. Do not
close if the request was async (and thus might be dispatched to an
async error) or if it is now async because the error page itself is
async.

* updates from review
* better tests
* revert ignore complete
* added some TODOs
* more TODOs
* fixed rename
* cleanup ISE and more TODOs
* refactored to call sendError for uncaught exceptions rather than onError
* more of the refactor
* extra tests for sendError from completing state

Reworked HttpChannelState and sendError so that sendError is now
just a change of state. All the work is done in the ErrorDispatch
action, including calling the ErrorHandler.  Async not yet working.

Additional tests

Converted ERRORED state to a separate boolean so it can be used for
both Sync and Async dispatches.

Removed ASYNC_IO state as it was just the same as DISPATCHED

The async onError listener handling is now most likely broken.


WIP making sendError simpler and more tests pass
WIP handling async and thrown exceptions
WIP passing tests

Improved thread handling

removed bad test

Implemented error dispatch on complete properly
more fixed tests

sendError state looks committed

- Added resetContent method to leave more non-content headers during sendError
- Fixed security tests
- simplified the non dispatch error page writing.  Moved towards being able to write async

* fixed gzipHandlerTest

* Updated handling of timeout errors.  According to servlet spec,
exceptions thrown from onTimeout should not be passed to onError, but
just logged and ignored:

   If an exception is thrown while invoking methods in an AsyncListener,
   it is logged and will not affect the invocation of any other AsyncListeners.

* This changes several tests.

* Dispatcher/ContextHandler changes for new ERROR dispatch handling. Feels a bit fragile!

* Fixed tests in jetty-servlets
* Fixed tests in jetty-proxy

* more test fixes

* Fixed head handling
reverted unnecessary changes
Improved reason handling

WIP on fully async error handling.
Simplified HttpChannelState state machines to allow for async actions
during completing

more WIP on fully async error handling.

sendError and completion are not both non-blocking, without using
a startAsync operation. However we are lacking unit tests that actually
exercise those code paths.

* Simplified name of states
Added test for async completion
* Cleanups and javadoc
* Cleanups and javadoc
* remove snake case
* feedback from review
* Write error page into fixed pooled buffer

Use the response to get/release a pooled buffer into which the error
page can be written.  Make it a fixed sized buffer and if it overflows
then no error page is generated (first overflow turns off showstacks
to save space).

The ErrorHandler badly needs to be refactored, but we cannot change
API in jetty-9

* More test fixes for different error page format
* minor cleanups
* Cleanup from Review
* Fixed javadoc
* cleanups and simplifications
* Cleanup from Review
* renaming and some TODOs
* Cleanup from Review
* Checkstyle fixes
* Cleanup from Review
* Code cleanups and simplifications
* fixed debug
* Cleanup from Review
* Ensure response sent before server shutdown
* removed unnecessary optimisation
* fixed duplicate from merge
* Updates from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-08-26 17:55:58 +10:00
Joakim Erdfelt 1867d24ef7
Merge pull request #4001 from eclipse/jetty-9.4.x-4000-swedish-unicode-file-serving
Issue #4000 - new SameFileAliasChecker to help with NFC/NFD UTF-8 differences
2019-08-23 07:27:32 -05:00
Joakim Erdfelt d0ec6e7d07
Merge pull request #3995 from eclipse/jetty-9.4.x-3983-jarfileresource-list
Fixes #3983 - JarFileResource directory listing is invalid
2019-08-22 15:09:16 -05:00
Olivier Lamy fe3d3f7158
fix checkstyle in test sources (#4013)
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
2019-08-22 19:56:41 +10:00
Joakim Erdfelt 88e37b177c Issue #4000 - Name change to isSameName
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-21 17:11:44 -05:00
Joakim Erdfelt 4ab0be9b1b Issue #3983 - Applying PR review to JarFileResource
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-21 12:43:25 -05:00
Joakim Erdfelt 30bd3914cf Issue #4000 - SameFileAliasChecker to help with NFD/NFC
+ Adding SameFileAliasChecker to help with environments
  where the Alias and the Path point to the same file,
  by relying on the FileSystem and Path implementation
  to make the determination if the two Path references
  truly point to the same file.
+ Minor cleanup of FileSystemResourceTest
+ Additional DefaultServletTest for this UTF-8 differences

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-21 12:21:04 -05:00
Joakim Erdfelt ef3f696a11 Issue #4000 - PathResource alias detection work around alt UTF-8 style
+ OSX File is `swedish-å.txt`
+ OSX has NFD form UTF-8 characters. `swedish-a%CC%8A.txt`
+ HTTP uses normal form UTF-8. `swedish-%C3%A5.txt`
+ A HTTP GET request should work against the resource
  being requested, regardless of UTF-8 style used.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-19 13:52:22 -05:00