Commit Graph

1775 Commits

Author SHA1 Message Date
Joakim Erdfelt 1ed13b6b30 Updating to version 9.4.23-SNAPSHOT 2019-10-22 09:19:41 -05:00
Joakim Erdfelt b1e6b55512 Updating to version 9.4.22.v20191022 2019-10-22 08:20:50 -05:00
Simone Bordet 73eb82c20f Issue #4217 - SslConnection.DecryptedEndpoint.flush eternal busy loop.
Updates after review.
Added test case.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-19 20:06:10 +02:00
Simone Bordet 991cf20cce Issue #4217 - SslConnection.DecryptedEndpoint.flush eternal busy loop.
Releasing the decrypted input buffer so that it can be re-acquired
with an expanded capacity.
Looping around only if the buffer size has changed.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-19 12:27:58 +02:00
Simone Bordet 2e633a4e86 Fixes #4217 - SslConnection.DecryptedEnpoint.flush eternal busy loop.
Releasing the encrypted output buffer so that it can be re-acquired
with an expanded capacity.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-17 19:41:52 +02:00
Simone Bordet 20e0453da8 Merged branch 'jetty-9.4.x' into 'jetty-9.4.x-4201-httpclient_throw_sslhandshakeexception'. 2019-10-16 18:51:15 +02:00
Simone Bordet 1e360244a5 Fixes #4209 - Unused TLS connection is not closed in Java 11.
Added workarounds for the Java 11 behavior.

In fill(), call closeInbound() if we filled -1 and the handshake
did not start yet. This avoids to send a ClientHello to the peer
even if we are closing.

In flush(), if the handshake status is NEED_UNWRAP but we are
closing, force a wrap().

Added test cases.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-16 13:10:40 +02:00
Simone Bordet 4769de8a2b Issue #4209 - Unused TLS connection is not closed in Java 11.
Code cleanup.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-16 13:02:24 +02:00
Simone Bordet 3ce87f717c Fixes #4201 - Throw SSLHandshakeException in case of TLS handshake failures.
Now rethrowing other exceptions as SSLHandshakeException
if they happen during the TLS handshake.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-15 16:44:30 +02:00
Simone Bordet cd57af4caf
Merge pull request #4116 from eclipse/jetty-9.4.x-4115-drop_http2_pseudo_headers
Fixes #4115 - Drop HTTP/2 pseudo headers.
2019-10-10 12:15:58 +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
Simone Bordet 609c144ae0 Fixes #4115 - Drop HTTP/2 pseudo headers.
Invalid HTTP/2 headers are now causing an error rather than being ignored.

HTTP2Flusher now catches HpackException.StreamException and generates a
RST_STREAM frame, rather than just closing the connection.

Modified HpackEncoder to throw HpackException in case of encoding failure.
Introduced HpackEncoder.validateEncoding (defaults true) so validation of
the headers can be disabled (useful for tests).

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-10-03 12:45:55 +02: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 a85a18e0d8 Fixes #3787 - Jetty client throws EOFException instead of SSLHandshakeException on certificate errors.
Fixed indent.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-09-30 08:53:12 +02:00
Simone Bordet ad2770ddc2 Fixes #3787 - Jetty client throws EOFException instead of SSLHandshakeException on certificate errors.
Updates after review.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-09-27 00:15:34 +02:00
Simone Bordet 2c75e876a3 Fixes #3787 - Jetty client throws EOFException instead of SSLHandshakeException on certificate errors.
Now exceptions thrown by fill() or flush() are stored in a field.
Further fill() operations will rethrow the original exception rather
than returning -1.

Returning -1 to application was causing them to close() with a generic
failure that was triggering the EOFException reported in this issue.

Now applications see the original exception and can close() with the
proper cause.

Re-enabled HostnameVerificationTest that was reproducing this issue
reliably but was @Disabled a while back and never re-enabled.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-09-26 18:30:43 +02:00
Simone Bordet d12df30df7 Issue #3787 - Jetty client throws EOFException instead of SSLHandshakeException on certificate errors.
Code cleanups.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-09-26 18:18:13 +02: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
Simone Bordet b3be28086b Fixes #4113 - HttpClient fails with JDK 13 and TLS 1.3.
1. Now forwarding the fillable event rather than assuming that is due
to garbage bytes or by a server close. This ensures that a HTTP read
consumes the TLS bytes and the `NewSessionTicket` message.
2. Avoid to set the `SslConnection` onto the `EndPoint` in
`SslClientConnectionFactory` - this allows upgrades to work properly,
for example when tunnelling through a secure proxy.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-09-23 17:59:37 +02: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
Joakim Erdfelt 68382b9549 Issue #3989 - Cleaning up ManagedSelector.onSelectFailed
+ Based on PR review

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-09-10 03:46:26 -05:00
Joakim Erdfelt b7b744160f Issue #3989 - Tests for both Restart Server and Selector
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-09-06 16:10:30 -05:00
Joakim Erdfelt f8041b23bd Issue #3989 - Cleaning up ManagedSelector.doStop() for dead selector
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-09-06 14:54:01 -05:00
Joakim Erdfelt 0fd989f0cd Issue #3989 - Restoring _selector to null on failure
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-09-06 08:24:51 -05:00
Joakim Erdfelt d8efb62d13 Issue #3989 - Select Failure does not attempt to restart selector
+ Changes from PR review

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-09-05 12:12:49 -05:00
Joakim Erdfelt 9305914d6a Issue #3989 - Selector failure notification
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-09-04 11:16:24 -05:00
Joakim Erdfelt f6efff70d7 Issue #3989 - Selector failure notification
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-30 13:47:16 -05: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
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 f1efc99918 Updating to version 9.4.21-SNAPSHOT 2019-08-13 17:34:20 -05:00
Joakim Erdfelt 84700530e6 Updating to version 9.4.20.v20190813 2019-08-13 16:13:21 -05:00
Simone Bordet 264ceb143d Fixes #3601 - HTTP2 stall on reset streams.
After review, introduced WriteFlusher.isPending() and now using that
in the test case to test for TCP congestion.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-08-07 11:48:31 +02:00
Simone Bordet 873d1c6d7d Fixes #3601 - HTTP2 stall on reset streams.
The client reset wakes up threads blocked in
writes, but these may again attempt to write,
therefore blocking again.

Now we detect that the stream is not writable
and mark the transport as failed, so that
writes fail immediately without blocking.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-07-25 22:21:13 +02:00
Greg Wilkins 9706d70484
Jetty 9.4.x reformat (#3811)
* Removing Legacy Method Separators
* Restyling branch `jetty-9.4.x`
* Applying changes highlighted by checkstyle
* Applying XML restyling
* Fixing XML codestyle for IntelliJ
* Fixing XML style mistakes
* Revert "Applying XML restyling"
* Updating checkstyle for XML codestyle
* Reformatting pom.xml files
* Fixed empty string from line wraps
* Update intellij style to not do expression relative formatting. Reformatted code based on that.
* Increasing line split on Eclipse IDE Formatter to 512
* Restoring setting on internal default value.
+ IntelliJ will not export settings on things that set to their
  internal default values.
  We want to keep those values as a hedge against future default
  value changes in future releases of IntelliJ.
* Fixing intellij codestyle
* do not allow single line simple methods
* misc checkstyle fixes
* re-exported with correct name and all values

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-06-24 17:40:30 +02:00
Joakim Erdfelt 40e9e053b9
Merge pull request #3768 from eclipse/jetty-9.4.x-3708-stringutil-replace
Issue #3708 - use StringUtil alternatives for known slow JVM impls.
2019-06-13 14:01:35 -05:00
Lachlan c94753ece3
Issue #3746 - fix WriteFlusher ClassCastException if Callback throws (#3778)
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-06-13 15:51:22 +10:00
Joakim Erdfelt 877815e195 Issue #3708 - Adding new methods and converting codebase to use them
+ StringUtil.replace(String, char, char)
+ StringUtil.strip(String, String)
+ URIUtil.encodeSpecific(String, String)
+ URIUtil.decodeSpecific(String, String)
+ TypeUtil.toClassReference(Class)
+ TypeUtil.toClassReference(String)

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-06-12 09:56:41 -05:00
Joakim Erdfelt ae21126cad Updating to version 9.4.20-SNAPSHOT 2019-06-10 13:40:17 -05:00
Joakim Erdfelt afcf563148 Updating to version 9.4.19.v20190610 2019-06-10 11:17:56 -05:00
Joakim Erdfelt c33f3a75ed Merge branch `release-9.4.18` into `jetty-9.4.x` 2019-04-30 11:44:06 -05:00
Simone Bordet de9cc312a4 Fixes #3534 - Don't use System.currentTimeMillis() in IdleTimeout.
Removed usages of System.currentTimeMillis() and cleaned up the code.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-04-30 15:24:24 +04:00
Joakim Erdfelt 734be56938 Updating to version 9.4.19-SNAPSHOT 2019-04-29 16:27:23 -05:00
Joakim Erdfelt e1bc35120a Updating to version 9.4.18.v20190429 2019-04-29 15:40:33 -05:00
Joakim Erdfelt 05bb111580 Updating to version 9.4.18-SNAPSHOT 2019-04-18 15:59:49 -05:00
Joakim Erdfelt aa1c656c31 Updating to version 9.4.17.v20190418 2019-04-18 14:44:28 -05:00
Joakim Erdfelt 79537a5f51 Updating to version 9.4.17-SNAPSHOT 2019-04-11 11:00:24 -05:00
Joakim Erdfelt e0aa4ae4c0 Updating to version 9.4.16.v20190411 2019-04-11 10:01:26 -05:00
Simone Bordet a15154c290 Issue #3481 - TLS close_notify() is not guaranteed.
Making sure that if a wrap() requires multiple passes,
they are done before returning.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-04-05 17:20:43 +11:00
Greg Wilkins 36df72d455 Issue #3481 TLS Close
Updates from review:
 - revert outputShutdown logic

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-05 17:20:43 +11:00