* 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>
* Issue #4208 Content-Length in 304
Added tests for RFC7230 section 3.3.2 for 304 and HEAD responses with content length.
Fixed HttpGenerator to set content-length in 304 response
Fixed insufficient content written check for 304
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4208 Content-Length in 304
Use contentLengthField
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* 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>
* Issue #4156 - Adding test to replicate issue
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
* Issue #4156 Session already in cache
+ check validity of sessions in getSession(SessionHandler)
+ do not replace session in doScope if SessionHandler is the same.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4176 setHeader after sendError
SendError now makes the response immutable for headers and status.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4176 setHeader after sendError
cleanup after review
better names
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4176 setHeader after sendError
better name
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4176 setHeader after sendError
even better name
Signed-off-by: Greg Wilkins <gregw@webtide.com>
The HttpConnection.SendCallback nulls it's reference to buffers and callbacks after completion to assist with easy GC, since the connection callback is a long lived instance.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
The connection upgrade check is necessary both after the parsing and
after the handling. After the parsing covers HTTP/2 prior knowledge
"PRI * HTTP/2" case; after the handling covers the WebSocket case.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
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>
Introduced module `jdbc` and made other modules that require JDBC depend on it.
Modified demo.ini to enable the `jdbc` module because some webapp descriptor
of the demo requires JDBC classes.
Now the demo can be run fine on the module-path just by adding --jpms.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added test for servlet component lifecycle
Fixed bug where we were destroying listeners before calling them.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4025 Add flushOnCommit mode to sessions.
Added flushOnCommit mode to write a session to the backing store as the
response commits, before any bytes are returned to the client.
Signed-off-by: Jan Bartel <janb@webtide.com>
* Issue #4003 Fix quickstart.
Modes:
AUTO: use quickstart xml if present, start normally otherwise
GENERATE: re/generate quickstart xml
QUICKSTART: use a pregenerated quickstart xml, fail otherwise
Signed-off-by: Jan Bartel <janb@webtide.com>
* Issue #4003 Cleanup quickstart
Removed TerminateException in favour of Server.setDryRun(boolean)
and AbstractLifeCycle.StopException
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Removes the Locker class, replaced by AutoLock.
Removed usages of Locker.isLocked() from the session code
since it was not necessary.
Took the chance to do a little code cleanup.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
+ Also made ContextHandler warning message about features
that are unimplemented (and you should use ServletContextHandler)
more clear. (this helped with diagnosing where the bug was
in ServletHolder)
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
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>
* per servlet api javadoc getLastAccessedTime should throw IllegalStateException if session has been invalidated
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
* isInvalid test should be done within lock
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
* per servlet api javadoc getLastAccessedTime should throw IllegalStateException if session has been invalidated
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
* isInvalid test should be done within lock
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
* 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>