Commit Graph

3136 Commits

Author SHA1 Message Date
Lachlan 9dbdb97529
Merge pull request #4324 from eclipse/jetty-10.0.x-4315-OnlyStopWSSessionsOnce
Issue #4315 - stop WebSocketSessions only after onClose
2019-11-27 14:24:31 +11:00
Lachlan Roberts 2410f9d6c4 Issue #4315 - Jetty and Javax WebSocketSessions are no longer LifeCycles
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-11-27 13:51:14 +11:00
Lachlan efe76ff2e0
Issue #4152 - fragment outgoing frames before the ExtensionStack (#4232)
* Added FragmentingFlusher to abstract the fragmentation of frames.

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

* Handle failure case of Fragmenting Flusher

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

* Fragment outgoing frames before the ExtensionStack

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

* update javadoc

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

* separate frame size validation for incoming and outgoing frames

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

* fix test

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

* reimplement FragmentingFlusher with the new TransformingFlusher

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-11-26 14:51:40 +11:00
Lachlan 04b1a77b6d
Issue #4152 - CompressExtension autoFragment with respect to maxFrameSize (#4260)
* rework ByteAccumulator to avoid unnecessary data copies
* use ByteAccumulator instead of BAOS for ws compression
* outgoing autoFragment working with permessage-deflate
* ByteAccumulator now uses fixed maxFrameSize and no ByteBufferPool
* rework deflate code and introduce TransformingFlusher
* use transforming flusher for outgoing compression
* general clean up CompressExtension and subclasses
* remove forward incoming method
* use flusher to fragment for the decompressing of incoming frames
* fix broken tests
* updates to TransformingFlusher
* tests for CompressExtension with no payload
* ByteAccumulator uses the BufferPool for the final buffer
* remove increased maxFrameSize from autobahn tests as we now autoFragment
* add test for gzip bomb
* fix typo
* use Throwable failure instead of canEnqueue
* changes to TransformingFlusher from review
* remove per frame deflate extension
* remove accumulation of data to maxFrameSize in CompressExtension
* race between finished being set and callback being completed
* cleanup of transforming flusher
* fix issues with the TransformingFlushers
* add internal parameters for deflate and inflate BufferSize
* missing licence header
* wip
* don't use same extension config instances in negotiated extensions
* changes to TransformingFlusher from review
* fix internal extensions requested by client
* javadoc update
* javadoc and cleanup from review
* remove ByteAccumulator
* fix module-info
* null out current on callback completion
* remove override of succeeded and failed

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-11-19 12:34:58 +11:00
Lachlan Roberts 738de7bb02 Issue #4315 - stop WebSocketSessions only after onClose
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-11-18 19:16:01 +11:00
Joakim Erdfelt 1edff35676
Merge branch 'jetty-9.4.x' into jetty-10.0.x
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>

# Conflicts:
#	jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientConnectTest.java
#	jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/ClientUpgradeRequest.java
2019-11-13 10:58:48 -06:00
Greg Wilkins 46a3368f3b
Issue #2578 - Listener behavior cleanup (Jetty 10.0.x) (#3966)
* Avoid creating listener list for rarely used requestAttributeListener

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

* Issue #3964

Keep a list of EventListeners in the AbstractConnector to make it
more efficient to add and iterate over them.

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

* Issue #2578 EventListener

Use addEventListener rather than bespoke listener methods.
Support getEventListenerBeans at Container level for fast lookup
improve javadoc

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

* Issue #2578 EventListener

fixed test
more javadoc

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

* Issue #2578 EventListener

fixed tests

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

* Issue #3964

Don't use null for empty lists of listeners

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

* fix merge

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

* Issue #2578 EventListener

Resolve differences between eventListeners added as beans and beans
added as EventListeners.   The behaviour should now be the same
regardless of how they listener is added and all listeners are now
beans.

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

* Issue #2578 EventListener

Add only SelectorManager listeners to manager from connector

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

* Issue #2578 EventListener

Fixed javadoc

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

* Issue #2578 EventListener

removed old TODO

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

* Issue #2578 EventListener

connector cannot be null

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

* Issue #2578 EventListener

javadoc

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

* Issue #3964

AbstractConnector keeps a specific list of HttpChannel.Listeners
to avoid Connection.Listeners and MBean listeners being added to
the HttpChannel listener list.

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

* Issue #2578 EventListener

fixed merge

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

* fixed javadoc

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

* Issue #2578 EventListener

removed the ability to set/clear context listeners
Instead just remove non-durable ones.

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

* Issue #3964 Listeners

Simplified listener handling by avoiding null connector, previously
only needed for testing.

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

* fixed bad merge

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

* Issue #3964 Listeners

Fixed test that assumed HttpChannel listeners were not cleared by a recycle

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

* Issue #3964 Listeners

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.

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

* removed deprecated cyclic HttpChannel listeners

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

* removed deprecated cyclic HttpChannel listeners - import

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

* Issue #4003 Cleanup quickstart

* Fixed tests that scan for "Started" on console

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

* updates from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-11-13 11:04:38 +11:00
Joakim Erdfelt 2d50c92979
Fixes #4296 - WebSocketClient cannot connect with "%25" in query
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-11-12 10:22:19 -06:00
Lachlan d0f74c5532
Issue #4124 - autobahn tests for jetty, javax websocket APIs (#4147)
- do not select duplicate extensions in javax default Configurator
- correctly copy payload for ping frames in jetty & javax frame handlers
- add ByteBuffer to javadoc for onMessage in jetty api
- cleaned up some test logging for EventSocket
- add autoFragment and maxFrameSize settings to WebSocketPolicy
- fix early validation for multiple extensions in setExtensions

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-11-07 11:06:14 +11:00
Lachlan 2310196532
Issue #1777 - configuration for jetty-10 WebSocketClient to be stopped at shutdown
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-11-07 11:02:25 +11:00
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
Lachlan f6f423f558
Issue #4152 - make WS Parser autoFragment data frames to maxFrameSize (#4219)
* Issue #4152 - make WS Parser autoFragment data frames to maxFrameSize

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

* Issue #4152 - fix broken tests

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

* Issue #4152 - fix broken tests

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

* changes from review

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-10-22 16:17:50 +11:00
Lachlan 02276113f6
Issue #4214 - fix WS flaky test ClientConnectTest (#4215)
* Issue #4214 - fix flaky ClientConnectTest and change WS connectTimeout

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

* Issue #4214 - changes from review

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-10-18 10:11:57 +11:00
Greg Wilkins 2eb251a4b8 fix logging defaults to INFO
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-10-16 13:53:57 +11:00
Lachlan 00baa7147e
Merge pull request #4153 from eclipse/jetty-9.4.x-3558-websocket_onErrorAfterClose
Issue #3558 - only notify WS onError if onClose has not been called
2019-10-10 15:27:11 +11:00
Lachlan d47264960e
Issue #3734 - throw ISE for WebSocket suspend after close (#4095)
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-10-08 09:47:48 +11:00
Lachlan Roberts d95c825c5c Issue #3558 - only notify WS onError if onClose has not been called
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-10-04 11:13:38 +10:00
Joakim Erdfelt d7a189fa18 Updating to version 10.0.0-SNAPSHOT 2019-10-03 12:05:26 -05:00
Joakim Erdfelt fd6a2cb9f6 Updating to version 10.0.0.alpha1 2019-10-03 11:25:06 -05:00
Joakim Erdfelt 6fc42d8ba2 Merge branch 'release-9.4.21' into jetty-9.4.x 2019-10-01 13:35:43 -05:00
Lachlan Roberts b83dd8472d Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-10-01 16:06:58 +10:00
Lachlan fef5975b86
Merge pull request #4108 from eclipse/jetty-9.4.x-4104-WSSession_SendAfterClose
Issue #4104 - WebSocketSession will reject outgoing frames if closed
2019-10-01 15:46:16 +10:00
Lachlan Roberts aa417f939e Fix WebSocket CompressExtension releaseDeflater() bug.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-27 10:18:35 +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 Roberts af081459ee Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-25 15:06:17 +10:00
Lachlan 3edc6c9102
Issue #3734 - throw ISE for WebSocket suspend after close (jetty-9.4) (#4098)
* Issue #3734 - throw ISE for WebSocket suspend after close

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

* Issue #3734 - suspend is error if onClose() has been called

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-25 14:55:13 +10:00
Simone Bordet f10325ea50
Merge pull request #3959 from eclipse/jetty-10.0.x-3952-server_direct_heap_bytebuffers
Fixes #3952 - Server configuration for direct/heap ByteBuffers.
2019-09-23 15:24:47 +02:00
Lachlan Roberts 5a52235464 Issue #4104 - WebSocketSession will reject outgoing frames if closed
Outgoing frames will now go RemoteEndpoint->Session->ExtensionStack
instead of just RemoteEndpoint->ExtensionStack.

This will allow the Session to check whether it has been closed before
allowing the frame through the ExtensionStack.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-20 10:30:31 +10:00
Lachlan f10ff81d1c
Fix Secure javax.websocket Client examples (#4035)
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-18 10:42:32 +10:00
Simone Bordet 0eec727a09 After review, renamed *directBuffers to *directByteBuffers.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-09-17 12:16:10 +02:00
Simone Bordet 1ef4a416b5 Merged branch 'jetty-10.0.x' into 'jetty-10.0.x-3952-server_direct_heap_bytebuffers'. 2019-09-16 12:26:26 +02:00
Lachlan b027aa5afa
Fixes #3705 - revert ClientUpgradeRequest error handling logic (#4090)
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-16 17:21:33 +10:00
Lachlan Roberts 22fba9aa91 Issue #3106 - deprecate old WebSocket stats mechanism
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-13 11:28:05 +10:00
Lachlan Roberts 63c7a44969 Issue #3982 - fix to WebSocket bytesIn for flaky WebSocketStatsTest
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-13 11:18:57 +10:00
Lachlan Roberts c2eff992b7 Issue #3982 - fix to WebSocket bytesIn for flaky WebSocketStatsTest
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-13 11:15:13 +10:00
Lachlan Roberts 387faa7e33 clean up websocket jetty-logging.properties files
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-11 18:02:18 +10:00
Lachlan 74e560fb7a
Issue #4031 - stop unopened WebSocketSessions gracefully (#4046)
* Issue #4031 - stop unopened WebSocketSessions gracefully

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

* Issue #4031 - notify onError if shutdown before open

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-09-06 13:50:33 +10:00
康智冬 49ba6d1acb fix typo and grammar (#4045)
Signed-off-by: KangZhiDong <worldkzd@gmail.com>
2019-09-02 14:29:50 -04:00
Joakim Erdfelt 4e80748b3b Merge branch `jetty-9.4.x` into `jetty-10.0.x`
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>

# Conflicts:
#	jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/ClientContainer.java
2019-08-28 15:01:41 -05:00
Joakim Erdfelt 2b72f08f1b
Merge pull request #4019 from eclipse/jetty-9.4.x-155-jsr-websocket-client-ssl-init
Issue #155 - Adding public ClientContainer(HttpClient) constructor
2019-08-28 14:31:51 -05:00
Joakim Erdfelt 4829498eab Merge branch `jetty-9.4.x` into `jetty-10.0.x`
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>

# Conflicts:
#	jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/ExtensionFactory.java
#	jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketExtensionRegistry.java
#	jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java
#	jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserDebugTool.java
#	jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServletFactory.java
2019-08-28 12:43:11 -05:00
Joakim Erdfelt 37e7884382 Issue #4020 - Applying change requested from PR review
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-28 12:36:07 -05:00
Joakim Erdfelt e56d91196d Issue #4020 - Adding JMX to BrowserDebugTool to test dump
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-28 12:31:33 -05:00
Joakim Erdfelt 2979ed5046 Fixes #4020 - Satisfy Container LifeCycle dumpable behaviors
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-27 20:25:10 -05:00
Greg Wilkins 8f383faf78
Issue #3872 Javax Websocket Packaging (#3873)
* Issue #3872 Javax Websocket Packaging

Moved JaxaxWebSocketConfiguration and SCI to config package.
Limited classpath exposure in JavaxConfiguration (more needed)
Updated tests with work around for those that needs more classes exposed

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

* Issue #3872 Javax Websocket Packaging

Moved all remaining classes from org.eclipse.jetty.websocket.javax.server
to org.eclipse.jetty.websocket.javax.server.internal.

This works when running on the classpath, but the tests fail when running
on the modulepath (eg in commandline mvn run).   The issue appears to be
that the tests don't load test classes from WEB-INF/lib or WEB-INF/classes.
Instead the test classes were themselves in  org.eclipse.jetty.websocket.javax.server,
which is no longer exported from module-info.java.

The hacked "fix" for this has been to create a org.eclipse.jetty.websocket.javax.server.tests
package which is exported and to move all the tests to that.  A better fix is needed.

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

* Issue #3872 Javax Websocket Packaging

improve comments
tighten exposed classes more

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

* Issue #3872 - fixing tests

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

* Issue #3872 - move ContainerDefaultConfigurator to config package

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

* Issue #3873 - fix javax websocket test classloader issues

move websocket endpoints for test webapps to com.acme.websocket package

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-08-28 10:03:46 +10:00
Joakim Erdfelt 6bcfa2dc6e Fixes #4020 - Deprecate ExtensionFactory
+ This class is removed in Jetty 10 anyway.
+ If all you want is to access available extension names
  then use the Factory.getAvailableExtensionNames() method
  (which exists in Jetty 10.0.0 as well)

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-27 13:25:08 -05:00
Joakim Erdfelt 149d9d4862 Fixes #4020 - Revert ExtensionFactory change to interface.
+ The change in commit 30dc103a12
  was done to allow the InflaterPool and DeflaterPool
  to be managed by the Jetty lifecycle.
+ This restore the original abstract class ExtensionFactory.
+ Had to break the traditional LifeCycle usage for a more
  non-traditional one in order to both, not break this existing
  API, and not introduce jetty-util to the webapp classloader.
+ This will restore API / binary compatibility for other
  projects, like spring-boot.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-26 13:40:32 -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