Commit Graph

1642 Commits

Author SHA1 Message Date
Joakim Erdfelt 2b1fe8c38d Issue #4057 - Clean up identified by PR review
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-09-05 12:04:23 -05:00
Joakim Erdfelt 91d3ddced6 Issue #4057 - NPE in HttpFields.containsKey
+ Preventing HttpField from having a null name.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-09-05 10:04:25 -05:00
康智冬 49ba6d1acb fix typo and grammar (#4045)
Signed-off-by: KangZhiDong <worldkzd@gmail.com>
2019-09-02 14:29:50 -04: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
Bruce a1bb3b4491 fix formatting and change comment flags to attributes
Signed-off-by: Bruce MacDonald <brucewmacdonald@gmail.com>
2019-08-20 15:12:03 +10:00
Bruce 6ad148c8f9 parse samesite from cookie comment flag utility functions
Signed-off-by: Bruce MacDonald <brucewmacdonald@gmail.com>
2019-08-20 15:12:03 +10:00
Bruce 2e5f6fca4b parse SameSite specifier from cookie comment and move HttpOnly comment parsing to org.eclipse.jetty.http.HttpCookie
Signed-off-by: Bruce MacDonald <brucewmacdonald@gmail.com>
2019-08-20 15:12:03 +10:00
Bruce 7c691acbbe use null instead of EXCLUDED to indicate no SameSite attribute should be sent
Signed-off-by: Bruce MacDonald <brucewmacdonald@gmail.com>
2019-08-20 15:12:03 +10:00
Bruce 216f71469b Issue #3040 - Allow RFC6265 Cookies to include optional SameSite attribute
Signed-off-by: Bruce MacDonald <brucewmacdonald@gmail.com>
2019-08-20 15:12:03 +10:00
Olivier Lamy 7c0266af4c
this is not supposed to return null (#3998)
see https://javaee.github.io/javaee-spec/javadocs/javax/servlet/http/Part.html#getHeaders-java.lang.String-
this fix related tck test

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
2019-08-19 10:08:21 +10:00
Bogdan Arabadzhi f14abdd600 Add WebAssembly MIME type support
Signed-off-by: Bogdan Arabadzhi <bogdan.today@gmail.com>
2019-08-17 12:02:03 +02: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
Joakim Erdfelt 6fd8aeefde Issue #3888 - Adding HttpClient tests
+ Also applying changes from review

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-07-23 15:24:33 -05:00
Jan Bartel bb7fb48f08
Fix checkstyle warnings for tests. (#3846)
Signed-off-by: Jan Bartel <janb@webtide.com>
2019-07-03 16:42:20 +02:00
Greg Wilkins a42ad99871 Misc minor checkstyle fixes
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-06-25 11:13:34 +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
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 33fe55c339 Issue #3708 - use StringUtil alternatives for known slow JVM impls.
+ StringUtil.replace()
+ StringUtil.replaceFirst()
+ StringUtil.sanitizeFileSystemPath()

Change existing usages of String.replace() to either
use new StringUtil.replace() or other methods elsewhere
that better suit that specific need.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-06-11 11:25:50 -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
Lachlan Roberts e75ca325fd Issue #3683 - close part if failure occurs in MultiPartFormInputStream
parameterize MultiPartServletTest over compliance modes

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-06-04 12:03:24 +10:00
Lachlan Roberts 17b8eb8401 Issue #3683 - ensure multipart files are still cleaned up after errors
- do not parse MultiParts in constructor so the attribute can be set
- deleteParts in MultiPartFormInputStream from _parts MultiMap
- only add the MultiPartCleanerListener once per context

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-06-04 11:19:42 +10:00
Greg Wilkins 39be07871b Issue #3681
updates from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-31 13:17:25 +02:00
Greg Wilkins cf9c238721 Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-9.4.x-3681-HttpFieldsOptimize 2019-05-26 16:18:13 +02:00
Greg Wilkins 53dc425bde Issue #3681
updates from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-23 12:33:35 +02:00
Olivier Lamy f2c59a3cb7
add convenient StringUtil isEmpty method (#3687)
* add StringUtil.isEmpty

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
2019-05-23 09:01:36 +10:00
Greg Wilkins 4dc004cf96 Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-9.4.x-3681-HttpFieldsOptimize
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-22 23:26:48 +02:00
Greg Wilkins 0bf138f034 removed unused lines
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-22 23:10:12 +02:00
Greg Wilkins 065581edd9 cleanups
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-22 23:10:12 +02:00
Greg Wilkins 26169491c9 Issue #3655 simplifications of Cookie handling
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-22 23:10:12 +02:00
Greg Wilkins 70311fe987 Issue #3681
minor cleanups

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-22 14:02:38 +02:00
Greg Wilkins 4ac511ba13 Issue #3681
minor cleanups

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-22 13:00:48 +02:00
Greg Wilkins 2d358cd4b3 Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-9.4.x-3681-HttpFieldsOptimize 2019-05-22 08:30:00 +02:00
Michael Hausegger e8f11d3c7e Added small performance improvements
Signed-off-by: Michael Hausegger <hausegger.michael@googlemail.com>
2019-05-22 08:27:53 +02:00
Greg Wilkins f07e59554b Issue #3681
remove HttpFields instrumentation

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-21 15:26:52 +02:00
Greg Wilkins fd183af1cc Issue #3681
instrumented HttpFields

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-21 14:26:01 +02:00
Greg Wilkins 1458854d24 Issue #3681
Use LinkedHashMap<List<Pair>>

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-21 13:59:52 +02:00
Greg Wilkins 2831bfb159 Issue #3681
Better default HttpFields size with TODOs to tune.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-21 12:40:40 +02:00
Michael Hausegger 5760795f96 Corrected license header information
Signed-off-by: Michael Hausegger <hausegger.michael@googlemail.com>
2019-05-17 14:26:58 +02:00
Michael Hausegger d10f678e4c Added tests for DateParser
Signed-off-by: Michael Hausegger <hausegger.michael@googlemail.com>
2019-05-17 14:26:58 +02:00
Michael Hausegger 8b4e6a34ac Added tests for HttpScheme
Signed-off-by: Michael Hausegger <hausegger.michael@googlemail.com>
2019-05-17 14:26:58 +02:00
Michael Hausegger 53c9a8c35a Small minor performance improvements
Signed-off-by: Michael Hausegger <hausegger.michael@googlemail.com>
2019-05-15 20:23:45 +02:00
Michael Hausegger 665b1929e0 Small minor performance improvements
Signed-off-by: Michael Hausegger <hausegger.michael@googlemail.com>
2019-05-15 20:17:33 +02:00
Joakim Erdfelt b44ecc932a Issue #2909 - Replace B64Code with java.util.Base64
+ Deprecated B64Code
+ All code that isn't B64CodeTest is now using java.util.Base64
+ B64CodeTest is updated to confirm change to java.util.Base64
  is possible without change in behavior. Just have to make
  sure you use the appropriate Encoder / Decoder for the task
  at hand (default vs mime vs url)

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-05-15 10:08:11 +02:00
Greg Wilkins cec50b3d2c Issue #3630 Optimized ForwardedRequestCustomizer
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-14 17:08:01 +02:00
Greg Wilkins 05072b34dc Issue #3630 Forwarded-Port
Added support for the X-Forwarded-Port header.
Reimplemented header scanning using more efficient Trie and MethodHandles

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-14 17:08:01 +02:00
Joakim Erdfelt 41ab9baf8c Standardizing on hamcrest Matchers (not CoreMatchers from junit4)
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-04-30 14:39:57 -05:00